diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-04-04 19:04:35 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-04-04 19:25:36 +0200 |
commit | e4db34b4adf1434581c76e7c58d6927f8d50154b (patch) | |
tree | 0a4895c15c49f871af8393b67042fc1c8a146d8e /git-buildpackage | |
parent | 8d2c6bd851ece9c316696aa3f0760d4636626958 (diff) |
add postbuild hook
can be used to e.g. run lintian.
Closes: #521358
Diffstat (limited to 'git-buildpackage')
-rwxr-xr-x | git-buildpackage | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/git-buildpackage b/git-buildpackage index 1f2c4e25..73621568 100755 --- a/git-buildpackage +++ b/git-buildpackage @@ -138,7 +138,6 @@ def write_wc(repo): def main(argv): changelog = 'debian/changelog' - default_tree = 'HEAD' retval = 0 prefix = "git-" @@ -183,6 +182,8 @@ def main(argv): help="command to build the Debian package, default is '%(builder)s'") cmd_group.add_config_file_option(option_name="cleaner", dest="cleaner", help="command to clean the working copy, default is '%(cleaner)s'") + cmd_group.add_config_file_option(option_name="postbuild", dest="postbuild", + help="hook run after a successful build, default is '%(postbuild)s'") cmd_group.add_config_file_option(option_name="posttag", dest="posttag", help="hook run after a successful tag operation, default is '%(posttag)s'") export_group.add_config_file_option(option_name="export-dir", dest="export_dir", @@ -220,10 +221,18 @@ def main(argv): try: cp = du.parse_changelog(changelog) + version = cp['Version'] + version_no_epoch = cp['NoEpoch-Version'] + if du.is_native(cp): + major = cp['Debian-Version'] + else: + major = cp['Upstream-Version'] except du.NoChangelogError: raise GbpError, "'%s' does not exist, not a debian package" % changelog except du.ParseChangeLogError, err: raise GbpError, "Error parsing Changelog: %s" % err + except KeyError: + raise GbpError, "Can't parse version from changelog" if not options.tag_only: @@ -248,11 +257,7 @@ def main(argv): print "Exporting '%s' to '%s'" % (options.export, tmp_dir) dump_tree(tmp_dir, tree) cp = du.parse_changelog(os.path.join(tmp_dir, 'debian', 'changelog')) - if du.is_native(cp): - version = cp['Debian-Version'] - else: - version = cp['Upstream-Version'] - export_dir = os.path.join(output_dir, "%s-%s" % (cp['Source'], version)) + export_dir = os.path.join(output_dir, "%s-%s" % (cp['Source'], major)) print "Moving '%s' to '%s'" % (tmp_dir, export_dir) move_old_export(export_dir) os.rename(tmp_dir, export_dir) @@ -278,24 +283,23 @@ def main(argv): # Finally build the package: RunAtCommand(options.builder, dpkg_args, shell=True)(dir=build_dir) - + if options.postbuild: + arch = du.get_arch() + changes = os.path.abspath("%s/../%s_%s_%s.changes" % + (build_dir, cp['Source'], version_no_epoch, arch)) + Command(options.postbuild, shell=True, + extra_env={'GBP_CHANGES_FILE': changes})() if options.tag or options.tag_only: - try: - version = cp['Version'] - except KeyError: - raise GbpError, "Can't parse version from changelog" - else: - print "Tagging %s" % version - tag = build_tag(options.debian_tag, version) - GitTag(options.sign_tags, options.keyid)(tag, - msg="Debian release %s" % version) - if(options.posttag): - sha = repo.rev_parse("%s^{}" % tag) - Command(options.posttag, shell=True, - extra_env={'GBP_TAG': tag, - 'GBP_BRANCH': branch, - 'GBP_SHA1': sha})() - + print "Tagging %s" % version + tag = build_tag(options.debian_tag, version) + GitTag(options.sign_tags, options.keyid)(tag, + msg="Debian release %s" % version) + if options.posttag: + sha = repo.rev_parse("%s^{}" % tag) + Command(options.posttag, shell=True, + extra_env={'GBP_TAG': tag, + 'GBP_BRANCH': branch, + 'GBP_SHA1': sha})() except CommandExecFailed: retval = 1 except GbpError, err: |