]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
spdx.bbclass: Make use of bb.utils' sha1_file()
authorOlof Johansson <olof.johansson@axis.com>
Mon, 16 Jul 2018 15:05:55 +0000 (17:05 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 18 Jul 2018 09:13:30 +0000 (10:13 +0100)
The same functionality already exists within bitbake, so avoid
duplicating.

Signed-off-by: Olof Johansson <olofjn@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/spdx.bbclass

index 9e374d70a6cdd3f6ade874c31d6f915b5f96ac40..a3e22afc33d87435aa430a6a54072b1887317e42 100644 (file)
@@ -202,13 +202,8 @@ def list_files(dir):
     return
 
 def hash_file(file_name):
-    try:
-        with open(file_name, 'rb') as f:
-            data_string = f.read()
-            sha1 = hash_string(data_string)
-            return sha1
-    except:
-        return None
+    from bb.utils import sha1_file
+    return sha1_file(file_name)
 
 def hash_string(data):
     import hashlib