aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-01-07 18:28:10 +0100
committerGuido Günther <agx@sigxcpu.org>2017-01-07 18:28:10 +0100
commitc57df33c229510de04dd3742c36e55ab022acc52 (patch)
treec8f6c67ef78eb007d491b4f6350abf3f20098cde
parent42ee784640f09c2937e2b8e1d29b0130a6c1846f (diff)
gbp-posttag-push: Push pristine-tar as well
iff configured
-rwxr-xr-xexamples/gbp-posttag-push28
1 files changed, 22 insertions, 6 deletions
diff --git a/examples/gbp-posttag-push b/examples/gbp-posttag-push
index 8cb16715..26103ee8 100755
--- a/examples/gbp-posttag-push
+++ b/examples/gbp-posttag-push
@@ -12,10 +12,12 @@ tag is signed.
It will only push changes up to the tag and it will figure out if it
needs to push an upstream tag and the upstream branch as well (given
-the -u option). Before performing a package upload it checks if it can
-push the changes to the repo to ensure the Debian archive and the VCS
-stay in sync (as good as possible given the async nature of the upload
-into the archive).
+the -u option). It will push the pristine-tar branch if configured.
+
+Before performing a package upload it checks if it can push the
+changes to the repo to ensure the Debian archive and the VCS stay in
+sync (as good as possible given the async nature of the upload into
+the archive).
Configuration
-------------
@@ -125,6 +127,8 @@ def build_parser(name):
dest="debian_tag")
parser.add_config_file_option(option_name="upload-cmd",
dest="upload_cmd")
+ parser.add_boolean_config_file_option(option_name="pristine-tar",
+ dest="pristine_tar")
parser.add_config_file_option(option_name="color", dest="color", type='tristate')
parser.add_config_file_option(option_name="color-scheme",
dest="color_scheme")
@@ -160,7 +164,7 @@ def upload_changes(changes, cmd, dryrun):
return ret
-def do_push(repo, dests, debian_tag, debian_sha1, upstream_tag, upstream_sha1, upstream_branch, dry_run):
+def do_push(repo, dests, debian_tag, debian_sha1, upstream_tag, upstream_sha1, upstream_branch, pristine_tar_sha1, dry_run):
verb = "Dry-run: Pushing" if dry_run else "Pushing"
for dest in dests:
gbp.log.info("%s %s to %s" % (verb, debian_tag, dest))
@@ -174,6 +178,10 @@ def do_push(repo, dests, debian_tag, debian_sha1, upstream_tag, upstream_sha1, u
upstream_sha1, remote=True):
gbp.log.info("%s %s to %s:%s" % (verb, upstream_sha1, dest, upstream_branch))
repo.push(dest, upstream_sha1, upstream_branch, dry_run)
+ if pristine_tar_sha1:
+ branch = repo.pristine_tar.branch
+ gbp.log.info("%s %s to %s:%s" % (verb, pristine_tar_sha1, dest, branch))
+ repo.push(dest, pristine_tar_sha1, branch, dry_run)
def main(argv):
@@ -214,6 +222,13 @@ def main(argv):
return 0
source = DebianSource(GitVfs(repo, env.tag))
+ version = source.changelog.noepoch
+
+ if source.is_native():
+ pristine_tar_sha1 = None
+ else:
+ upstream_version = source.changelog.upstream_version
+ pristine_tar_sha1 = repo.pristine_tar.get_commit('%s_%s.orig.tar.*' % (source.sourcepkg, upstream_version))
try:
if options.upload_cmd:
@@ -224,8 +239,8 @@ def main(argv):
upstream_tag if options.push_upstream and upstream_tag else None,
upstream_sha1,
options.upstream_branch,
+ pristine_tar_sha1 if options.pristine_tar else None,
dry_run=True)
- version = repo.tag_to_version(env.tag, options.debian_tag).split(':')[-1]
changes = find_changes(source.sourcepkg, version)
if len(changes):
retval = upload_changes(changes, options.upload_cmd, options.dryrun)
@@ -241,6 +256,7 @@ def main(argv):
upstream_tag if options.push_upstream and upstream_tag else None,
upstream_sha1,
options.upstream_branch,
+ pristine_tar_sha1 if options.pristine_tar else None,
dry_run=False)
except (GbpError, GitRepositoryError) as err:
if str(err):