summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2020-08-21 10:57:25 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2020-08-21 10:57:25 +0000
commit4929020e85b68c3446ddc276821219fc1f687d18 (patch)
tree92bd1ef044351bd29fd37fa33268d985173ae00b
parent51afe1c81f28dcee9b8b0df5330217511bec3a84 (diff)
parent41a7129139cd578876b3aefa08d9326cf789e38d (diff)
downloadbuildstream-4929020e85b68c3446ddc276821219fc1f687d18.tar.gz
Merge branch 'tristan/build-root-cache-key' into 'master'
Consider %{build-root} in the cache key unconditionally Closes #1386 See merge request BuildStream/buildstream!2036
-rw-r--r--src/buildstream/element.py12
-rw-r--r--src/buildstream/testing/_cachekeys.py2
-rw-r--r--tests/cachekey/cachekey.py2
-rw-r--r--tests/cachekey/project/elements/build1.expected2
-rw-r--r--tests/cachekey/project/elements/build2.expected2
-rw-r--r--tests/cachekey/project/elements/compose1.expected2
-rw-r--r--tests/cachekey/project/elements/compose2.expected2
-rw-r--r--tests/cachekey/project/elements/compose3.expected2
-rw-r--r--tests/cachekey/project/elements/compose4.expected2
-rw-r--r--tests/cachekey/project/elements/compose5.expected2
-rw-r--r--tests/cachekey/project/elements/import1.expected2
-rw-r--r--tests/cachekey/project/elements/import2.expected2
-rw-r--r--tests/cachekey/project/elements/import3.expected2
-rw-r--r--tests/cachekey/project/elements/script1.expected2
-rw-r--r--tests/cachekey/project/sources/bzr1.expected2
-rw-r--r--tests/cachekey/project/sources/git1.expected2
-rw-r--r--tests/cachekey/project/sources/git2.expected2
-rw-r--r--tests/cachekey/project/sources/git3.expected2
-rw-r--r--tests/cachekey/project/sources/local1.expected2
-rw-r--r--tests/cachekey/project/sources/local2.expected2
-rw-r--r--tests/cachekey/project/sources/patch1.expected2
-rw-r--r--tests/cachekey/project/sources/patch2.expected2
-rw-r--r--tests/cachekey/project/sources/patch3.expected2
-rw-r--r--tests/cachekey/project/sources/pip1.expected2
-rw-r--r--tests/cachekey/project/sources/remote1.expected2
-rw-r--r--tests/cachekey/project/sources/remote2.expected2
-rw-r--r--tests/cachekey/project/sources/tar1.expected2
-rw-r--r--tests/cachekey/project/sources/tar2.expected2
-rw-r--r--tests/cachekey/project/sources/zip1.expected2
-rw-r--r--tests/cachekey/project/sources/zip2.expected2
-rw-r--r--tests/cachekey/project/target.expected2
31 files changed, 42 insertions, 30 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index f7d49d57f..4a29fd8f2 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -2014,6 +2014,7 @@ class Element(Plugin):
self.__cache_key_dict = {
"core-artifact-version": BST_CORE_ARTIFACT_VERSION,
+ "element-base-key": self.__get_base_key(),
"element-plugin-key": self.get_unique_key(),
"element-plugin-name": self.get_kind(),
"element-plugin-version": self.BST_ARTIFACT_VERSION,
@@ -2370,6 +2371,17 @@ class Element(Plugin):
self.__sources.preflight()
+ # __get_base_key()
+ #
+ # Gets the base key for this element, the base key
+ # is the part of the cache key which is element instance
+ # specific and automatically generated by BuildStream core.
+ #
+ def __get_base_key(self):
+ return {
+ "build-root": self.get_variable("build-root"),
+ }
+
# __assert_cached()
#
# Raises an error if the artifact is not cached.
diff --git a/src/buildstream/testing/_cachekeys.py b/src/buildstream/testing/_cachekeys.py
index a7ea5ad7e..b4340adbf 100644
--- a/src/buildstream/testing/_cachekeys.py
+++ b/src/buildstream/testing/_cachekeys.py
@@ -143,6 +143,6 @@ def _assert_cache_keys(project_dir, output):
raise AssertionError(
"Cache key mismatches occurred:\n{}\n".format(info)
- + "Use python3 -m buildstream.testing._update_cachekeys in the project's"
+ + "Use python3 -m buildstream.testing._update_cachekeys in the project's "
+ "directory to automatically update this test case"
)
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py
index 951972206..00dd53fad 100644
--- a/tests/cachekey/cachekey.py
+++ b/tests/cachekey/cachekey.py
@@ -99,7 +99,7 @@ def test_cache_key_fatal_warnings(cli, tmpdir, first_warnings, second_warnings,
# Builds project, Runs bst show, gathers cache keys
def run_get_cache_key(project_name, warnings):
- config = {"name": project_name, "min-version": "2.0", "element-path": "elements", "fatal-warnings": warnings}
+ config = {"name": "test", "min-version": "2.0", "element-path": "elements", "fatal-warnings": warnings}
project_dir = tmpdir.mkdir(project_name)
project_config_file = str(project_dir.join("project.conf"))
diff --git a/tests/cachekey/project/elements/build1.expected b/tests/cachekey/project/elements/build1.expected
index caa45bf73..352d23014 100644
--- a/tests/cachekey/project/elements/build1.expected
+++ b/tests/cachekey/project/elements/build1.expected
@@ -1 +1 @@
-648848a7fba41a9da8dec2e0aeb00fc011aec529c791c8c29d9a47fab795e8ef \ No newline at end of file
+f8781566f1c225e9fbc40f7bf7a79b54da1df44573a3ca2d596269f1f929f6db \ No newline at end of file
diff --git a/tests/cachekey/project/elements/build2.expected b/tests/cachekey/project/elements/build2.expected
index 40520a7aa..f55596acc 100644
--- a/tests/cachekey/project/elements/build2.expected
+++ b/tests/cachekey/project/elements/build2.expected
@@ -1 +1 @@
-af612783a2d9c3b4f1fc00b79094eb707c11b311d33acf9c737f1021b6c4ff9b \ No newline at end of file
+39f2221cb0021ca5c759515a3cc37dbf65fc9883e7e55e54f492034d641391e5 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose1.expected b/tests/cachekey/project/elements/compose1.expected
index f914caba8..641773205 100644
--- a/tests/cachekey/project/elements/compose1.expected
+++ b/tests/cachekey/project/elements/compose1.expected
@@ -1 +1 @@
-80f5d8706bb6e1eb794e74a78d0738850dae3155091879525860c979c3cdf696 \ No newline at end of file
+024cc9f232d5eb23f608c8364c4ec411c173a959b2ad9b219c824bbe4f474757 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose2.expected b/tests/cachekey/project/elements/compose2.expected
index 307d33076..699dec476 100644
--- a/tests/cachekey/project/elements/compose2.expected
+++ b/tests/cachekey/project/elements/compose2.expected
@@ -1 +1 @@
-e9c86ffe988cce20c1226a40bed0af44400d3ddc1a5942424aa43202781069b0 \ No newline at end of file
+aa6f0f41b37a1dd739168b04959689488a89b1fb295d555a89b751a62152a9cb \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose3.expected b/tests/cachekey/project/elements/compose3.expected
index d02882afd..e7e97c8e4 100644
--- a/tests/cachekey/project/elements/compose3.expected
+++ b/tests/cachekey/project/elements/compose3.expected
@@ -1 +1 @@
-b79b0265dadbd9a052c677f85615bec95153055eb64091378fff8eb3dc9ecae4 \ No newline at end of file
+a318560514f09bb96d8e15fd09c862ffa3ed7c06876b9ba94f8076951d29ca7f \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose4.expected b/tests/cachekey/project/elements/compose4.expected
index 750423f70..22d824e0c 100644
--- a/tests/cachekey/project/elements/compose4.expected
+++ b/tests/cachekey/project/elements/compose4.expected
@@ -1 +1 @@
-3cd0532d8160db2918970133dc7d7e4ddf0fd4f5aa03340753d941ab894e2c8f \ No newline at end of file
+9494aaf4193cf9eae4a5013e51d65b28f5180be45dc228d767b04e294ecf2b13 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose5.expected b/tests/cachekey/project/elements/compose5.expected
index 8aa52e9f5..381097a6e 100644
--- a/tests/cachekey/project/elements/compose5.expected
+++ b/tests/cachekey/project/elements/compose5.expected
@@ -1 +1 @@
-b545838260f214d6a774cb0757e5fdbf81041924cf0036e335dee6a5a2fb96c4 \ No newline at end of file
+e5d18ce350380ef6525a38e0ad4e8f4e83571ddd89dcb0218429b64415be9333 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import1.expected b/tests/cachekey/project/elements/import1.expected
index e242882a3..e284a0c57 100644
--- a/tests/cachekey/project/elements/import1.expected
+++ b/tests/cachekey/project/elements/import1.expected
@@ -1 +1 @@
-01814090d495860a7ab39054f57b32197661e4d5ba1b9573c12cc0edeecb75a8 \ No newline at end of file
+116df541e3513ebb01ed652bda6cb1c0fae8a93ac990e9ffae2b579b59b3a77c \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import2.expected b/tests/cachekey/project/elements/import2.expected
index 802e1347a..26cf63c63 100644
--- a/tests/cachekey/project/elements/import2.expected
+++ b/tests/cachekey/project/elements/import2.expected
@@ -1 +1 @@
-fc2ce4996757fa4557454a10c1f73e746604fae096c226adf05642559f35763e \ No newline at end of file
+bd023e73889798330c3faa6a7b1adce060f5533363714c1d689cbb0a9411f8f7 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import3.expected b/tests/cachekey/project/elements/import3.expected
index 438bf9172..a8628997f 100644
--- a/tests/cachekey/project/elements/import3.expected
+++ b/tests/cachekey/project/elements/import3.expected
@@ -1 +1 @@
-a828a8bfb3b036441dcbf635ca4ef6e7f079cb52128cacf4a8d844cb44e3c762 \ No newline at end of file
+48b8ffe9a09840bd88225c360824f60869cbb99909ebd2da59987fb5d06b02a0 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/script1.expected b/tests/cachekey/project/elements/script1.expected
index 6667b5bea..ab5ddb634 100644
--- a/tests/cachekey/project/elements/script1.expected
+++ b/tests/cachekey/project/elements/script1.expected
@@ -1 +1 @@
-472cfe8a41856db06bf1d5c2fa052e8985ce00534df4a98b22378f15b2d9d188 \ No newline at end of file
+53ddb2bea53b02478388263a770e7a52fa806a5f44861ff0a08b9c4d67a7ee2a \ No newline at end of file
diff --git a/tests/cachekey/project/sources/bzr1.expected b/tests/cachekey/project/sources/bzr1.expected
index 50eff30c6..39aef7888 100644
--- a/tests/cachekey/project/sources/bzr1.expected
+++ b/tests/cachekey/project/sources/bzr1.expected
@@ -1 +1 @@
-2825e2d55baa6617ec7e559ae554bb66761105a1ce50028bffdb983b6bb11707 \ No newline at end of file
+5cce55b7c73d89bda839cd6dc89763b8dbcc2d6ce11924219d1a4b052ad707cf \ No newline at end of file
diff --git a/tests/cachekey/project/sources/git1.expected b/tests/cachekey/project/sources/git1.expected
index 833e3a9a9..4d3eeac29 100644
--- a/tests/cachekey/project/sources/git1.expected
+++ b/tests/cachekey/project/sources/git1.expected
@@ -1 +1 @@
-4e21bc1089066998d44933fdf1e48b2a5a73ceaba7a3944538f3f142e34b8b8e \ No newline at end of file
+c7bffb1549796cfc88d64637c3da6f3aa55440c2b9690a69441116d870d513c5 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/git2.expected b/tests/cachekey/project/sources/git2.expected
index b4d2e70ae..dd9b8406a 100644
--- a/tests/cachekey/project/sources/git2.expected
+++ b/tests/cachekey/project/sources/git2.expected
@@ -1 +1 @@
-c6cb011849cb0ded98add6f46e6737caa1191e6cec58bcee20f06a5198f03466 \ No newline at end of file
+a53b0ff331291f483b489386babab0bb628a8beb08ffb20b2fb697f44660ada8 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/git3.expected b/tests/cachekey/project/sources/git3.expected
index 2d12c164d..36066af15 100644
--- a/tests/cachekey/project/sources/git3.expected
+++ b/tests/cachekey/project/sources/git3.expected
@@ -1 +1 @@
-65f9f934ed84d63bb19dab4c323bb3a4a3cef85d9592f5be9d6d6e420952747e \ No newline at end of file
+fd29b9a8810ccad865dae57d08ea3fc52ec88753621007a5ea0f1bb7887d019c \ No newline at end of file
diff --git a/tests/cachekey/project/sources/local1.expected b/tests/cachekey/project/sources/local1.expected
index e242882a3..cd4d88520 100644
--- a/tests/cachekey/project/sources/local1.expected
+++ b/tests/cachekey/project/sources/local1.expected
@@ -1 +1 @@
-01814090d495860a7ab39054f57b32197661e4d5ba1b9573c12cc0edeecb75a8 \ No newline at end of file
+ce06b21e8f3673bea6d3fa521099a26abe1ba89da996b24c9f9df1270ec4d33b \ No newline at end of file
diff --git a/tests/cachekey/project/sources/local2.expected b/tests/cachekey/project/sources/local2.expected
index 184ededc7..48f41026e 100644
--- a/tests/cachekey/project/sources/local2.expected
+++ b/tests/cachekey/project/sources/local2.expected
@@ -1 +1 @@
-586f82dd991878c0bd4b373bcd9685505c930cf2477b13557257b962c899ef70 \ No newline at end of file
+bb58f6f866f208fdd9cd23787ac86053da3d9323b4f0c3fbecd35dce8fcbd6f7 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch1.expected b/tests/cachekey/project/sources/patch1.expected
index 873cb1f21..e133afc3f 100644
--- a/tests/cachekey/project/sources/patch1.expected
+++ b/tests/cachekey/project/sources/patch1.expected
@@ -1 +1 @@
-7bc6295e5f201f2a04ccd7ea8b3be8ef904fa684bfb5d6ec3ec37174bb4a4cf3 \ No newline at end of file
+bd8de9888211ae39c3bb0e14466b78da5f15bcdcfcd5858973a76e23619f6b73 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch2.expected b/tests/cachekey/project/sources/patch2.expected
index a9deef92f..dd245317c 100644
--- a/tests/cachekey/project/sources/patch2.expected
+++ b/tests/cachekey/project/sources/patch2.expected
@@ -1 +1 @@
-973765368a6082d2c317da1f1fffbcf1f1ab586548d816a6e7a1f6136f3271aa \ No newline at end of file
+069e0cb51948634bdf29259717895a1e899fac530b8510f0e5e9cbdf9b33a9f8 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch3.expected b/tests/cachekey/project/sources/patch3.expected
index b04dc3b75..e2b526292 100644
--- a/tests/cachekey/project/sources/patch3.expected
+++ b/tests/cachekey/project/sources/patch3.expected
@@ -1 +1 @@
-506ccb32c5d9960fa74a3e224c583a399a71198162fb7c5604cb8d4b53af2307 \ No newline at end of file
+71ef2b3f0e5eac0cd7f56d0602af82e97e80055a6b4fbe6b9595267fb9c8ab9d \ No newline at end of file
diff --git a/tests/cachekey/project/sources/pip1.expected b/tests/cachekey/project/sources/pip1.expected
index 844f4c54c..8a0bf5881 100644
--- a/tests/cachekey/project/sources/pip1.expected
+++ b/tests/cachekey/project/sources/pip1.expected
@@ -1 +1 @@
-70870ffa81e4527a2d812c809b1e99025c72d1ae289be38e45a5b22dc0262eac \ No newline at end of file
+2b93d5b622a17115bda7f580c05a5d746431c61301cf29f0b36c9b653bf9463d \ No newline at end of file
diff --git a/tests/cachekey/project/sources/remote1.expected b/tests/cachekey/project/sources/remote1.expected
index 6f735034a..2c75c7c94 100644
--- a/tests/cachekey/project/sources/remote1.expected
+++ b/tests/cachekey/project/sources/remote1.expected
@@ -1 +1 @@
-94cac120225f3c023bdf3933b1248dbd1a0cdc401af1d0d76a3f603a1928c863 \ No newline at end of file
+7e52b9c9005c0d6ea444c9297f6562b2eb1f8b7b0ed74fb4581ec6ccaae35101 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/remote2.expected b/tests/cachekey/project/sources/remote2.expected
index f575c8db3..a2a399a3c 100644
--- a/tests/cachekey/project/sources/remote2.expected
+++ b/tests/cachekey/project/sources/remote2.expected
@@ -1 +1 @@
-51e296dd94a8e8fd94c85074458597b6ff33679add366a213187bd3904c1018a \ No newline at end of file
+fe91c1a4d59fc8073b98ada139e62da6209faa6e17096cec97f4fef927bd9679 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/tar1.expected b/tests/cachekey/project/sources/tar1.expected
index 6dda711fd..b5ab5f31e 100644
--- a/tests/cachekey/project/sources/tar1.expected
+++ b/tests/cachekey/project/sources/tar1.expected
@@ -1 +1 @@
-a1cb6f9f795c29d8c73239eff44bdabac29ee31c64cb1b6afb599093b9ce8737 \ No newline at end of file
+ecd3f8768ecc37052ca3b929edb05157b10024a0b2d8995bd2eda16cf755bcfe \ No newline at end of file
diff --git a/tests/cachekey/project/sources/tar2.expected b/tests/cachekey/project/sources/tar2.expected
index 6fb5021d5..e7eb10e96 100644
--- a/tests/cachekey/project/sources/tar2.expected
+++ b/tests/cachekey/project/sources/tar2.expected
@@ -1 +1 @@
-86f177f46e35ff192796d4523d1d9537d518dde93f8f2ceba132750f0661706a \ No newline at end of file
+0026613732373bda64502c4ca942a436ed5498a7a2d6e0527f79f726565f5a74 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/zip1.expected b/tests/cachekey/project/sources/zip1.expected
index e34a14eaf..b27d58922 100644
--- a/tests/cachekey/project/sources/zip1.expected
+++ b/tests/cachekey/project/sources/zip1.expected
@@ -1 +1 @@
-a409fc675bb26b64b1670abbb9faf8baa64ed04ea291fa7424ee549d915f90f0 \ No newline at end of file
+197ea9e8673273005d5b4b79aaab7acbe8286284af311e36287d700780254025 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/zip2.expected b/tests/cachekey/project/sources/zip2.expected
index dce49654a..ccd5eb938 100644
--- a/tests/cachekey/project/sources/zip2.expected
+++ b/tests/cachekey/project/sources/zip2.expected
@@ -1 +1 @@
-1f59dfd67201062654ddf17394d026b85de0f7bdaf949f857e324ea202f34b1a \ No newline at end of file
+2652e99bba39e2dc71b5a877585ed4420a726a0d627dad4782e3929532ad1c02 \ No newline at end of file
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index cf38ddcfe..7a7d19287 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-a57f84353d1528b3ecbd9993ac02a20d0355f2451e19700172c95575af9a5b48 \ No newline at end of file
+2b32b391b0b4c37a00cde24c7904461ff9a646b0506d7de2b412f379558f7650 \ No newline at end of file