2022-04-12 11:21:55 +00:00
|
|
|
#!/usr/bin/env python3
|
2019-05-29 16:40:02 +00:00
|
|
|
|
|
|
|
import zipfile
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def main(zip_path, manifest_in):
|
2024-03-21 13:48:23 +00:00
|
|
|
with open(manifest_in, 'r', encoding='utf-8') as manifest, \
|
2019-05-29 16:40:02 +00:00
|
|
|
zipfile.ZipFile(zip_path, 'r', allowZip64=True) as z:
|
|
|
|
files_in_zip = set(z.namelist())
|
2022-03-21 02:11:21 +00:00
|
|
|
files_in_manifest = {l.strip() for l in manifest.readlines()}
|
2019-05-29 16:40:02 +00:00
|
|
|
added_files = files_in_zip - files_in_manifest
|
|
|
|
removed_files = files_in_manifest - files_in_zip
|
|
|
|
if added_files:
|
|
|
|
print("Files added to bundle:")
|
|
|
|
for f in sorted(list(added_files)):
|
|
|
|
print('+' + f)
|
|
|
|
if removed_files:
|
|
|
|
print("Files removed from bundle:")
|
|
|
|
for f in sorted(list(removed_files)):
|
|
|
|
print('-' + f)
|
2022-03-21 02:11:21 +00:00
|
|
|
|
|
|
|
return 1 if added_files or removed_files else 0
|
2019-05-29 16:40:02 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2022-03-21 02:11:21 +00:00
|
|
|
sys.exit(main(sys.argv[1], sys.argv[2]))
|