summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
Diffstat (limited to 'buildtools')
-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():