X-Git-Url: https://git.ralfj.de/auto-debuild.git/blobdiff_plain/e2ba60734fa52dacdf59203b09af6324b0014922..7683491ebe972088c3a3147f1766e214f7753b6a:/auto_debuild.py diff --git a/auto_debuild.py b/auto_debuild.py index cb2d840..8ef290b 100755 --- a/auto_debuild.py +++ b/auto_debuild.py @@ -53,11 +53,14 @@ def cmakeRules(config): return r def automakeRules(config): + # "build" is what we are building *on*, and "host" is what we are building *for* (and GNU is weird...) + # also, we don't really support cross-building... ;-) (to do, we'd have to write shell code that checks whether BUILD_GNU_TYPE + # and HOST_GNU_TYPE are equal, and if they are not, add a --host parameter) r = RulesFile() r.dh += ["--buildsystem=autoconf"] r.rules['auto_configure'] = [ 'BUILD_TYPE=$$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) && ' + # doing the expansion beforehand ensures that we cancel if it fails - 'MULTIARCH=$$(dpkg-architecture -qDEB_BUILD_MULTIARCH) && '+ + 'MULTIARCH=$$(dpkg-architecture -qDEB_HOST_MULTIARCH) && '+ './configure --build=$$BUILD_TYPE '+ # do the escape manually here so we can use the variables (there's no user-controlled string in here anyway) '--prefix=/usr --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info '+ '--libdir=/usr/lib/$$MULTIARCH --libexecdir=/usr/lib/$$MULTIARCH '+ @@ -74,7 +77,7 @@ def commandInBuildEnv(config, command): return command def getArchitecture(config): - cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_BUILD_ARCH']) + cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_HOST_ARCH']) p = subprocess.Popen(cmd, stdout=subprocess.PIPE) res = p.communicate()[0] # get only stdout if p.returncode != 0: raise Exception("Querying dpkg for the architecture failed") @@ -148,7 +151,7 @@ def createDebianFiles(config): files.append(os.path.join(debDir, "%s-dbg_%s_%s.deb" % (binaryName, version, arch))) # install file with open('debian/'+binaryName+'.install', 'w') as f: - for line in config.get('binaryInstall', []): + for line in config.get('binaryInstallFiles', []): if line.startswith('/'): # a file from within the package, not from the source tree line = 'debian/'+binaryName+line print >>f, line @@ -188,7 +191,7 @@ def createDebianFiles(config): def buildDebianPackage(config): commands = ['dpkg-checkbuilddeps', 'debian/rules clean', 'debian/rules build', 'fakeroot debian/rules binary', 'debian/rules clean'] - command = ['nice', 'bash', '-c', ' && '.join(commands)] + command = ['bash', '-c', ' && '.join(commands)] # make it all one command, so we don't have to open and close the chroot too often subprocess.check_call(commandInBuildEnv(config, command)) shutil.rmtree('debian') # it only contains what we just created