summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@kernel.crashing.org>2022-10-06 16:53:22 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-10-26 23:02:10 +0100
commitec08faf2e4595f6ed3cc5a222075f12f5314a410 (patch)
tree5472faa0c585a8dc3ae196535790ab363de8a67d /bitbake/lib/bb/utils.py
parent7aa3ed5c37f3d47c3e794c58dc190c5110086151 (diff)
downloadpoky-ec08faf2e4595f6ed3cc5a222075f12f5314a410.tar.gz
bitbake: utils/ply: Update md5 to better report errors with hashlib
In the case where hashlib is not available, the try would fail and fall through resulting in a backtrace on the usage of the 'sig'. The backtrace itself was confusing and made it difficult to determine what went wrong. Update the import to be in it's own try block with an appropriate message to indicate what went wrong. Note, the current version of ply all of this code has been restructured so this is not applicable upstream. Additionally, some versions of hashlib don't appear to implement the second FIPS related argument. Detect this and support both versions. (Bitbake rev: 484ab42f440070c0369b81f5c69da860fa47a798) Signed-off-by: Mark Hatle <mark.hatle@amd.com> Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index e6e21e20fe..64a004d0d8 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -547,7 +547,12 @@ def md5_file(filename):
547 Return the hex string representation of the MD5 checksum of filename. 547 Return the hex string representation of the MD5 checksum of filename.
548 """ 548 """
549 import hashlib 549 import hashlib
550 return _hasher(hashlib.new('MD5', usedforsecurity=False), filename) 550 try:
551 sig = hashlib.new('MD5', usedforsecurity=False)
552 except TypeError:
553 # Some configurations don't appear to support two arguments
554 sig = hashlib.new('MD5')
555 return _hasher(sig, filename)
551 556
552def sha256_file(filename): 557def sha256_file(filename):
553 """ 558 """