From e360bc99420e5f5ae9a5caa9d47f19e50edbea61 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Mon, 29 Oct 2018 16:02:53 -0700 Subject: 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. --- host/utils/uhd_images_downloader.py.in | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'host/utils') diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 11f8ad39b..48f444d45 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -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} -- cgit v1.2.3