summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-11-29 23:47:00 +0100
committerJelmer Vernooij <jelmer@samba.org>2010-11-30 00:32:41 +0100
commit7ab6aa157534921aabb8af2bf2c672d85f217b8e (patch)
treebc2529eb5338d58cb7b1071e89f8f36fc0b38731 /buildtools/wafsamba
parent05cb5ad87c355126b1440c2c603f7de43e41a0a4 (diff)
downloadsamba-7ab6aa157534921aabb8af2bf2c672d85f217b8e.tar.gz
samba-7ab6aa157534921aabb8af2bf2c672d85f217b8e.tar.bz2
samba-7ab6aa157534921aabb8af2bf2c672d85f217b8e.zip
samba_dist: Fix dist for subprojects.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Tue Nov 30 00:32:41 CET 2010 on sn-devel-104
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_dist.py40
1 files changed, 30 insertions, 10 deletions
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index b62f256ee4..320a8584bb 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -71,6 +71,32 @@ def add_tarfile(tar, fname, abspath, basedir):
fh.close()
+def vcs_dir_contents(path):
+ """Return the versioned files under a path.
+
+ :return: List of paths relative to path
+ """
+ repo = path
+ while repo != "/":
+ if os.path.isdir(os.path.join(repo, ".git")):
+ ls_files_cmd = [ 'git', 'ls-files', '--full-name',
+ os.path.relpath(path, repo) ]
+ cwd = None
+ env = dict(os.environ)
+ env["GIT_DIR"] = os.path.join(repo, ".git")
+ break
+ elif os.path.isdir(os.path.join(repo, ".bzr")):
+ ls_files_cmd = [ 'bzr', 'ls', '--recursive',
+ os.path.relpath(path, repo)]
+ cwd = repo
+ env = None
+ break
+ repo = os.path.dirname(repo)
+ if repo == "/":
+ raise Exception("unsupported or no vcs for %s" % path)
+ return Utils.cmd_output(ls_files_cmd, cwd=cwd, env=env).split()
+
+
def dist(appname='',version=''):
if not isinstance(appname, str) or not appname:
# this copes with a mismatch in the calling arguments for dist()
@@ -103,20 +129,14 @@ def dist(appname='',version=''):
else:
destdir = '.'
absdir = os.path.join(srcdir, dir)
- if os.path.isdir(os.path.join(absdir, ".git")):
- ls_files_cmd = [ 'git', 'ls-files', '--full-name', absdir ]
- elif os.path.isdir(os.path.join(absdir, ".bzr")):
- ls_files_cmd = [ 'bzr', 'ls', '--from-root', '--recursive', '-d', absdir ]
- else:
- Logs.error('unknown or no vcs for %s' % absdir)
- sys.exit(1)
try:
- files = Utils.cmd_output(ls_files_cmd).split()
- except:
- Logs.error('command failed: %s' % ' '.join(ls_files_cmd))
+ files = vcs_dir_contents(absdir)
+ except Exception, e:
+ Logs.error('unable to get contents of %s: %s' % (absdir, e))
sys.exit(1)
for f in files:
abspath = os.path.join(srcdir, f)
+
if dir != '.':
f = f[len(dir)+1:]