Abderrahim Kitouni pushed to branch abderrahim/artifact-cache-junction at BuildStream / buildstream
Commits:
-
5df4105a
by Angelos Evripiotis at 2019-01-28T10:13:40Z
-
9c981eff
by Angelos Evripiotis at 2019-01-28T10:17:57Z
-
bef80291
by Angelos Evripiotis at 2019-01-28T10:19:17Z
-
564cb245
by Angelos Evripiotis at 2019-01-28T11:36:16Z
-
9d9f6e76
by Abderrahim Kitouni at 2019-01-28T13:38:26Z
-
459598bb
by Abderrahim Kitouni at 2019-01-28T13:38:26Z
15 changed files:
- NEWS
- buildstream/_artifactcache.py
- buildstream/_gitsourcebase.py
- buildstream/_loader/loader.py
- buildstream/_pipeline.py
- buildstream/_project.py
- buildstream/plugins/elements/junction.py
- buildstream/plugins/sources/bzr.py
- buildstream/plugins/sources/deb.py
- buildstream/plugins/sources/git.py
- buildstream/plugins/sources/remote.py
- buildstream/plugins/sources/tar.py
- buildstream/plugins/sources/zip.py
- doc/source/format_project_refs.rst
- tests/frontend/completions.py
Changes:
... | ... | @@ -20,7 +20,7 @@ buildstream 1.3.1 |
20 | 20 |
an element's sources and generated build scripts you can do the command
|
21 | 21 |
`bst source-checkout --include-build-scripts --tar foo.bst some-file.tar`
|
22 | 22 |
|
23 |
- o BREAKING CHANGE: `bst track` and `bst fetch` commands are now osbolete.
|
|
23 |
+ o BREAKING CHANGE: `bst track` and `bst fetch` commands are now obsolete.
|
|
24 | 24 |
Their functionality is provided by `bst source track` and
|
25 | 25 |
`bst source fetch` respectively.
|
26 | 26 |
|
... | ... | @@ -467,7 +467,7 @@ class ArtifactCache(): |
467 | 467 |
# on_failure (callable): Called if we fail to contact one of the caches.
|
468 | 468 |
#
|
469 | 469 |
def initialize_remotes(self, *, on_failure=None):
|
470 |
- remote_specs = self.global_remote_specs
|
|
470 |
+ remote_specs = list(self.global_remote_specs)
|
|
471 | 471 |
|
472 | 472 |
for project in self.project_remote_specs:
|
473 | 473 |
remote_specs += self.project_remote_specs[project]
|
... | ... | @@ -1046,8 +1046,5 @@ class ArtifactCache(): |
1046 | 1046 |
# A list of ArtifactCacheSpec instances describing the remote artifact caches.
|
1047 | 1047 |
#
|
1048 | 1048 |
def _configured_remote_artifact_cache_specs(context, project):
|
1049 |
- project_overrides = context.get_overrides(project.name)
|
|
1050 |
- project_extra_specs = ArtifactCache.specs_from_config_node(project_overrides)
|
|
1051 |
- |
|
1052 | 1049 |
return list(utils._deduplicate(
|
1053 |
- project_extra_specs + project.artifact_cache_specs + context.artifact_cache_specs))
|
|
1050 |
+ project.artifact_cache_specs + context.artifact_cache_specs))
|
... | ... | @@ -605,7 +605,7 @@ class _GitSourceBase(Source): |
605 | 605 |
detail = "The ref provided for the element does not exist locally " + \
|
606 | 606 |
"in the provided track branch / tag '{}'.\n".format(self.tracking) + \
|
607 | 607 |
"You may wish to track the element to update the ref from '{}' ".format(self.tracking) + \
|
608 |
- "with `bst track`,\n" + \
|
|
608 |
+ "with `bst source track`,\n" + \
|
|
609 | 609 |
"or examine the upstream at '{}' for the specific ref.".format(self.mirror.url)
|
610 | 610 |
|
611 | 611 |
self.warn("{}: expected ref '{}' was not found in given track '{}' for staged repository: '{}'\n"
|
... | ... | @@ -557,7 +557,7 @@ class Loader(): |
557 | 557 |
ticker(filename, 'Fetching subproject from {} source'.format(source.get_kind()))
|
558 | 558 |
source._fetch(sources[0:idx])
|
559 | 559 |
else:
|
560 |
- detail = "Try fetching the project with `bst fetch {}`".format(filename)
|
|
560 |
+ detail = "Try fetching the project with `bst source fetch {}`".format(filename)
|
|
561 | 561 |
raise LoadError(LoadErrorReason.SUBPROJECT_FETCH_NEEDED,
|
562 | 562 |
"Subproject fetch needed for junction: {}".format(filename),
|
563 | 563 |
detail=detail)
|
... | ... | @@ -565,7 +565,7 @@ class Loader(): |
565 | 565 |
# Handle the case where a subproject has no ref
|
566 | 566 |
#
|
567 | 567 |
elif source.get_consistency() == Consistency.INCONSISTENT:
|
568 |
- detail = "Try tracking the junction element with `bst track {}`".format(filename)
|
|
568 |
+ detail = "Try tracking the junction element with `bst source track {}`".format(filename)
|
|
569 | 569 |
raise LoadError(LoadErrorReason.SUBPROJECT_INCONSISTENT,
|
570 | 570 |
"Subproject has no ref for junction: {}".format(filename),
|
571 | 571 |
detail=detail)
|
... | ... | @@ -373,7 +373,7 @@ class Pipeline(): |
373 | 373 |
if source._get_consistency() == Consistency.INCONSISTENT:
|
374 | 374 |
detail += " {} is missing ref\n".format(source)
|
375 | 375 |
detail += '\n'
|
376 |
- detail += "Try tracking these elements first with `bst track`\n"
|
|
376 |
+ detail += "Try tracking these elements first with `bst source track`\n"
|
|
377 | 377 |
|
378 | 378 |
raise PipelineError("Inconsistent pipeline", detail=detail, reason="inconsistent-pipeline")
|
379 | 379 |
|
... | ... | @@ -406,7 +406,7 @@ class Pipeline(): |
406 | 406 |
if source._get_consistency() != Consistency.CACHED:
|
407 | 407 |
detail += " {}\n".format(source)
|
408 | 408 |
detail += '\n'
|
409 |
- detail += "Try fetching these elements first with `bst fetch`,\n" + \
|
|
409 |
+ detail += "Try fetching these elements first with `bst source fetch`,\n" + \
|
|
410 | 410 |
"or run this command with `--fetch` option\n"
|
411 | 411 |
|
412 | 412 |
raise PipelineError("Uncached sources", detail=detail, reason="uncached-sources")
|
... | ... | @@ -549,7 +549,15 @@ class Project(): |
549 | 549 |
#
|
550 | 550 |
|
551 | 551 |
# Load artifacts pull/push configuration for this project
|
552 |
- self.artifact_cache_specs = ArtifactCache.specs_from_config_node(config, self.directory)
|
|
552 |
+ project_specs = ArtifactCache.specs_from_config_node(config, self.directory)
|
|
553 |
+ override_specs = ArtifactCache.specs_from_config_node(
|
|
554 |
+ self._context.get_overrides(self.name), self.directory)
|
|
555 |
+ |
|
556 |
+ self.artifact_cache_specs = override_specs + project_specs
|
|
557 |
+ |
|
558 |
+ if self.junction:
|
|
559 |
+ parent = self.junction._get_project()
|
|
560 |
+ self.artifact_cache_specs = parent.artifact_cache_specs + self.artifact_cache_specs
|
|
553 | 561 |
|
554 | 562 |
# Load remote-execution configuration for this project
|
555 | 563 |
project_specs = SandboxRemote.specs_from_config_node(config, self.directory)
|
... | ... | @@ -79,7 +79,7 @@ depend on a junction element itself. |
79 | 79 |
|
80 | 80 |
Therefore, if you require the most up-to-date version of a subproject,
|
81 | 81 |
you must explicitly track the junction element by invoking:
|
82 |
- `bst track JUNCTION_ELEMENT`.
|
|
82 |
+ `bst source track JUNCTION_ELEMENT`.
|
|
83 | 83 |
|
84 | 84 |
Furthermore, elements within the subproject are also not tracked by default.
|
85 | 85 |
For this, we must specify the `--track-cross-junctions` option. This option
|
... | ... | @@ -93,7 +93,7 @@ cached yet. However, they can be fetched explicitly: |
93 | 93 |
|
94 | 94 |
.. code::
|
95 | 95 |
|
96 |
- bst fetch junction.bst
|
|
96 |
+ bst source fetch junction.bst
|
|
97 | 97 |
|
98 | 98 |
Other commands such as ``bst build`` implicitly fetch junction sources.
|
99 | 99 |
|
... | ... | @@ -146,7 +146,7 @@ class JunctionElement(Element): |
146 | 146 |
|
147 | 147 |
def get_unique_key(self):
|
148 | 148 |
# Junctions do not produce artifacts. get_unique_key() implementation
|
149 |
- # is still required for `bst fetch`.
|
|
149 |
+ # is still required for `bst source fetch`.
|
|
150 | 150 |
return 1
|
151 | 151 |
|
152 | 152 |
def configure_sandbox(self, sandbox):
|
... | ... | @@ -46,7 +46,7 @@ bzr - stage files from a bazaar repository |
46 | 46 |
# but revisions on a branch are of the form
|
47 | 47 |
# <revision-branched-from>.<branch-number>.<revision-since-branching>
|
48 | 48 |
# e.g. 6622.1.6.
|
49 |
- # The ref must be specified to build, and 'bst track' will update the
|
|
49 |
+ # The ref must be specified to build, and 'bst source track' will update the
|
|
50 | 50 |
# revision number to the one on the tip of the branch specified in 'track'.
|
51 | 51 |
ref: 6622
|
52 | 52 |
|
... | ... | @@ -34,7 +34,7 @@ deb - stage files from .deb packages |
34 | 34 |
kind: deb
|
35 | 35 |
|
36 | 36 |
# Specify the deb url. Using an alias defined in your project
|
37 |
- # configuration is encouraged. 'bst track' will update the
|
|
37 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
38 | 38 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
39 | 39 |
url: upstream:foo.deb
|
40 | 40 |
|
... | ... | @@ -112,7 +112,7 @@ git - stage files from a git repository |
112 | 112 |
# o Enable `track-tags` feature
|
113 | 113 |
# o Set the `track` parameter to the desired commit sha which
|
114 | 114 |
# the current `ref` points to
|
115 |
- # o Run `bst track` for these elements, this will result in
|
|
115 |
+ # o Run `bst source track` for these elements, this will result in
|
|
116 | 116 |
# populating the `tags` portion of the refs without changing
|
117 | 117 |
# the refs
|
118 | 118 |
# o Restore the `track` parameter to the branches which you have
|
... | ... | @@ -37,7 +37,7 @@ remote - stage files from remote urls |
37 | 37 |
# executable: true
|
38 | 38 |
|
39 | 39 |
# Specify the url. Using an alias defined in your project
|
40 |
- # configuration is encouraged. 'bst track' will update the
|
|
40 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
41 | 41 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
42 | 42 |
url: upstream:foo
|
43 | 43 |
|
... | ... | @@ -33,7 +33,7 @@ tar - stage files from tar archives |
33 | 33 |
kind: tar
|
34 | 34 |
|
35 | 35 |
# Specify the tar url. Using an alias defined in your project
|
36 |
- # configuration is encouraged. 'bst track' will update the
|
|
36 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
37 | 37 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
38 | 38 |
url: upstream:foo.tar
|
39 | 39 |
|
... | ... | @@ -29,7 +29,7 @@ zip - stage files from zip archives |
29 | 29 |
kind: zip
|
30 | 30 |
|
31 | 31 |
# Specify the zip url. Using an alias defined in your project
|
32 |
- # configuration is encouraged. 'bst track' will update the
|
|
32 |
+ # configuration is encouraged. 'bst source track' will update the
|
|
33 | 33 |
# sha256sum in 'ref' to the downloaded file's sha256sum.
|
34 | 34 |
url: upstream:foo.zip
|
35 | 35 |
|
... | ... | @@ -21,9 +21,9 @@ When a ``project.refs`` file is in use, any source references found |
21 | 21 |
in the :ref:`inline source declarations <format_sources>` are considered
|
22 | 22 |
invalid and will be ignored, and a warning will be emitted for them.
|
23 | 23 |
|
24 |
-When ``bst track`` is run for your project, the ``project.refs`` file
|
|
24 |
+When ``bst source track`` is run for your project, the ``project.refs`` file
|
|
25 | 25 |
will be updated instead of the inline source declarations. In the absence
|
26 |
-of a ``project.refs`` file, ``bst track`` will create one automatically
|
|
26 |
+of a ``project.refs`` file, ``bst source track`` will create one automatically
|
|
27 | 27 |
with the tracking results.
|
28 | 28 |
|
29 | 29 |
An interesting property of ``project.refs`` is that it allows for
|
... | ... | @@ -160,7 +160,7 @@ def test_options(cli, cmd, word_idx, expected): |
160 | 160 |
('bst show --deps b', 3, ['build ']),
|
161 | 161 |
('bst show --deps=b', 2, ['build ']),
|
162 | 162 |
('bst show --deps r', 3, ['run ']),
|
163 |
- ('bst track --deps ', 3, ['all ', 'none ']),
|
|
163 |
+ ('bst source track --deps ', 4, ['all ', 'none ']),
|
|
164 | 164 |
])
|
165 | 165 |
def test_option_choice(cli, cmd, word_idx, expected):
|
166 | 166 |
assert_completion(cli, cmd, word_idx, expected)
|