diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-10-09 11:30:32 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-10-09 13:10:00 +0200 |
commit | 43beb386357cbf572f7c593644ac497a52e14cb0 (patch) | |
tree | c7c38d27f741132a63057f9bf159d6f8a3bba849 | |
parent | e4c893da66bcf4d757e25ac68958deb0ad1eb5c6 (diff) |
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
-rw-r--r-- | gbp/git/repository.py | 12 | ||||
-rw-r--r-- | 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 |