aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-12-07 16:57:10 +0100
committerGuido Günther <agx@sigxcpu.org>2016-12-07 17:00:40 +0100
commitbf4afbe0c7ca648684a0e3b0b96e73d9af6665c8 (patch)
tree6ef8308e67c0a52e64e0517b0eeee6f058c6a297
parent321f4066e9a5f5145dab2a41e94caf58391d2734 (diff)
gbp-posttag-push: catch exceptions
instead of printing the full trace
-rwxr-xr-xexamples/gbp-posttag-push50
1 files changed, 28 insertions, 22 deletions
diff --git a/examples/gbp-posttag-push b/examples/gbp-posttag-push
index 91d3eb1..8e9c4e3 100755
--- a/examples/gbp-posttag-push
+++ b/examples/gbp-posttag-push
@@ -29,7 +29,7 @@ import sys
import gbp.log
from gbp.command_wrappers import Command, CommandExecFailed
from gbp.config import GbpOptionParserDebian
-from gbp.deb.git import DebianGitRepository
+from gbp.deb.git import DebianGitRepository, GitRepositoryError
from gbp.deb.source import DebianSource
from gbp.errors import GbpError
from gbp.git.vfs import GitVfs
@@ -181,28 +181,34 @@ def main(argv):
source = DebianSource(GitVfs(repo, env.tag))
- for dest in dests:
- gbp.log.info("Pushing %s to %s" % (env.tag, dest))
- repo.push_tag(dest, env.tag)
- gbp.log.info("Pushing %s to %s %s" % (env.sha1, dest, dests[dest]))
- repo.push(dest, env.sha1, dests[dest])
- if options.push_upstream and upstream_tag:
- gbp.log.info("Pushing %s to %s" % (upstream_tag, dest))
- repo.push_tag(dest, upstream_tag)
- if not repo.branch_contains("%s/%s" % (dest, options.upstream_branch),
- upstream_sha1, remote=True):
- gbp.log.info("Pushing %s to %s %s" % (upstream_sha1, dest, options.upstream_branch))
- repo.push(dest, upstream_sha1, options.upstream_branch)
-
- if options.upload_cmd:
- version = repo.tag_to_version(env.tag, options.debian_tag)
- changes = find_changes(source.sourcepkg, version)
- if len(changes):
- retval = upload_changes(changes, options.upload_cmd, options.dryrun)
+ try:
+ for dest in dests:
+ gbp.log.info("Pushing %s to %s" % (env.tag, dest))
+ repo.push_tag(dest, env.tag)
+ gbp.log.info("Pushing %s to %s %s" % (env.sha1, dest, dests[dest]))
+ repo.push(dest, env.sha1, dests[dest])
+ if options.push_upstream and upstream_tag:
+ gbp.log.info("Pushing %s to %s" % (upstream_tag, dest))
+ repo.push_tag(dest, upstream_tag)
+ if not repo.branch_contains("%s/%s" % (dest, options.upstream_branch),
+ upstream_sha1, remote=True):
+ gbp.log.info("Pushing %s to %s %s" % (upstream_sha1, dest, options.upstream_branch))
+ repo.push(dest, upstream_sha1, options.upstream_branch)
+
+ if options.upload_cmd:
+ version = repo.tag_to_version(env.tag, options.debian_tag)
+ changes = find_changes(source.sourcepkg, version)
+ if len(changes):
+ retval = upload_changes(changes, options.upload_cmd, options.dryrun)
+ else:
+ gbp.log.info("No changes file found, nothing to upload.")
else:
- gbp.log.info("No changes file found, nothing to upload.")
- else:
- gbp.log.info("No upload command defined, not uploading to the archive")
+ gbp.log.info("No upload command defined, not uploading to the archive")
+ except (GbpError, GitRepositoryError) as err:
+ if str(err):
+ gbp.log.err(err)
+ retval = 1
+
return retval