diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-12-20 17:01:17 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-12-20 17:13:17 +0100 |
commit | eec8ce3e2f35d6f06a5ddb9b4a6f264a1ecf4bca (patch) | |
tree | 663ad791f51731b3aa0959b2bc0930d4f42c8168 /gbp | |
parent | ca93ccb43ef9737992d2032d53eb1b17b7332de9 (diff) | |
download | git-buildpackage-eec8ce3e2f35d6f06a5ddb9b4a6f264a1ecf4bca.tar.gz git-buildpackage-eec8ce3e2f35d6f06a5ddb9b4a6f264a1ecf4bca.tar.bz2 git-buildpackage-eec8ce3e2f35d6f06a5ddb9b4a6f264a1ecf4bca.zip |
Determine changes file name based on dpkg-buildpackage options
Closes: #732678
Diffstat (limited to 'gbp')
-rwxr-xr-x | gbp/scripts/buildpackage.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index b815c553..753ad64a 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})() |