aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/manpages/git-buildpackage.sgml15
-rw-r--r--gbp.conf2
-rw-r--r--gbp/config.py1
-rwxr-xr-xgit-buildpackage50
4 files changed, 44 insertions, 24 deletions
diff --git a/docs/manpages/git-buildpackage.sgml b/docs/manpages/git-buildpackage.sgml
index 6ef3cc45..651039b8 100644
--- a/docs/manpages/git-buildpackage.sgml
+++ b/docs/manpages/git-buildpackage.sgml
@@ -29,6 +29,7 @@
<arg><option>--git-[no-]sign-tags</option></arg>
<arg><option>--git-keyid=</option><replaceable>gpg-keyid</replaceable></arg>
<arg><option>--git-posttag=</option><replaceable>command</replaceable></arg>
+ <arg><option>--git-postbuild=</option><replaceable>command</replaceable></arg>
<arg><option>--git-debian-tag=</option><replaceable>tag-format</replaceable></arg>
<arg><option>--git-no-create-orig</option></arg>
<arg><option>--git-tarball-dir=</option><replaceable>directory</replaceable></arg>
@@ -156,7 +157,19 @@
<term><option>--git-posttag=</option><replaceable>command</replaceable>
</term>
<listitem>
- <para>excecute <replaceable>command</replaceable> after tagging a new version</para>
+ <para>excecute <replaceable>command</replaceable> after tagging a new
+ version.</para><para>Exported environment variables are GBP_TAG (the name
+ of the generated tag), GBP_BRANCH (the branch the package was build
+ from) and GBP_SHA1 (the sha1 of the commit the tag was created at).</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><option>--git-postbuild=</option><replaceable>command</replaceable>
+ </term>
+ <listitem>
+ <para>excecute <replaceable>command</replaceable> after succesful
+ build.</para><para> The name of the generated changes file is exportes as
+ GBP_CHANGES_FILE into the environment.</para>
</listitem>
</varlistentry>
<varlistentry>
diff --git a/gbp.conf b/gbp.conf
index 6fa05a42..7a1029e6 100644
--- a/gbp.conf
+++ b/gbp.conf
@@ -24,6 +24,8 @@
#keyid = 0xdeadbeef
# push to a remote repository after a successful tag:
#posttag = git-push git.example.com
+# call lintian after a successful build:
+#postbuild = lintian $GBP_CHANGES_FILE
# use this for more svn-buildpackage like behaviour:
#export-dir = ../build-area/
#tarball-dir = ../tarballs/
diff --git a/gbp/config.py b/gbp/config.py
index 2cf294ba..6fa223a6 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -34,6 +34,7 @@ class GbpOptionParser(OptionParser):
'no-create-orig' : 'False',
'keyid' : '',
'posttag' : '',
+ 'postbuild' : '',
'debian-tag' : 'debian/%(version)s',
'upstream-tag' : 'upstream/%(version)s',
'filter' : [],
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: