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.

(From OE-Core rev: b06a44f1081ea422a365e80bc79b2aeb2783d23f)

Signed-off-by: Olof Johansson <olofjn@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Olof Johansson
2018-07-16 17:05:56 +02:00
committed by Richard Purdie
parent 83b3e1463a
commit a24e8944e7

View File

@@ -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):