summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-03-26 19:25:21 +0100
committerGuido Günther <agx@sigxcpu.org>2015-03-27 12:16:31 +0100
commit89574a099066da9e215477cd0f71716560be454d (patch)
treeb0f6acda98dab527b31a0084e591bf4fb6d59e6e
parent335dfdb7a95a92d773749e6f2b5ebf951a792608 (diff)
Don't let pristine-tar spew on stderr
Capture its output and only dump it on failure. This makes "gbp import-orig" and test runs less verbose.
-rw-r--r--gbp/pkg/pristinetar.py6
-rw-r--r--tests/test_PristineTar.py16
2 files changed, 19 insertions, 3 deletions
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py
index 1c4eb5b..0f4ee46 100644
--- a/gbp/pkg/pristinetar.py
+++ b/gbp/pkg/pristinetar.py
@@ -27,7 +27,7 @@ class PristineTar(Command):
def __init__(self, repo):
self.repo = repo
- super(PristineTar, self).__init__(self.cmd, cwd=repo.path)
+ super(PristineTar, self).__init__(self.cmd, cwd=repo.path, capture_stderr=True)
def has_commit(self, archive_regexp):
"""
@@ -63,7 +63,7 @@ class PristineTar(Command):
@param archive: the name of the orig archive
@type archive: C{str}
"""
- self.run_error = 'Couldn\'t checkout "%s": {err_reason}' % os.path.basename(archive)
+ self.run_error = 'Pristine-tar couldn\'t checkout "%s": {stderr}' % os.path.basename(archive)
self.__call__(['checkout', archive])
def commit(self, archive, upstream):
@@ -76,7 +76,7 @@ class PristineTar(Command):
@param upstream: the upstream branch to diff against
@type upstream: C{str}
"""
- self.run_error = ("Couldn't commit to '%s' with upstream '%s': {err_reason}" %
+ self.run_error = ("Couldn't commit to '%s' with upstream '%s': {stderr}" %
(self.branch, upstream))
self.__call__(['commit', archive, upstream])
diff --git a/tests/test_PristineTar.py b/tests/test_PristineTar.py
index e837ef8..1e7f2dc 100644
--- a/tests/test_PristineTar.py
+++ b/tests/test_PristineTar.py
@@ -122,6 +122,22 @@ def test_pristine_tar_checkout():
>>> repo.pristine_tar.checkout('upstream', '1.0', 'gzip', '..')
"""
+def test_pristine_tar_checkout_nonexistent():
+ """
+ Checkout a tarball that does not exist using pristine-tar
+
+ Methods tested:
+ - L{gbp.deb.pristinetar.DebianPristineTar.checkout}
+
+ >>> import gbp.deb.git
+ >>> repo = gbp.deb.git.DebianGitRepository(repo_dir)
+ >>> repo.pristine_tar.checkout('upstream', '1.1', 'gzip', '..')
+ Traceback (most recent call last):
+ ...
+ CommandExecFailed: Pristine-tar couldn't checkout "upstream_1.1.orig.tar.gz": fatal: Path 'upstream_1.1.orig.tar.gz.delta' does not exist in 'refs/heads/pristine-tar'
+ pristine-tar: git show refs/heads/pristine-tar:upstream_1.1.orig.tar.gz.delta failed
+ <BLANKLINE>
+ """
def test_teardown():
"""