diff options
author | Brent Stapleton <brent.stapleton@ettus.com> | 2018-03-15 14:18:03 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-03-16 10:58:08 -0700 |
commit | f5241fcab30385fe066358272f1e23fbac0fd543 (patch) | |
tree | 8eee62e992928cc0efcdbc99e9fde66e60203794 /host/utils/uhd_images_downloader.py.in | |
parent | 2dda429ebd78e44446001190ee496720792d32b4 (diff) | |
download | uhd-f5241fcab30385fe066358272f1e23fbac0fd543.tar.gz uhd-f5241fcab30385fe066358272f1e23fbac0fd543.tar.bz2 uhd-f5241fcab30385fe066358272f1e23fbac0fd543.zip |
utils: Adding option to skip SHA in downloader
Targets in the manifest with SHA256 values of '0' will not be
verified. This will allow us to skip the verification for certain
image packages (ie. the filesystem).
Diffstat (limited to 'host/utils/uhd_images_downloader.py.in')
-rw-r--r-- | host/utils/uhd_images_downloader.py.in | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 5dffe625e..4c39aece2 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -358,17 +358,22 @@ def main(): buffer_size=args.buffer_size, print_progress=(_LOG_LEVEL <= _LOG_LEVELS.get("INFO", 3)) ) + log("TRACE", "{} successfully downloaded ({} Bytes)" + .format(temp_path, downloaded_size)) + + # If the SHA256 in the manifest has the value '0', this is a special case and + # we just skip the verification step + if target_sha256 == '0': + log("DEBUG", "Skipping SHA256 check for {}.".format(full_url)) # If the check fails, print an error and don't unzip the file - if downloaded_sha256 != target_sha256: - log("ERROR", "Downloaded SHA256 does not match manifest for {}! " - "The images from this package have not been updated." - .format(full_url)) + elif downloaded_sha256 != target_sha256: + log("ERROR", "Downloaded SHA256 does not match manifest for {}!".format( + full_url)) continue # Note: this skips the --keep option, so we'll never keep image packages - # that fail the SHA256 checksum - log("TRACE", "{} successfully downloaded ({} Bytes)" - .format(temp_path, downloaded_size)) + # that fail the SHA256 checksum + # Otherwise, the check has succeeded, and we can proceed delete_from_inv(filename, inventory, images_dir) archive_namelist = extract(temp_path, images_dir, archive_type) if args.keep: |