diff options
-rw-r--r-- | bitbake/lib/bb/utils.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 82579b8a15..7ab8927608 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -534,6 +534,21 @@ def sha256_file(filename): s.update(line) return s.hexdigest() +def sha1_file(filename): + """ + Return the hex string representation of the SHA1 checksum of the filename + """ + try: + import hashlib + except ImportError: + return None + + s = hashlib.sha1() + with open(filename, "rb") as f: + for line in f: + s.update(line) + return s.hexdigest() + def preserved_envvars_exported(): """Variables which are taken from the environment and placed in and exported from the metadata""" |