Valentin David pushed to branch valentindavid/ruamel-version at BuildStream / buildstream
Commits:
-
353a6cc2
by Valentin David at 2018-08-13T09:29:40Z
-
5a667107
by Tristan Van Berkom at 2018-08-13T10:58:12Z
-
6e759d8a
by Valentin David at 2018-08-13T12:39:23Z
3 changed files:
Changes:
... | ... | @@ -267,8 +267,11 @@ class Stream(): |
267 | 267 |
except_targets=None,
|
268 | 268 |
cross_junctions=False):
|
269 | 269 |
|
270 |
+ # We pass no target to build. Only to track. Passing build targets
|
|
271 |
+ # would fully load project configuration which might not be
|
|
272 |
+ # possible before tracking is done.
|
|
270 | 273 |
_, elements = \
|
271 |
- self._load(targets, targets,
|
|
274 |
+ self._load([], targets,
|
|
272 | 275 |
selection=selection, track_selection=selection,
|
273 | 276 |
except_targets=except_targets,
|
274 | 277 |
track_except_targets=except_targets,
|
... | ... | @@ -824,6 +827,12 @@ class Stream(): |
824 | 827 |
#
|
825 | 828 |
# A convenience method for loading element lists
|
826 | 829 |
#
|
830 |
+ # If `targets` is not empty used project configuration will be
|
|
831 |
+ # fully loaded. If `targets` is empty, tracking will still be
|
|
832 |
+ # resolved for elements in `track_targets`, but no build pipeline
|
|
833 |
+ # will be resolved. This is behavior is import for track() to
|
|
834 |
+ # not trigger full loading of project configuration.
|
|
835 |
+ #
|
|
827 | 836 |
# Args:
|
828 | 837 |
# targets (list of str): Main targets to load
|
829 | 838 |
# track_targets (list of str): Tracking targets
|
... | ... | @@ -871,7 +880,7 @@ class Stream(): |
871 | 880 |
#
|
872 | 881 |
# This can happen with `bst build --track`
|
873 | 882 |
#
|
874 |
- if not self._pipeline.targets_include(elements, track_elements):
|
|
883 |
+ if targets and not self._pipeline.targets_include(elements, track_elements):
|
|
875 | 884 |
raise StreamError("Specified tracking targets that are not "
|
876 | 885 |
"within the scope of primary targets")
|
877 | 886 |
|
... | ... | @@ -907,6 +916,10 @@ class Stream(): |
907 | 916 |
for element in track_selected:
|
908 | 917 |
element._schedule_tracking()
|
909 | 918 |
|
919 |
+ if not targets:
|
|
920 |
+ self._pipeline.resolve_elements(track_selected)
|
|
921 |
+ return [], track_selected
|
|
922 |
+ |
|
910 | 923 |
# ArtifactCache.setup_remotes expects all projects to be fully loaded
|
911 | 924 |
for project in self._context.get_projects():
|
912 | 925 |
project.ensure_fully_loaded()
|
... | ... | @@ -258,7 +258,7 @@ setup(name='BuildStream', |
258 | 258 |
install_requires=[
|
259 | 259 |
'setuptools',
|
260 | 260 |
'psutil',
|
261 |
- 'ruamel.yaml <= 0.15',
|
|
261 |
+ 'ruamel.yaml < 0.15.52',
|
|
262 | 262 |
'pluginbase',
|
263 | 263 |
'Click',
|
264 | 264 |
'blessings',
|
... | ... | @@ -612,3 +612,25 @@ def test_track_include_junction(cli, tmpdir, datafiles, ref_storage, kind): |
612 | 612 |
# Assert that we are now buildable because the source is
|
613 | 613 |
# now cached.
|
614 | 614 |
assert cli.get_element_state(project, element_name) == 'buildable'
|
615 |
+ |
|
616 |
+ |
|
617 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
618 |
+@pytest.mark.parametrize("ref_storage", [('inline'), ('project.refs')])
|
|
619 |
+@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
|
|
620 |
+def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
|
|
621 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
622 |
+ element_path = os.path.join(project, 'elements')
|
|
623 |
+ subproject_path = os.path.join(project, 'files', 'sub-project')
|
|
624 |
+ sub_element_path = os.path.join(subproject_path, 'elements')
|
|
625 |
+ junction_path = os.path.join(element_path, 'junction.bst')
|
|
626 |
+ |
|
627 |
+ configure_project(project, {
|
|
628 |
+ 'ref-storage': ref_storage,
|
|
629 |
+ '(@)': ['junction.bst:test.yml']
|
|
630 |
+ })
|
|
631 |
+ |
|
632 |
+ generate_junction(str(tmpdir.join('junction_repo')),
|
|
633 |
+ subproject_path, junction_path, store_ref=False)
|
|
634 |
+ |
|
635 |
+ result = cli.run(project=project, args=['track', 'junction.bst'])
|
|
636 |
+ result.assert_success()
|