diff options
-rw-r--r-- | src/buildstream/_stream.py | 6 | ||||
-rw-r--r-- | src/buildstream/source.py | 4 | ||||
-rw-r--r-- | tests/integration/shell.py | 4 | ||||
-rw-r--r-- | tests/sourcecache/staging.py | 3 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index c71bec80a..4824c7d81 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -188,6 +188,12 @@ class Stream(): # in which case we just blindly trust the directory, using the element # definitions to control the execution environment only. if directory is None: + + if not element._source_cached(): + raise StreamError( + "Sources for element {} are not cached." + "Element must be fetched.".format(element._get_full_name())) + missing_deps = [ dep for dep in self._pipeline.dependencies([element], scope) if not dep._cached() diff --git a/src/buildstream/source.py b/src/buildstream/source.py index 0312517c9..5321363a4 100644 --- a/src/buildstream/source.py +++ b/src/buildstream/source.py @@ -1118,10 +1118,6 @@ class Source(Plugin): self.__key = generate_key(keys) - sourcecache = self._get_context().sourcecache - if self.BST_KEY_REQUIRES_STAGE and not sourcecache.contains(self): - sourcecache.commit(self, []) - @property def _key(self): return self.__key diff --git a/tests/integration/shell.py b/tests/integration/shell.py index a44f51609..49e9a5950 100644 --- a/tests/integration/shell.py +++ b/tests/integration/shell.py @@ -320,6 +320,10 @@ def test_workspace_visible(cli, datafiles): # that we got the same content here # result = cli.run(project=project, args=[ + 'source', 'fetch', element_name]) + assert result.exit_code == 0 + + result = cli.run(project=project, args=[ 'shell', '--build', element_name, '--', 'cat', 'hello.c' ]) assert result.exit_code == 0 diff --git a/tests/sourcecache/staging.py b/tests/sourcecache/staging.py index b0cc03119..186a4bd9f 100644 --- a/tests/sourcecache/staging.py +++ b/tests/sourcecache/staging.py @@ -138,8 +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_KEY_REQUIRES_STAGE so this is cached - assert element._source_cached() + assert not element._source_cached() res = cli.run(project=project_dir, args=['build', 'target.bst']) res.assert_success() |