From: Olof Johansson Date: Mon, 16 Jul 2018 15:05:55 +0000 (+0200) Subject: spdx.bbclass: Make use of bb.utils' sha1_file() X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~17329 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=978f5a8f16bf5942aad73d761df2a00aeb36339d;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git spdx.bbclass: Make use of bb.utils' sha1_file() The same functionality already exists within bitbake, so avoid duplicating. Signed-off-by: Olof Johansson Signed-off-by: Ross Burton --- 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