aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-11-04 16:19:35 +0100
committerGuido Günther <agx@sigxcpu.org>2016-11-04 16:26:10 +0100
commitea5775a23e5223026b37100d23229b1bfc39bafa (patch)
tree3f715a64685ce1a5880a13d0706d8fea4cae8329 /gbp
parentced46db062f8e38c0eed7d1feb6e6e8b0d6435f9 (diff)
commands: allow to fall back to error reason if stderr is empty
Use this in PristineTar and SrcRpmFile to give better error messages if the command doesn't even get to print to stderr (i.e. missing on disk). Closes: #842592
Diffstat (limited to 'gbp')
-rw-r--r--gbp/command_wrappers.py2
-rw-r--r--gbp/pkg/pristinetar.py4
-rw-r--r--gbp/rpm/__init__.py2
3 files changed, 5 insertions, 3 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index e16c1080..f4b00b89 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -140,8 +140,10 @@ class Command(object):
"""
stdout = self.stdout.rstrip() if self.stdout else self.stdout
stderr = self.stderr.rstrip() if self.stderr else self.stderr
+ stderr_or_reason = self.stderr.rstrip() if self.stderr else self.err_reason
return self.run_error.format(stdout=stdout,
stderr=stderr,
+ stderr_or_reason=stderr_or_reason,
err_reason=self.err_reason)
def __call__(self, args=[], quiet=False):
diff --git a/gbp/pkg/pristinetar.py b/gbp/pkg/pristinetar.py
index ac24998f..79e1334e 100644
--- a/gbp/pkg/pristinetar.py
+++ b/gbp/pkg/pristinetar.py
@@ -64,7 +64,7 @@ class PristineTar(Command):
@param archive: the name of the orig archive
@type archive: C{str}
"""
- self.run_error = 'Pristine-tar couldn\'t checkout "%s": {stderr}' % os.path.basename(archive)
+ self.run_error = 'Pristine-tar couldn\'t checkout "%s": {stderr_or_reason}' % os.path.basename(archive)
self.__call__(['checkout', archive])
def commit(self, archive, upstream):
@@ -77,6 +77,6 @@ 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': {stderr}" %
+ self.run_error = ("Couldn't commit to '%s' with upstream '%s': {stderr_or_reason}" %
(self.branch, upstream))
self.__call__(['commit', archive, upstream])
diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py
index 119d55ed..5a9a6688 100644
--- a/gbp/rpm/__init__.py
+++ b/gbp/rpm/__init__.py
@@ -99,7 +99,7 @@ class SrcRpmFile(object):
c = gbpc.RunAtCommand('rpm2cpio',
[self.srpmfile, '|', 'cpio', '-id'],
shell=True, capture_stderr=True)
- c.run_error = "'%s' failed: {stderr}" % (" ".join([c.cmd] + c.args))
+ c.run_error = "'%s' failed: {stderr_or_reason}" % (" ".join([c.cmd] + c.args))
c(dir=dest_dir)