mirror of
https://git.rtems.org/rtems-source-builder
synced 2024-10-09 07:15:10 +08:00
sb/download: Add support for a base64 hash string
This commit is contained in:
parent
d7f11a79bc
commit
61ce77bcb5
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@ -110,8 +111,13 @@ def _hash_check(file_, absfile, macros, remove = True):
|
|||||||
raise
|
raise
|
||||||
if _in is not None:
|
if _in is not None:
|
||||||
_in.close()
|
_in.close()
|
||||||
log.output('checksums: %s: %s => %s' % (file_, hasher.hexdigest(), hash[1]))
|
hash_hex = hasher.hexdigest()
|
||||||
if hasher.hexdigest() != hash[1]:
|
hash_base64 = base64.b64encode(hasher.digest()).decode('utf-8')
|
||||||
|
log.output('checksums: %s: (hex: %s) (b64: %s) => %s' % (file_,
|
||||||
|
hash_hex,
|
||||||
|
hash_base64,
|
||||||
|
hash[1]))
|
||||||
|
if hash_hex != hash[1] and hash_base64 != hash[1]:
|
||||||
log.warning('checksum error: %s' % (file_))
|
log.warning('checksum error: %s' % (file_))
|
||||||
failed = True
|
failed = True
|
||||||
if failed and remove:
|
if failed and remove:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user