Commit 8aef6d12 authored by Martin Braun's avatar Martin Braun Committed by michael-west

utils: Allow downloader to ship non-zip files

Note: All archives shipped using this tool are zip files. However, this
allows us to ship other types of files, which will be downloaded and
sorted into the images directory as-is.
parent f68d745e
......@@ -462,12 +462,20 @@ def main():
# Otherwise, the check has succeeded, and we can proceed
delete_from_inv(target_info, inventory, images_dir)
archive_namelist = extract(temp_path, images_dir, archive_type, args.test)
if args.keep:
# If the user wants to keep the downloaded archive,
# save it to the images directory and add it to the inventory
if os.path.splitext(temp_path)[1].lower() == '.zip':
archive_namelist = extract(
temp_path,
images_dir,
archive_type,
args.test)
if args.keep:
# If the user wants to keep the downloaded archive,
# save it to the images directory and add it to the inventory
shutil.copy(temp_path, images_dir)
archive_namelist.append(filename)
else:
archive_namelist = []
shutil.copy(temp_path, images_dir)
archive_namelist.append(filename)
inventory[target_name] = {"repo_hash": target_hash,
"contents": archive_namelist,
"filename": filename}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment