diff options
-rw-r--r-- | src/buildstream/element.py | 4 | ||||
-rw-r--r-- | tests/frontend/buildcheckout.py | 22 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py index 06581b652..a7ee40051 100644 --- a/src/buildstream/element.py +++ b/src/buildstream/element.py @@ -3013,7 +3013,7 @@ class Element(Plugin): # encode the dependency's weak cache key instead of it's name. # dependencies = [ - e._get_cache_key(strength=_KeyStrength.WEAK) + [e.project_name, e.name, e._get_cache_key(strength=_KeyStrength.WEAK)] if self.BST_STRICT_REBUILD or e in self.__strict_dependencies else [e.project_name, e.name] for e in self.dependencies(Scope.BUILD) @@ -3119,7 +3119,7 @@ class Element(Plugin): self.__cache_key = strong_key elif self.__assemble_scheduled or self.__assemble_done: # Artifact will or has been built, not downloaded - dependencies = [e._get_cache_key() for e in self.dependencies(Scope.BUILD)] + dependencies = [[e.project_name, e.name, e._get_cache_key()] for e in self.dependencies(Scope.BUILD)] self.__cache_key = self._calculate_cache_key(dependencies) if self.__cache_key is None: diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index 52cf031ad..a64faeb9d 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -69,6 +69,28 @@ def test_build_checkout(datafiles, cli, strict, hardlinks): @pytest.mark.datafiles(DATA_DIR) +def test_non_strict_build_strict_checkout(datafiles, cli): + project = str(datafiles) + checkout = os.path.join(cli.directory, "checkout") + + # First build it in non-strict mode. + # As this is a clean build from scratch, the result and also the cache keys + # should be identical to a build in strict mode. + result = cli.run(project=project, args=["--no-strict", "build", "target.bst"]) + result.assert_success() + + # Now check it out in strict mode. + # This verifies that the clean build in non-strict mode produced an artifact + # matching the strict cache key. + result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkout]) + result.assert_success() + + # Check that the executable hello file is found in the checkout + filename = os.path.join(checkout, "usr", "bin", "hello") + assert os.path.exists(filename) + + +@pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("strict,hardlinks", [("non-strict", "hardlinks"),]) def test_build_invalid_suffix(datafiles, cli, strict, hardlinks): project = str(datafiles) |