Tweak checksum verification
* Assume that all versions have checksums * Don't print the checksum if it matched
This commit is contained in:
parent
e65c2c14e9
commit
ebd42a91a0
17
hererocks.py
17
hererocks.py
@ -268,19 +268,12 @@ class Program(object):
|
|||||||
else:
|
else:
|
||||||
print(message + " (cached)")
|
print(message + " (cached)")
|
||||||
|
|
||||||
expected_checksum = self.checksums.get(self.get_file_name())
|
print("Verifying SHA256 checksum")
|
||||||
if expected_checksum:
|
expected_checksum = self.checksums[self.get_file_name()]
|
||||||
observed_checksum = sha256_of_file(archive_name)
|
observed_checksum = sha256_of_file(archive_name)
|
||||||
if expected_checksum == observed_checksum:
|
if expected_checksum != observed_checksum:
|
||||||
print("SHA256 checksum of {} matches:".format(archive_name))
|
sys.exit("Error: SHA256 checksum mismatch for {}\nExpected: {}\nObserved: {}".format(
|
||||||
print(expected_checksum)
|
archive_name, expected_checksum, observed_checksum))
|
||||||
else:
|
|
||||||
print("Error: wrong SHA256 checksum of {}!".format(archive_name))
|
|
||||||
print("Expected: {}".format(expected_checksum))
|
|
||||||
print("Observed: {}".format(observed_checksum))
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
print("Warning: no known checksum to verify {}".format(archive_name))
|
|
||||||
|
|
||||||
if self.win32_zip:
|
if self.win32_zip:
|
||||||
archive = zipfile.ZipFile(archive_name)
|
archive = zipfile.ZipFile(archive_name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user