summaryrefslogtreecommitdiff
path: root/src/buildstream/_loader
diff options
context:
space:
mode:
authorBenjamin Schubert <bschubert15@bloomberg.net>2019-11-26 18:40:23 +0000
committerBenjamin Schubert <contact@benschubert.me>2020-01-16 14:36:35 +0000
commit93ebe4992c32b2588ae213a98c3e05d60c974a00 (patch)
tree0805dadc7f75ee208c46b08bada7b4ba13752acb /src/buildstream/_loader
parentc48e89d5da3a7b2b2e72d536aaea9ec182d1e1fd (diff)
downloadbuildstream-93ebe4992c32b2588ae213a98c3e05d60c974a00.tar.gz
element.py: Remove _get_consistency and introduce explicit methods
This replaces the _get_consistency method by two methods: `_has_all_sources_resolved` and `_has_all_sources_cached` which allows a more fine grained control on what information is needed.
Diffstat (limited to 'src/buildstream/_loader')
-rw-r--r--src/buildstream/_loader/loader.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/buildstream/_loader/loader.py b/src/buildstream/_loader/loader.py
index 05c139bb2..531655c09 100644
--- a/src/buildstream/_loader/loader.py
+++ b/src/buildstream/_loader/loader.py
@@ -20,7 +20,6 @@
import os
from .._exceptions import LoadError, LoadErrorReason
-from .. import Consistency
from .. import _yaml
from ..element import Element
from ..node import Node
@@ -651,16 +650,9 @@ class Loader:
self._loaders[filename] = loader
return loader
- # Handle the case where a subproject needs to be fetched
- #
- if element._get_consistency() >= Consistency.RESOLVED and not element._has_all_sources_in_source_cache():
- if ticker:
- ticker(filename, "Fetching subproject")
- self._fetch_subprojects([element])
-
# Handle the case where a subproject has no ref
#
- elif element._get_consistency() == Consistency.INCONSISTENT:
+ if not element._has_all_sources_resolved():
detail = "Try tracking the junction element with `bst source track {}`".format(filename)
raise LoadError(
"{}Subproject has no ref for junction: {}".format(provenance_str, filename),
@@ -668,6 +660,13 @@ class Loader:
detail=detail,
)
+ # Handle the case where a subproject needs to be fetched
+ #
+ if not element._has_all_sources_in_source_cache():
+ if ticker:
+ ticker(filename, "Fetching subproject")
+ self._fetch_subprojects([element])
+
sources = list(element.sources())
if len(sources) == 1 and sources[0]._get_local_path():
# Optimization for junctions with a single local source