[rtems-source-builder commit] sb/download: Add support for a base64 hash string

Chris Johns chrisj at rtems.org
Tue Aug 27 12:02:02 UTC 2019


Module:    rtems-source-builder
Branch:    master
Commit:    61ce77bcb5ab480dcee9bce90bf667114b79d115
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=61ce77bcb5ab480dcee9bce90bf667114b79d115

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Aug 15 13:28:04 2019 +1000

sb/download: Add support for a base64 hash string

---

 source-builder/sb/download.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index d8061e6..1fb0155 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -24,6 +24,7 @@
 
 from __future__ import print_function
 
+import base64
 import hashlib
 import os
 import re
@@ -110,8 +111,13 @@ def _hash_check(file_, absfile, macros, remove = True):
             raise
         if _in is not None:
             _in.close()
-        log.output('checksums: %s: %s => %s' % (file_, hasher.hexdigest(), hash[1]))
-        if hasher.hexdigest() != hash[1]:
+        hash_hex = hasher.hexdigest()
+        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_))
             failed = True
         if failed and remove:




More information about the vc mailing list