aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-06-26 12:23:30 +0200
committerGuido Günther <agx@sigxcpu.org>2017-06-26 12:31:46 +0200
commitf1c3a6f4dc6ceee5be5d49b4d193da8fd36c8920 (patch)
treebebc010a918bb8eac65f5ab98db9573634aa6e78
parentbcdedd64892965a4582715d0589e235237220fda (diff)
DebianGitRepository: better pristine-tar errors
We should not raise CommandErrors from methods on a GitRepository so convert the error and suppress the output. This will make us use the hander for GitRepositoryErrors in import_orig and pristine_tar which default to printing the error message. Closes: #829252
-rw-r--r--gbp/deb/git.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index ac76aff..0a2bddc 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -17,6 +17,7 @@
"""A Git Repository that keeps a Debian Package"""
import re
+from gbp.command_wrappers import CommandExecFailed
from gbp.git import GitRepository, GitRepositoryError
from gbp.deb.pristinetar import DebianPristineTar
from gbp.format import format_str
@@ -292,12 +293,15 @@ class DebianGitRepository(GitRepository):
components = [c for (c, t) in component_tarballs]
main_tree = self.tree_drop_dirs(upstream_tree, components)
- for component, name in component_tarballs:
- subtree = self.tree_get_dir(upstream_tree, component)
- if not subtree:
- raise GitRepositoryError("No tree for '%s' found in '%s' to create pristine tar commit from" % (component, upstream_tree))
- gbp.log.debug("Creating pristine tar commit '%s' from '%s'" % (component, subtree))
- self.pristine_tar.commit(name, subtree)
- self.pristine_tar.commit(tarball, main_tree)
+ try:
+ for component, name in component_tarballs:
+ subtree = self.tree_get_dir(upstream_tree, component)
+ if not subtree:
+ raise GitRepositoryError("No tree for '%s' found in '%s' to create pristine tar commit from" % (component, upstream_tree))
+ gbp.log.debug("Creating pristine tar commit '%s' from '%s'" % (component, subtree))
+ self.pristine_tar.commit(name, subtree, quiet=True)
+ self.pristine_tar.commit(tarball, main_tree, quiet=True)
+ except CommandExecFailed as e:
+ raise GitRepositoryError(str(e))
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: