summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-12 11:37:26 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2017-09-12 11:37:26 -0400
commit35de2a486f773b24184547d04811f52d6441d716 (patch)
treed8500da905cc04fc1d1ae52a1f348c3be03e7bd9
parent852f7040e5fb7da37120a39a244ddaacd03e14b7 (diff)
downloadbuildstream-35de2a486f773b24184547d04811f52d6441d716.tar.gz
patch.py source plugin: Use utils.sha256sum()
-rw-r--r--buildstream/plugins/sources/patch.py12
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