diff options
author | Doug Freed <dwfreed@mtu.edu> | 2016-10-27 16:23:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2016-10-27 16:23:56 -0700 |
commit | 9cda4b7a844318613815c1aa4754196d10809a5c (patch) | |
tree | 83e51c8265dd1a8e474a1b269063f547bc575be4 /thicken-manifests.py | |
parent | Extract Manifest mtime bump per https://bugs.gentoo.org/show_bug.cgi?id=59693... (diff) | |
download | mastermirror-scripts-9cda4b7a844318613815c1aa4754196d10809a5c.tar.gz mastermirror-scripts-9cda4b7a844318613815c1aa4754196d10809a5c.tar.bz2 mastermirror-scripts-9cda4b7a844318613815c1aa4754196d10809a5c.zip |
Fix edge cases in Manifest thickening.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'thicken-manifests.py')
-rwxr-xr-x | thicken-manifests.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/thicken-manifests.py b/thicken-manifests.py index 0e46f04..4da598a 100755 --- a/thicken-manifests.py +++ b/thicken-manifests.py @@ -83,14 +83,14 @@ def maybe_thicken_manifest(pkg_dir): manifest_entries = [] for root in pkg_dir, os.path.join(pkg_dir, 'files'): for filename in dir_contents[root]: - if filename == 'Manifest': + if filename == 'Manifest' and root == pkg_dir: continue file_mtime = math.floor(os.stat(os.path.join(root, filename)).st_mtime) if file_mtime > newest_mtime: newest_mtime = file_mtime - if os.path.split(root)[1] == 'files': + if root != pkg_dir: manifest_entries.append('AUX ' + filename) elif filename.endswith('.ebuild'): manifest_entries.append('EBUILD ' + filename) @@ -168,18 +168,20 @@ location = %s subdirectories.remove(dirname) if (not subdirectories or subdirectories == ['files']) and 'metadata.xml' in files: + if os.path.sep not in os.path.split(root)[0]: + # EDGE CASE: category with single package called "files" + continue pkg_dirs.append(root[2:]) dir_contents[root[2:]] = files - elif os.path.split(root)[1] == 'files' and 'metadata.xml' not in files: - dir_contents[root[2:]] = files - for dirname in subdirectories[:]: - subdirectories.remove(dirname) - os.chdir(root) - for root2, subdirectories2, files2 in os.walk('.'): - if root2 != '.': + if 'files' in subdirectories: + subdirectories.remove('files') + filesdir = os.path.join(root, 'files') + dir_contents[filesdir[2:]] = [] + os.chdir(filesdir) + for root2, subdirectories2, files2 in os.walk('.'): for filename in files2: - dir_contents[root[2:]].append(os.path.join(root2[2:], filename)) - os.chdir(args.location) + dir_contents[filesdir[2:]].append(os.path.join(root2[2:], filename)) + os.chdir(args.location) pkg_dirs.sort() pool = multiprocessing.Pool(args.jobs, worker_init) |