aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Freed <dwfreed@mtu.edu>2016-10-27 16:23:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2016-10-27 16:23:56 -0700
commit9cda4b7a844318613815c1aa4754196d10809a5c (patch)
tree83e51c8265dd1a8e474a1b269063f547bc575be4 /thicken-manifests.py
parentExtract Manifest mtime bump per https://bugs.gentoo.org/show_bug.cgi?id=59693... (diff)
downloadmastermirror-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-xthicken-manifests.py24
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)