From: Olof Johansson Date: Mon, 16 Jul 2018 15:05:56 +0000 (+0200) Subject: spdx.bbclass: Encode strings before passing to hashlib X-Git-Tag: yocto-4.0~12872 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b06a44f1081ea422a365e80bc79b2aeb2783d23f;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git spdx.bbclass: Encode strings before passing to hashlib In python3, passing a unicode object to hashlib will result in an exception that encourages you to encode it first. Signed-off-by: Olof Johansson Signed-off-by: Ross Burton --- diff --git a/meta/classes/spdx.bbclass b/meta/classes/spdx.bbclass index a3e22afc33d..fb78e274a8e 100644 --- a/meta/classes/spdx.bbclass +++ b/meta/classes/spdx.bbclass @@ -208,7 +208,7 @@ def hash_file(file_name): def hash_string(data): import hashlib sha1 = hashlib.sha1() - sha1.update(data) + sha1.update(data.encode('utf-8')) return sha1.hexdigest() def run_fossology(foss_command, full_spdx):