Repository navigation
Check hash when downloading ports - #8788
Conversation
|
The laziest way to update the port is to just build the port locally, and copy the new hash from the exception message. The another way is to do |
| if sha512hash: | ||
| actual_hash = hashlib.sha512(data).hexdigest() | ||
| if actual_hash != sha512hash: | ||
| raise RuntimeError('Unexpected hash: ' + actual_hash) |
There was a problem hiding this comment.
If we expect developers to update their hashes only after seeing this error, it might be a good idea to add some documentation of that to the error message.
There was a problem hiding this comment.
Added a suggestion to update the hash in the port file.
| actual_hash = hashlib.sha512(data).hexdigest() | ||
| if actual_hash != sha512hash: | ||
| raise RuntimeError('Unexpected hash: ' + actual_hash + '\n' | ||
| 'If you are updating the port, please update the hash in the port module.') |
There was a problem hiding this comment.
how about putting the # To compute the sha512 hash, run curl URL | sha512sum comment in parentheses in this error message? otherwise I'm not sure people will see the source comment above, but they will definitely see this error.
There was a problem hiding this comment.
Alternatively we could just delete that comment since the error message already contains the new computed hash.
Fixes #8568.