From: Guido Günther Date: Fri, 20 Dec 2013 16:01:17 +0000 (+0100) Subject: Determine changes file name based on dpkg-buildpackage options X-Git-Tag: debian/0.6.8~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eec8ce3e2f35d6f06a5ddb9b4a6f264a1ecf4bca;p=tools%2Fgit-buildpackage.git Determine changes file name based on dpkg-buildpackage options Closes: #732678 --- diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index b815c55..753ad64 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -348,6 +348,23 @@ def disable_hooks(options): setattr(options, hook, '') +def changes_file_suffix(dpkg_args): + """ + >>> changes_file_suffix(['-A']) + 'all' + >>> changes_file_suffix(['-S']) + 'source' + >>> changes_file_suffix([]) == du.get_arch() + True + """ + if '-S' in dpkg_args: + return 'source' + elif '-A' in dpkg_args: + return 'all' + else: + return os.getenv('ARCH', None) or du.get_arch() + + def parse_args(argv, prefix): args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == 0 ] dpkg_args = [ arg for arg in argv[1:] if arg.find('--%s' % prefix) == -1 ] @@ -554,17 +571,12 @@ def main(argv): RunAtCommand(options.builder, dpkg_args, shell=True, extra_env={'GBP_BUILD_DIR': build_dir})(dir=build_dir) if options.postbuild: - arch = os.getenv('ARCH', None) or du.get_arch() changes = os.path.abspath("%s/../%s_%s_%s.changes" % (build_dir, source.sourcepkg, - source.changelog.noepoch, arch)) + source.changelog.noepoch, + changes_file_suffix(dpkg_args))) gbp.log.debug("Looking for changes file %s" % changes) - if not os.path.exists(changes): - changes = os.path.abspath("%s/../%s_%s_source.changes" % - (build_dir, - source.sourcepkg, - source.changelog.noepoch)) Command(options.postbuild, shell=True, extra_env={'GBP_CHANGES_FILE': changes, 'GBP_BUILD_DIR': build_dir})()