From 43beb386357cbf572f7c593644ac497a52e14cb0 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 9 Oct 2016 11:30:32 +0200 Subject: GitRepository.archive: use _git_inout instead of the deprecated _git_getoutput that spews to stderr This silences a spurious output to stderr in test_buildpackage_rpm --- gbp/git/repository.py | 12 +++++++----- gbp/scripts/buildpackage_rpm.py | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 4621afad..bf5d528f 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1737,7 +1737,7 @@ class GitRepository(object): return result #} - def archive(self, format, prefix, output, treeish, **kwargs): + def archive(self, format, prefix, output, treeish, cwd=None): """ Create an archive from a treeish @@ -1751,11 +1751,13 @@ class GitRepository(object): @type treeish: C{str} @param kwargs: additional commandline options passed to git-archive """ - args = ['--format=%s' % format, '--prefix=%s' % prefix, - '--output=%s' % output, treeish] - out, ret = self._git_getoutput('archive', args, **kwargs) + args = ['--format=%s' % format, + '--prefix=%s' % prefix, + '--output=%s' % output, + treeish] + out, err, ret = self._git_inout('archive', args, cwd=cwd, capture_stderr=True) if ret: - raise GitRepositoryError("Unable to archive %s" % treeish) + raise GitRepositoryError("Unable to archive %s: %s" % (treeish, err.strip())) def collect_garbage(self, auto=False): """ diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 8c131f3a..4129ee81 100644 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -78,8 +78,8 @@ def git_archive(repo, spec, output_dir, treeish, prefix, comp_level, git_archive_single(treeish, output, prefix, spec.orig_src['compression'], comp_level, comp_opts, spec.orig_src['archive_fmt']) - except (GitRepositoryError, CommandExecFailed): - gbp.log.err("Error generating submodules' archives") + except (GitRepositoryError, CommandExecFailed) as e: + gbp.log.err("Error generating submodules' archives: %s" % e) return False return True -- cgit v1.2.3