summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-17 15:13:40 +0300
committerJun Wang <junbill.wang@samsung.com>2016-01-27 04:58:19 +0800
commit489da2b3f119088e85ade4b02963953c6025ba80 (patch)
tree2e08ed5a6b6632599e46f9d78f59ab873e17a55e /gbp
parent8c4c1d48f00e69f2eb40995fd2e8f8f78f7cbcd1 (diff)
downloadgit-buildpackage-489da2b3f119088e85ade4b02963953c6025ba80.tar.gz
git-buildpackage-489da2b3f119088e85ade4b02963953c6025ba80.tar.bz2
git-buildpackage-489da2b3f119088e85ade4b02963953c6025ba80.zip
buildpackage/dump_tree: add 'recursive' option
For selecting whether to dump all the files recursively or just the top level directory of the tree. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r--gbp/scripts/common/buildpackage.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py
index c2752929..be5b5444 100644
--- a/gbp/scripts/common/buildpackage.py
+++ b/gbp/scripts/common/buildpackage.py
@@ -144,14 +144,19 @@ def untar_data(outdir, data):
raise GbpError("Error extracting tar to %s" % outdir)
#{ Functions to handle export-dir
-def dump_tree(repo, export_dir, treeish, with_submodules):
+def dump_tree(repo, export_dir, treeish, with_submodules, recursive=True):
"""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)
+ data = repo.archive('tar', '', None, treeish, paths)
untar_data(export_dir, data)
- if with_submodules and repo.has_submodules():
+ if recursive and 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,