[oe-commits] [openembedded-core] 05/14: spdx.bbclass: Encode strings before passing to hashlib

git at git.openembedded.org git at git.openembedded.org
Tue Jul 17 08:15:31 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit cc8f9ef1a4941292546190fb1bd0f591996bee7a
Author: Olof Johansson <olof.johansson at axis.com>
AuthorDate: Mon Jul 16 17:05:56 2018 +0200

    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 <olofjn at axis.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/spdx.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/spdx.bbclass b/meta/classes/spdx.bbclass
index a3e22af..fb78e27 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):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list