summaryrefslogtreecommitdiff
path: root/buildstream/_frontend
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-30 22:17:48 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-05-08 03:59:38 +0900
commitc81fb2dabb89a5a443fe5d9bbf8a2c19f45ac276 (patch)
tree2b0678d846a08154f912c503b1b087679a6c870f /buildstream/_frontend
parent541cd76022ca7e9ef8e4114495b908943fe3e8b1 (diff)
downloadbuildstream-c81fb2dabb89a5a443fe5d9bbf8a2c19f45ac276.tar.gz
Moving 'fetch_subprojects' configuration to stream <--> loader
This was previously decided in CLI, but knowledge of what to initialize has been moved to Stream(). Now there is no more point to store this configuration in the Context, we just have the Stream() decide it when asking the Pipeline() to invoke the Loader().
Diffstat (limited to 'buildstream/_frontend')
-rw-r--r--buildstream/_frontend/app.py16
-rw-r--r--buildstream/_frontend/cli.py12
2 files changed, 10 insertions, 18 deletions
diff --git a/buildstream/_frontend/app.py b/buildstream/_frontend/app.py
index 5b0cfc4b1..50787b1ec 100644
--- a/buildstream/_frontend/app.py
+++ b/buildstream/_frontend/app.py
@@ -134,12 +134,8 @@ class App():
# partial initialization is useful for some contexts where we dont
# want to load the pipeline, such as executing workspace commands.
#
- # Args:
- # fetch_subprojects (bool): Whether we should fetch subprojects as a part of the
- # loading process, if they are not yet locally cached
- #
@contextmanager
- def partially_initialized(self, *, fetch_subprojects=False):
+ def partially_initialized(self):
directory = self._main_options['directory']
config = self._main_options['config']
@@ -147,7 +143,7 @@ class App():
# Load the Context
#
try:
- self.context = Context(fetch_subprojects=fetch_subprojects)
+ self.context = Context()
self.context.load(config)
except BstError as e:
self._error_exit(e, "Error loading user configuration")
@@ -241,8 +237,6 @@ class App():
#
# Args:
# session_name (str): The name of the session, or None for no session
- # fetch_subprojects (bool): Whether we should fetch subprojects as a part of the
- # loading process, if they are not yet locally cached
#
# Note that the except_ argument may have a subtly different meaning depending
# on the activity performed on the Pipeline. In normal circumstances the except_
@@ -253,14 +247,12 @@ class App():
# the session header and summary, and time the main session from startup time.
#
@contextmanager
- def initialized(self, *,
- session_name=None,
- fetch_subprojects=False):
+ def initialized(self, *, session_name=None):
self._session_name = session_name
# Start with the early stage init, this enables logging right away
- with self.partially_initialized(fetch_subprojects=fetch_subprojects):
+ with self.partially_initialized():
# Mark the beginning of the session
if session_name:
diff --git a/buildstream/_frontend/cli.py b/buildstream/_frontend/cli.py
index 1ac4548b6..2b5c77f8a 100644
--- a/buildstream/_frontend/cli.py
+++ b/buildstream/_frontend/cli.py
@@ -235,7 +235,7 @@ def build(app, elements, all_, track_, track_save, track_all, track_except, trac
if track_all:
track_ = elements
- with app.initialized(session_name="Build", fetch_subprojects=True):
+ with app.initialized(session_name="Build"):
app.stream.build(elements,
track_targets=track_,
track_except=track_except,
@@ -279,7 +279,7 @@ def fetch(app, elements, deps, track_, except_, track_cross_junctions):
click.echo("ERROR: The --track-cross-junctions option can only be used with --track", err=True)
sys.exit(-1)
- with app.initialized(session_name="Fetch", fetch_subprojects=True):
+ with app.initialized(session_name="Fetch"):
app.stream.fetch(elements,
selection=deps,
except_targets=except_,
@@ -315,7 +315,7 @@ def track(app, elements, deps, except_, cross_junctions):
none: No dependencies, just the specified elements
all: All dependencies of all specified elements
"""
- with app.initialized(session_name="Track", fetch_subprojects=True):
+ with app.initialized(session_name="Track"):
app.stream.track(elements,
selection=deps,
except_targets=except_,
@@ -347,7 +347,7 @@ def pull(app, elements, deps, remote):
none: No dependencies, just the element itself
all: All dependencies
"""
- with app.initialized(session_name="Pull", fetch_subprojects=True):
+ with app.initialized(session_name="Pull"):
app.stream.pull(elements, selection=deps, remote=remote)
@@ -375,7 +375,7 @@ def push(app, elements, deps, remote):
none: No dependencies, just the element itself
all: All dependencies
"""
- with app.initialized(session_name="Push", fetch_subprojects=True):
+ with app.initialized(session_name="Push"):
app.stream.push(elements, selection=deps, remote=remote)
@@ -716,7 +716,7 @@ def source_bundle(app, element, force, directory,
track_, compression, except_):
"""Produce a source bundle to be manually executed
"""
- with app.initialized(fetch_subprojects=True):
+ with app.initialized():
app.stream.source_bundle(element, directory,
track_first=track_,
force=force,