diff options
author | Darius Makovsky <traveltissues@protonmail.com> | 2019-10-23 18:47:40 +0100 |
---|---|---|
committer | Darius Makovsky <traveltissues@protonmail.com> | 2019-10-30 12:46:16 +0000 |
commit | 253ef13e9147980456d85e9b994f2a6e330679e9 (patch) | |
tree | e16d9691b7f2d248d6172eb81a7b55ec618e9cb5 /src/buildstream/plugins | |
parent | b447e9f59537def81b24ab2e0e91e827d6f194bb (diff) | |
download | buildstream-253ef13e9147980456d85e9b994f2a6e330679e9.tar.gz |
local.py: use extended API, set BST_NO_PRESTAGE_KEY
tests:
* local sources are cached
* use git sources instead of local when removing objects
* update expected cache keys
Diffstat (limited to 'src/buildstream/plugins')
-rw-r--r-- | src/buildstream/plugins/sources/local.py | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/buildstream/plugins/sources/local.py b/src/buildstream/plugins/sources/local.py index e28098c38..98f74c16c 100644 --- a/src/buildstream/plugins/sources/local.py +++ b/src/buildstream/plugins/sources/local.py @@ -46,6 +46,7 @@ class LocalSource(Source): # pylint: disable=attribute-defined-outside-init BST_STAGE_VIRTUAL_DIRECTORY = True + BST_NO_PRESTAGE_KEY = True def __init__(self, context, project, meta): super().__init__(context, project, meta) @@ -61,20 +62,6 @@ class LocalSource(Source): def preflight(self): pass - def get_unique_key(self): - if self.__unique_key is None: - # Get a list of tuples of the the project relative paths and fullpaths - if os.path.isdir(self.fullpath): - filelist = utils.list_relative_paths(self.fullpath) - filelist = [(relpath, os.path.join(self.fullpath, relpath)) for relpath in filelist] - else: - filelist = [(self.path, self.fullpath)] - - # Return a list of (relative filename, sha256 digest) tuples, a sorted list - # has already been returned by list_relative_paths() - self.__unique_key = [(relpath, unique_key(fullpath)) for relpath, fullpath in filelist] - return self.__unique_key - def get_consistency(self): return Consistency.CACHED @@ -110,20 +97,6 @@ class LocalSource(Source): return self.fullpath -# Create a unique key for a file -def unique_key(filename): - - # Return some hard coded things for files which - # have no content to calculate a key for - if os.path.islink(filename): - # For a symbolic link, use the link target as its unique identifier - return os.readlink(filename) - elif os.path.isdir(filename): - return "0" - - return utils.sha256sum(filename) - - # Plugin entry point def setup(): return LocalSource |