summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-26 19:32:01 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-26 19:32:01 +0200
commit1e46acf2e17097dbe515061270f41ff7d0e187de (patch)
tree7813321b521f23275b4c03288f94086849a7b237 /utils
parenta17068273499917448f8ace04d9fff0f30ee7c60 (diff)
downloadgemato-1e46acf2e17097dbe515061270f41ff7d0e187de.tar.gz
gen-test-manifest: Account for compressed files
Diffstat (limited to 'utils')
-rwxr-xr-xutils/gen-test-manifest.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/utils/gen-test-manifest.py b/utils/gen-test-manifest.py
index f104fed..1dcd58a 100755
--- a/utils/gen-test-manifest.py
+++ b/utils/gen-test-manifest.py
@@ -23,16 +23,23 @@ def write_manifest_entry(manifest_file, t, path, relpath, hashes):
def write_manifest_entries_for_dir(manifest_file, topdir, hashes):
for dirpath, dirs, files in os.walk(topdir):
- if 'Manifest' in files and dirpath != topdir:
- fp = os.path.join(dirpath, 'Manifest')
- write_manifest_entry(manifest_file, 'MANIFEST',
- fp, os.path.relpath(fp, topdir), hashes)
- # do not descend
- dirs.clear()
- continue
+ if dirpath != topdir:
+ for f in files:
+ if f.startswith('Manifest'):
+ fp = os.path.join(dirpath, f)
+ write_manifest_entry(manifest_file, 'MANIFEST',
+ fp, os.path.relpath(fp, topdir), hashes)
+ # do not descend
+ dirs.clear()
+ skip = True
+ break
+ else:
+ skip = False
+ if skip:
+ continue
for f in files:
- if f == 'Manifest':
+ if f.startswith('Manifest'):
continue
fp = os.path.join(dirpath, f)
write_manifest_entry(manifest_file, 'DATA',
@@ -57,7 +64,7 @@ def gen_metamanifests(top_dir, hashes):
for bm in alldirs:
bmdir = os.path.join(top_dir, bm)
- if not os.path.exists(os.path.join(bmdir, 'Manifest')):
+ if not list(glob.glob(os.path.join(bmdir, 'Manifest*'))):
with io.open(os.path.join(bmdir, 'Manifest'), 'w') as f:
write_manifest_entries_for_dir(f, bmdir, hashes)