diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-09-12 11:37:26 -0400 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-09-12 11:37:26 -0400 |
commit | 35de2a486f773b24184547d04811f52d6441d716 (patch) | |
tree | d8500da905cc04fc1d1ae52a1f348c3be03e7bd9 | |
parent | 852f7040e5fb7da37120a39a244ddaacd03e14b7 (diff) | |
download | buildstream-35de2a486f773b24184547d04811f52d6441d716.tar.gz |
patch.py source plugin: Use utils.sha256sum()
-rw-r--r-- | buildstream/plugins/sources/patch.py | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/buildstream/plugins/sources/patch.py b/buildstream/plugins/sources/patch.py index 895fe8cd4..ab527ec69 100644 --- a/buildstream/plugins/sources/patch.py +++ b/buildstream/plugins/sources/patch.py @@ -39,7 +39,6 @@ """ import os -import hashlib from buildstream import Source, SourceError, Consistency from buildstream import utils @@ -64,7 +63,7 @@ class PatchSource(Source): self.host_patch = utils.get_host_tool("patch") def get_unique_key(self): - return [self.path, _sha256sum(self.fullpath), self.strip_level] + return [self.path, utils.sha256sum(self.fullpath), self.strip_level] def get_consistency(self): return Consistency.CACHED @@ -92,15 +91,6 @@ class PatchSource(Source): fail="Failed to apply patch {}".format(self.path)) -# Get the sha256 sum for the content of a file -def _sha256sum(filename): - h = hashlib.sha256() - with open(filename, "rb") as f: - for chunk in iter(lambda: f.read(4096), b""): - h.update(chunk) - return h.hexdigest() - - # Plugin entry point def setup(): return PatchSource |