From ababb28fc2ffd6ff781a5f9e929ca5ef14b7388f Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 5 Jun 2012 15:18:24 +0300 Subject: [PATCH] buildpackage/dump_tree: use GitRepository.archive() Make dump_tree() utilize the GitRepository.archive() method - similarly to git_archive_submodules() - instead of ad-hoc Python pipes. This makes dump_tree() work independent of the callers current working directory. Signed-off-by: Markus Lehtonen Conflicts: gbp/scripts/common/buildpackage.py --- gbp/scripts/common/buildpackage.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py index c34b491..c275292 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -19,7 +19,6 @@ """Common functionality for Debian and RPM buildpackage scripts""" import os, os.path -import pipes import tempfile import subprocess import shutil @@ -144,21 +143,15 @@ def untar_data(outdir, data): if popen.wait(): raise GbpError("Error extracting tar to %s" % outdir) - #{ Functions to handle export-dir -def dump_tree(repo, export_dir, treeish, with_submodules, recursive=True): +def dump_tree(repo, export_dir, treeish, with_submodules): """Dump a git tree-ish to output_dir""" if not os.path.exists(export_dir): os.makedirs(export_dir) - if recursive: - paths = '' - else: - paths = [nam for _mod, typ, _sha, nam in repo.list_tree(treeish) if - typ == 'blob'] try: - data = repo.archive('tar', '', None, treeish, paths) + data = repo.archive('tar', '', None, treeish) untar_data(export_dir, data) - if recursive and with_submodules and repo.has_submodules(): + if with_submodules and repo.has_submodules(): repo.update_submodules() for (subdir, commit) in repo.get_submodules(treeish): gbp.log.info("Processing submodule %s (%s)" % (subdir, -- 2.7.4