You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/11/10 10:10:48 UTC
[buildstream] branch tristan/mirrors updated (b02f2ad -> ba2d371)
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a change to branch tristan/mirrors
in repository https://gitbox.apache.org/repos/asf/buildstream.git.
from b02f2ad _context.py, _project.py: Allow user configuration to override mirror definitions
new f9ed353 tests/frontend/mirror.py: Test that mirrors set from user configuration also work
new 1ce3368 doc: Document the ability to override source mirrors in user configuration
new ba2d371 NEWS: Document that user configuration can now override project defined source mirrors
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
NEWS | 3 +++
doc/source/format_project.rst | 7 ++++---
doc/source/using_config.rst | 38 +++++++++++++++++++++++++++++++++++---
tests/frontend/mirror.py | 26 ++++++++++++++++++--------
4 files changed, 60 insertions(+), 14 deletions(-)
[buildstream] 03/03: NEWS: Document that user configuration can now
override project defined source mirrors
Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/mirrors
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit ba2d3715f6dd2790b68ff036361e0835f40c8af4
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Nov 10 18:54:59 2021 +0900
NEWS: Document that user configuration can now override project defined source mirrors
---
NEWS | 3 +++
1 file changed, 3 insertions(+)
diff --git a/NEWS b/NEWS
index a2d8b56..c44f756 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,9 @@ Format
contain invalid characters, as was already documented. Now the warning
is replaced by an unconditional error.
+ o User configuration now has the ability to override source mirrors defined
+ by project configuration.
+
CLI
---
o BREAKING CHANGE: Removed `--deps plan` from all commands
[buildstream] 02/03: doc: Document the ability to override source
mirrors in user configuration
Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/mirrors
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 1ce3368247d78eef3d36f40b679f2e7c7b1b09e1
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Nov 10 18:53:57 2021 +0900
doc: Document the ability to override source mirrors in user configuration
---
doc/source/format_project.rst | 7 ++++---
doc/source/using_config.rst | 38 +++++++++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/doc/source/format_project.rst b/doc/source/format_project.rst
index 69b1e4c..aaece4b 100644
--- a/doc/source/format_project.rst
+++ b/doc/source/format_project.rst
@@ -287,9 +287,10 @@ list of URIs, e.g.
The order that the mirrors (and the URIs therein) are consulted is in the order
they are defined when fetching, and in reverse-order when tracking.
-A default mirror to consult first can be defined via
-:ref:`user config <config_default_mirror>`, or the command-line argument
-:ref:`--default-mirror <invoking_bst>`.
+The mirrors can be overridden on a per project basis using
+:ref:`user configuration <config_mirrors>`. One can also specify which mirror should
+be used first in the :ref:`user configuration <config_default_mirror>`, or using
+the :ref:`--default-mirror <invoking_bst>` command-line argument.
.. _project_plugins:
diff --git a/doc/source/using_config.rst b/doc/source/using_config.rst
index 9f6f4db..1f5bbf3 100644
--- a/doc/source/using_config.rst
+++ b/doc/source/using_config.rst
@@ -1060,13 +1060,45 @@ modifying some low level component.
the ``--strict`` and ``--no-strict`` command line options.
+.. _config_mirrors:
+
+Mirrors
+~~~~~~~
+Project defined :ref:`mirrors <project_essentials_mirrors>`, can be overridden
+with user configuration. This is helpful when you need to mirror all of the source
+code used by subprojects and ensure that your project can be built in perpetuity.
+
+**Example**
+
+.. code:: yaml
+
+ projects:
+ project-name:
+ mirrors:
+ - name: middle-earth
+ aliases:
+ foo:
+ - http://www.middle-earth.com/foo/1
+ - http://www.middle-earth.com/foo/2
+ bar:
+ - http://www.middle-earth.com/bar/1
+ - http://www.middle-earth.com/bar/2
+ - name: oz
+ aliases:
+ foo:
+ - http://www.oz.com/foo
+ bar:
+ - http://www.oz.com/bar
+
+
.. _config_default_mirror:
Default mirror
~~~~~~~~~~~~~~
-When using :ref:`mirrors <project_essentials_mirrors>`, a default mirror can
-be defined to be fetched first.
-The default mirror is defined by its name, e.g.
+When using :ref:`mirrors <project_essentials_mirrors>`, one can specify which
+mirror should be used first.
+
+**Example**
.. code:: yaml
[buildstream] 01/03: tests/frontend/mirror.py: Test that mirrors
set from user configuration also work
Posted by tv...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tvb pushed a commit to branch tristan/mirrors
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit f9ed353268237ac56553bd3499579a9be937ca6a
Author: Tristan van Berkom <tr...@codethink.co.uk>
AuthorDate: Wed Nov 10 19:10:01 2021 +0900
tests/frontend/mirror.py: Test that mirrors set from user configuration also work
---
tests/frontend/mirror.py | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py
index db5d6bf..c3cfbf0 100644
--- a/tests/frontend/mirror.py
+++ b/tests/frontend/mirror.py
@@ -38,19 +38,25 @@ def generate_element(output_file):
return element
-def generate_project():
+MIRROR_LIST = [
+ {"name": "middle-earth", "aliases": {"foo": ["OOF/"], "bar": ["RAB/"],},},
+ {"name": "arrakis", "aliases": {"foo": ["OFO/"], "bar": ["RBA/"],},},
+ {"name": "oz", "aliases": {"foo": ["ooF/"], "bar": ["raB/"],}},
+]
+
+
+def generate_project(define_mirrors=True):
project = {
"name": "test",
"min-version": "2.0",
"element-path": "elements",
"aliases": {"foo": "FOO/", "bar": "BAR/",},
- "mirrors": [
- {"name": "middle-earth", "aliases": {"foo": ["OOF/"], "bar": ["RAB/"],},},
- {"name": "arrakis", "aliases": {"foo": ["OFO/"], "bar": ["RBA/"],},},
- {"name": "oz", "aliases": {"foo": ["ooF/"], "bar": ["raB/"],}},
- ],
"plugins": [{"origin": "local", "path": "sources", "sources": ["fetch_source"]}],
}
+
+ if define_mirrors:
+ project["mirrors"] = MIRROR_LIST
+
return project
@@ -116,7 +122,8 @@ def test_mirror_fetch_ref_storage(cli, tmpdir, datafiles, ref_storage, mirror):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.usefixtures("datafiles")
-def test_mirror_fetch_multi(cli, tmpdir):
+@pytest.mark.parametrize("project_config", [True, False], ids=["user-config", "project-config"])
+def test_mirror_fetch_multi(cli, tmpdir, project_config):
output_file = os.path.join(str(tmpdir), "output.txt")
project_dir = str(tmpdir)
element_dir = os.path.join(project_dir, "elements")
@@ -127,9 +134,12 @@ def test_mirror_fetch_multi(cli, tmpdir):
_yaml.roundtrip_dump(element, element_path)
project_file = os.path.join(project_dir, "project.conf")
- project = generate_project()
+ project = generate_project(project_config)
_yaml.roundtrip_dump(project, project_file)
+ if not project_config:
+ cli.configure({"projects": {"test": {"mirrors": MIRROR_LIST}}})
+
result = cli.run(project=project_dir, args=["source", "fetch", element_name])
result.assert_success()
with open(output_file, encoding="utf-8") as f: