diff options
author | Chandan Singh <chandan@chandansingh.net> | 2020-04-28 20:16:11 +0000 |
---|---|---|
committer | Chandan Singh <chandan@chandansingh.net> | 2020-04-30 19:57:32 +0000 |
commit | 1f74bd72280b0e6712355625134af2758ec09717 (patch) | |
tree | 0b2c31642f7be11836dde20ee9aa734594cd6e01 /src/buildstream | |
parent | 350fa7da3c103695423f9f99bc2ad46c01a0ca54 (diff) | |
download | buildstream-1f74bd72280b0e6712355625134af2758ec09717.tar.gz |
_stream.py: Fetch sources while launching build shellschandan/build-shell-fetch
Part of https://gitlab.com/BuildStream/buildstream/-/issues/1068.
Make behavior of `shell` command similar to other commands that need
sources like `build`, `workspace open`, `source checkout` etc.
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/_stream.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/buildstream/_stream.py b/src/buildstream/_stream.py index 09e6dfb17..48390ba14 100644 --- a/src/buildstream/_stream.py +++ b/src/buildstream/_stream.py @@ -205,13 +205,6 @@ class Stream: if unique_id and element is None: element = Plugin._lookup(unique_id) - # Assert we have everything we need built, using the element - # definitions to control the execution environment only. - if scope == Scope.BUILD and not element._has_all_sources_in_source_cache(): - 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()] if missing_deps: if not pull_dependencies: @@ -251,6 +244,11 @@ class Stream: else: buildtree = True + # Ensure we have our sources if we are launching a build shell + if scope == Scope.BUILD and not buildtree: + self._fetch([element]) + self._pipeline.assert_sources_cached([element]) + return element._shell( scope, mounts=mounts, isolate=isolate, prompt=prompt, command=command, usebuildtree=buildtree ) |