summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-17 15:13:40 +0300
committerGuido Günther <agx@sigxcpu.org>2014-12-28 13:03:40 +0100
commit4cd6627ab728acf0e08bb62bd981de6601c773ea (patch)
treefba44faf2544db8886a5a7702b6a2a8da18324d9 /gbp
parent578e394e3933fbae30d7185572317b63188ffbc0 (diff)
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.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py
index 0522cd6..2e53b78 100644
--- a/gbp/scripts/common/buildpackage.py
+++ b/gbp/scripts/common/buildpackage.py
@@ -101,13 +101,19 @@ def git_archive_single(treeish, output, prefix, comp_type, comp_level, comp_opts
#{ 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 tree to output_dir"
output_dir = os.path.dirname(export_dir)
prefix = sanitize_prefix(os.path.basename(export_dir))
+ if recursive:
+ paths = []
+ else:
+ paths = ["'%s'" % nam for _mod, typ, _sha, nam in
+ repo.list_tree(treeish) if typ == 'blob']
pipe = pipes.Template()
- pipe.prepend('git archive --format=tar --prefix=%s %s' % (prefix, treeish), '.-')
+ pipe.prepend('git archive --format=tar --prefix=%s %s -- %s' %
+ (prefix, treeish, ' '.join(paths)), '.-')
pipe.append('tar -C %s -xf -' % output_dir, '-.')
top = os.path.abspath(os.path.curdir)
try:
@@ -115,7 +121,7 @@ def dump_tree(repo, export_dir, treeish, with_submodules):
if ret:
raise GbpError("Error in dump_tree archive pipe")
- if with_submodules:
+ if recursive and with_submodules:
if repo.has_submodules():
repo.update_submodules()
for (subdir, commit) in repo.get_submodules(treeish):