summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarius Makovsky <traveltissues@protonmail.com>2019-11-01 11:19:13 +0000
committerDarius Makovsky <traveltissues@protonmail.com>2019-11-04 12:53:43 +0000
commitcf2439db276e233fa3b69e22110d0fe1f04e048d (patch)
treeffd6febfb68848cd9f68f83419fc78163fea1a8f
parent1993ff0d96c51ee6aa1d4a601ad976b20f175a46 (diff)
downloadbuildstream-cf2439db276e233fa3b69e22110d0fe1f04e048d.tar.gz
Replace BST_NO_PRESTAGE_KEY with BST_KEY_REQUIRES_STAGE
Correct version number for BST_KEY_REQUIRES_STAGE
-rw-r--r--src/buildstream/plugins/sources/local.py2
-rw-r--r--src/buildstream/plugins/sources/workspace.py2
-rw-r--r--src/buildstream/source.py17
-rw-r--r--tests/sourcecache/staging.py2
4 files changed, 11 insertions, 12 deletions
diff --git a/src/buildstream/plugins/sources/local.py b/src/buildstream/plugins/sources/local.py
index 98f74c16c..6114c60c9 100644
--- a/src/buildstream/plugins/sources/local.py
+++ b/src/buildstream/plugins/sources/local.py
@@ -46,7 +46,7 @@ class LocalSource(Source):
# pylint: disable=attribute-defined-outside-init
BST_STAGE_VIRTUAL_DIRECTORY = True
- BST_NO_PRESTAGE_KEY = True
+ BST_KEY_REQUIRES_STAGE = True
def __init__(self, context, project, meta):
super().__init__(context, project, meta)
diff --git a/src/buildstream/plugins/sources/workspace.py b/src/buildstream/plugins/sources/workspace.py
index 303b67938..1088f07f6 100644
--- a/src/buildstream/plugins/sources/workspace.py
+++ b/src/buildstream/plugins/sources/workspace.py
@@ -48,7 +48,7 @@ class WorkspaceSource(Source):
# pylint: disable=attribute-defined-outside-init
BST_STAGE_VIRTUAL_DIRECTORY = True
- BST_NO_PRESTAGE_KEY = True
+ BST_KEY_REQUIRES_STAGE = True
def __init__(self, context, project, meta) -> None:
super().__init__(context, project, meta)
diff --git a/src/buildstream/source.py b/src/buildstream/source.py
index 132856a6b..0312517c9 100644
--- a/src/buildstream/source.py
+++ b/src/buildstream/source.py
@@ -324,12 +324,11 @@ class Source(Plugin):
*Since: 1.4*
"""
- BST_NO_PRESTAGE_KEY = False
- """Whether the source will never have a key prior to staging (a pre-stage
- key). This is true in the case that the source requires staging in order to
- efficiently generate a unique key.
+ BST_KEY_REQUIRES_STAGE = False
+ """Whether the source will require staging in order to efficiently generate
+ a unique key.
- *Since: 1.91.1*
+ *Since: 1.91.2*
"""
def __init__(self,
@@ -788,7 +787,7 @@ class Source(Plugin):
def _stage(self, directory):
directory = self.__ensure_directory(directory)
- if self.BST_NO_PRESTAGE_KEY:
+ if self.BST_KEY_REQUIRES_STAGE:
# _get_unique_key should be called before _stage
assert self.__digest is not None
cas_dir = CasBasedDirectory(self._get_context().get_cascache(),
@@ -813,7 +812,7 @@ class Source(Plugin):
def _get_unique_key(self):
key = {}
key['directory'] = self.__directory
- if self.BST_NO_PRESTAGE_KEY:
+ if self.BST_KEY_REQUIRES_STAGE:
key['unique'] = self._stage_into_cas()
else:
key['unique'] = self.get_unique_key() # pylint: disable=assignment-from-no-return
@@ -1061,7 +1060,7 @@ class Source(Plugin):
# previous_sources (list): List of Sources listed prior to this source
#
def _track(self, previous_sources: List['Source']) -> SourceRef:
- if self.BST_NO_PRESTAGE_KEY:
+ if self.BST_KEY_REQUIRES_STAGE:
# ensure that these sources have a key after tracking
self._get_unique_key()
return None
@@ -1120,7 +1119,7 @@ class Source(Plugin):
self.__key = generate_key(keys)
sourcecache = self._get_context().sourcecache
- if self.BST_NO_PRESTAGE_KEY and not sourcecache.contains(self):
+ if self.BST_KEY_REQUIRES_STAGE and not sourcecache.contains(self):
sourcecache.commit(self, [])
@property
diff --git a/tests/sourcecache/staging.py b/tests/sourcecache/staging.py
index d7254b1ae..b0cc03119 100644
--- a/tests/sourcecache/staging.py
+++ b/tests/sourcecache/staging.py
@@ -138,7 +138,7 @@ def test_staged_source_build(tmpdir, datafiles, cli):
element = project.load_elements(["import-dev.bst"])[0]
# check consistency of the source
- # local sources set BST_NO_PRESTAGE_KEY so this is cached
+ # local sources set BST_KEY_REQUIRES_STAGE so this is cached
assert element._source_cached()
res = cli.run(project=project_dir, args=['build', 'target.bst'])