summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-09-12 17:01:40 +0200
committerStefan Metzmacher <metze@samba.org>2012-09-12 23:52:56 +0200
commit4989a9dd7c89e446e59e9faf7cbe4a9a6b0083a8 (patch)
tree7f7959784fa0aeaf5835db0d675a3777e7ab2a6a /buildtools/wafsamba
parentc33643ebb354637f8651c5356b8e7445f0931ce8 (diff)
downloadsamba-4989a9dd7c89e446e59e9faf7cbe4a9a6b0083a8.tar.gz
samba-4989a9dd7c89e446e59e9faf7cbe4a9a6b0083a8.tar.bz2
samba-4989a9dd7c89e446e59e9faf7cbe4a9a6b0083a8.zip
build:waf dist: factor out function to add list of files to the tarball
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_dist.py51
1 files changed, 29 insertions, 22 deletions
diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
index 1f56f2e3ec..871c111019 100644
--- a/buildtools/wafsamba/samba_dist.py
+++ b/buildtools/wafsamba/samba_dist.py
@@ -99,6 +99,34 @@ def vcs_dir_contents(path):
def dist(appname='',version=''):
+
+ def add_files_to_tarball(tar, srcdir, srcsubdir, dstdir, dstsubdir, blacklist, files):
+ if blacklist == None:
+ blacklist = []
+ for f in files:
+ abspath = os.path.join(srcdir, f)
+
+ if srcsubdir != '.':
+ f = f[len(srcsubdir)+1:]
+
+ # Remove files in the blacklist
+ if f in blacklist:
+ continue
+ blacklisted = False
+ # Remove directories in the blacklist
+ for d in blacklist:
+ if f.startswith(d):
+ blacklisted = True
+ if blacklisted:
+ continue
+ if os.path.isdir(abspath):
+ continue
+ if dstsubdir != '.':
+ f = dstsubdir + '/' + f
+ fname = dstdir + '/' + f
+ add_tarfile(tar, fname, abspath, srcsubdir)
+
+
if not isinstance(appname, str) or not appname:
# this copes with a mismatch in the calling arguments for dist()
appname = Utils.g_module.APPNAME
@@ -135,28 +163,7 @@ def dist(appname='',version=''):
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:]
-
- # Remove files in the blacklist
- if f in blacklist:
- continue
- blacklisted = False
- # Remove directories in the blacklist
- for d in blacklist:
- if f.startswith(d):
- blacklisted = True
- if blacklisted:
- continue
- if os.path.isdir(abspath):
- continue
- if destdir != '.':
- f = destdir + '/' + f
- fname = dist_base + '/' + f
- add_tarfile(tar, fname, abspath, dir)
+ add_files_to_tarball(tar, srcdir, dir, dist_base, destdir, blacklist, files)
if dist_files:
for file in dist_files.split():