X-Git-Url: https://git.ralfj.de/auto-debuild.git/blobdiff_plain/c36195ffb7cf682d2ddd2ba754064c79b2a7fc53..cb44f55ec0d9f4c20e841a621d69fb727d832db4:/auto_debuild.py diff --git a/auto_debuild.py b/auto_debuild.py index 11935ef..640ac4f 100755 --- a/auto_debuild.py +++ b/auto_debuild.py @@ -105,7 +105,7 @@ class RulesFile: print(file=f) print(".PHONY: build", file=f) # there may be a directory called "build" print(file=f) - print("build %:", file=f) # need to mention "build" here again explicitly so PHONY takes effect + print("%:", file=f) # write proper dh call dh = self.dh if self.dhWith: @@ -138,6 +138,7 @@ def automakeRules(r, config): # and HOST_GNU_TYPE are equal, and if they are not, add a --host parameter) r.dh += ["--buildsystem=autoconf", "--builddirectory="+config.getstr('buildDir')] r.rules['auto_configure'] = [ + (safeCall(*config['autogen']) + " && " if 'autogen' in config else '') + safeCall("mkdir", "-p", buildDir), safeCall("cd", buildDir) + " && " + 'BUILD_TYPE=$$(dpkg-architecture -qDEB_BUILD_GNU_TYPE) && ' + # doing the expansion beforehand ensures that we cancel if it fails @@ -178,22 +179,22 @@ def commandInBuildEnv(config, command): def getArchitecture(config): cmd = commandInBuildEnv(config, ['dpkg-architecture', '-qDEB_HOST_ARCH']) output = subprocess.check_output(cmd) - return output.decode('utf-8').strip('\n') # chop of the \n at the end + return output.decode('utf-8').strip('\n') # chop off the \n at the end def writeDependency(f, name, list): if len(list): print(name+": "+', '.join(list), file=f) +# actual work functions def deleteDebianFolder(): if os.path.islink('debian'): target = os.readlink('debian') if os.path.exists(target): shutil.rmtree(target) os.remove('debian') - else: + elif os.path.exists('debian'): shutil.rmtree('debian') -# actual work functions def createDebianFiles(config): if not isinstance(config, ConfigDict): config = ConfigDict(config)