From cd6d0572ef70b93636d7940d06ad0b13e0aca486 Mon Sep 17 00:00:00 2001 From: Valentin David Date: Sun, 10 May 2020 17:07:06 +0200 Subject: Allow junctions to inject dependencies from current project to junctioned one There are cases where downstream projects want to overwrite upstream elements. So far, either the downstream project just allows overlaps and hopes that ABI is compatible. There are also files left from original elements when not overwritten. Or downstream adds an "overlay" with local source to the junctions. However on the latter, elements in the overlay are considered as part of upstream, which means in cannot depend on element outside of upstream (unless cyclic junction maybe?). Here we add a feature to junctions to allow injecting elements from current project to junctions. This is useful for example in the case of GNOME SDK needing to override GLib, GObjectIntrospection, libsoup, etc. from Freedesktop SDK. --- tests/loader/junctions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/loader/junctions.py') diff --git a/tests/loader/junctions.py b/tests/loader/junctions.py index aee164396..0daa7e9f6 100644 --- a/tests/loader/junctions.py +++ b/tests/loader/junctions.py @@ -330,3 +330,19 @@ def test_build_git_cross_junction_names(cli, tmpdir, datafiles): # Check that the checkout contains the expected files from both projects assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) + + +@pytest.mark.datafiles(DATA_DIR) +def test_replacements(cli, tmpdir, datafiles): + project = os.path.join(str(datafiles), "replacements") + copy_subprojects(project, datafiles, ["replacements-base"]) + checkoutdir = os.path.join(str(tmpdir), "checkout") + + # Build, checkout + result = cli.run(project=project, args=["build", "stack.bst"]) + result.assert_success() + result = cli.run(project=project, args=["checkout", "stack.bst", checkoutdir]) + result.assert_success() + + assert os.path.exists(os.path.join(checkoutdir, "destination/injected.txt")) + assert not os.path.exists(os.path.join(checkoutdir, "original.txt")) -- cgit v1.2.1