[OE-core] [PATCH 3/4] spdx.bbclass: Make use of bb.utils' sha1_file()
Olof Johansson
olof.johansson at axis.com
Mon Jul 16 15:05:55 UTC 2018
The same functionality already exists within bitbake, so avoid
duplicating.
Signed-off-by: Olof Johansson <olofjn at axis.com>
---
meta/classes/spdx.bbclass | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/meta/classes/spdx.bbclass b/meta/classes/spdx.bbclass
index 9e374d70a6c..a3e22afc33d 100644
--- a/meta/classes/spdx.bbclass
+++ b/meta/classes/spdx.bbclass
@@ -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
--
2.11.0
More information about the Openembedded-core
mailing list