From 4338f962fb5664e1f19733ff7ede81a274cd3d18 Mon Sep 17 00:00:00 2001 Message-Id: <4338f962fb5664e1f19733ff7ede81a274cd3d18.1715123683.git.mdw@distorted.org.uk> From: Mark Wooding Date: Wed, 27 Mar 2013 21:25:50 +0000 Subject: [PATCH] agpl.py: Exclude the root directory from listers. Organization: Straylight/Edgeware From: Mark Wooding Otherwise we'll get a strange number of them. Instead, include it manually. --- agpl.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/agpl.py b/agpl.py index 20b6166..734be25 100644 --- a/agpl.py +++ b/agpl.py @@ -79,9 +79,10 @@ def filez(cmd): z = buf.find('\0', i) if z < 0: break f = buf[i:z] + i = z + 1 + if f == '.': continue if f.startswith('./'): f = f[2:] yield f - i = z + 1 left = buf[i:] if left: raise U.ExpectedError, \ @@ -93,11 +94,12 @@ DUMPERS = [ filez('find .git -print0')]), (lambda d: True, [filez('find . ( ! -perm +004 -prune ) -o -print0')])] -def dump_dir(dir, tf, root): +def dump_dir(name, dir, dirmap, tf, root): for test, listers in DUMPERS: if test(dir): break else: raise U.ExpectedError, (500, "no dumper for `%s'" % dir) + tf.add(dir, OS.path.join(root, name), recursive = False) for lister in listers: base = OS.path.basename(dir) for file in lister(dir): @@ -135,7 +137,7 @@ def source(out): gid = OS.getgid(); ti.gid, ti.gname = gid, GR.getgrgid(gid).gr_name tf.addfile(ti, fileobj = StringIO(fest)) for dir, name in dirmap: - dump_dir(dir, tf, root) + dump_dir(name, dir, dirmap, tf, root) tf.close() ###----- That's all, folks -------------------------------------------------- -- [mdw]