summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-11 22:11:11 +0900
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-04-11 14:10:55 +0000
commitc94f1264014b7bb4110949bf326c500919f5534a (patch)
treeeb543eecff05d9bf9f9ad59d28db1d201ab96c5d
parent6ad88ecb3b5b465c4542a8dfdfc39386632319d1 (diff)
downloadbuildstream-c94f1264014b7bb4110949bf326c500919f5534a.tar.gz
element.py, source.py: Cleanup how Source cache keys are calculated.
Recently after a refactor we kept the Source adding workspace keys to the source keys because, now clean this up to have the workspace key added directly in the Element cache key calculation. This breaks cache keys.
-rw-r--r--buildstream/element.py13
-rw-r--r--buildstream/source.py13
-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/local1.expected2
-rw-r--r--tests/cachekey/project/sources/local2.expected2
-rw-r--r--tests/cachekey/project/sources/ostree1.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/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
27 files changed, 30 insertions, 46 deletions
diff --git a/buildstream/element.py b/buildstream/element.py
index 0424b872b..091aaa19f 100644
--- a/buildstream/element.py
+++ b/buildstream/element.py
@@ -997,16 +997,6 @@ class Element(Plugin):
project = self._get_project()
workspace = self._get_workspace()
- # Use the workspace key in source cache key calculations.
- #
- # This is only done this way to retain backwards compatibility
- # of the cache key after making workspaces element wide instead
- # of being source specific.
- #
- workspace_key = None
- if workspace:
- workspace_key = workspace.get_key()
-
self.__cache_key_dict = {
'artifact-version': "{}.{}".format(BST_CORE_ARTIFACT_VERSION,
self.BST_ARTIFACT_VERSION),
@@ -1015,7 +1005,8 @@ class Element(Plugin):
'element': self.get_unique_key(),
'execution-environment': self.__sandbox_config.get_unique_key(),
'environment': cache_env,
- 'sources': [s._get_unique_key(workspace_key) for s in self.__sources],
+ 'sources': [s._get_unique_key(workspace is None) for s in self.__sources],
+ 'workspace': '' if workspace is None else workspace.get_key(),
'public': self.__public,
'cache': type(self.__artifacts).__name__
}
diff --git a/buildstream/source.py b/buildstream/source.py
index 2c1b8445e..ac22a1a8e 100644
--- a/buildstream/source.py
+++ b/buildstream/source.py
@@ -360,20 +360,13 @@ class Source(Plugin):
# Wrapper for get_unique_key() api
#
# Args:
- # workspace_key: An alternative key to use instead of this
- # source's unique key
+ # include_source (bool): Whether to include the delegated source key
#
- # This adds any core attributes to the key and
- # also calculates something different if workspaces
- # are active.
- #
- def _get_unique_key(self, workspace_key=None):
+ def _get_unique_key(self, include_source):
key = {}
key['directory'] = self.__directory
- if workspace_key is not None:
- key['workspace'] = workspace_key
- else:
+ if include_source:
key['unique'] = self.get_unique_key()
return key
diff --git a/tests/cachekey/project/elements/build1.expected b/tests/cachekey/project/elements/build1.expected
index a5d0bdba8..6e228fd8f 100644
--- a/tests/cachekey/project/elements/build1.expected
+++ b/tests/cachekey/project/elements/build1.expected
@@ -1 +1 @@
-e627300631f39b713fc5aac9446efeda96b1c3f92ef3f2200a074539e49beaf7
+9ce7551d85308d10ce783799338cf5d42750ef364842fabbbcd8e77c13db64c3 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/build2.expected b/tests/cachekey/project/elements/build2.expected
index 02e4b5577..115abc9a5 100644
--- a/tests/cachekey/project/elements/build2.expected
+++ b/tests/cachekey/project/elements/build2.expected
@@ -1 +1 @@
-b5ba1cfe2e4cce33baf793c5d69c840c4339ad57bbc8fee1fb7adef44d4821d0
+02cd3ad590b76efa6b4d0b608561163a66dee1bf8c359117419d251d646642d9 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose1.expected b/tests/cachekey/project/elements/compose1.expected
index a3a1c0957..458fb55a7 100644
--- a/tests/cachekey/project/elements/compose1.expected
+++ b/tests/cachekey/project/elements/compose1.expected
@@ -1 +1 @@
-394871caf40e79818d09b8e651b5baa1cb812d84716f4adb87cb1ca2f51a418b \ No newline at end of file
+6264380c3bb8c456d0159863118b071e903a8545a1922d226ed6dd688e20a109 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose2.expected b/tests/cachekey/project/elements/compose2.expected
index d18751776..7b48672f7 100644
--- a/tests/cachekey/project/elements/compose2.expected
+++ b/tests/cachekey/project/elements/compose2.expected
@@ -1 +1 @@
-78ca65e94d5fe39e67a7921cd2faf0bf8313a13a6a70e77d589ebd6d7128bf90 \ No newline at end of file
+5105c6f0b08ebb6c3cbe1d18eef30439327a1363a230a5f1aa6c814876cfa4a5 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose3.expected b/tests/cachekey/project/elements/compose3.expected
index 0b1d693c0..ed22cec42 100644
--- a/tests/cachekey/project/elements/compose3.expected
+++ b/tests/cachekey/project/elements/compose3.expected
@@ -1 +1 @@
-3e047a78d886427ccccfccb5f8ad22ac5c79676869e9ad6929e9f1379a57905e \ No newline at end of file
+f8d654b1975456b5a2619ce492abbfb740611591a8fe359a8ff65c6937e72636 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose4.expected b/tests/cachekey/project/elements/compose4.expected
index 234b1fa46..478f17a0b 100644
--- a/tests/cachekey/project/elements/compose4.expected
+++ b/tests/cachekey/project/elements/compose4.expected
@@ -1 +1 @@
-f41e670c67375c793f64b9230d19cfcd81b7d31df71be150f98b414bd917a424 \ No newline at end of file
+687bf6d47c536d690276a6a43377df4c012a07a1557580007bcd5bbe9782127c \ No newline at end of file
diff --git a/tests/cachekey/project/elements/compose5.expected b/tests/cachekey/project/elements/compose5.expected
index 139dfef5a..b7724e783 100644
--- a/tests/cachekey/project/elements/compose5.expected
+++ b/tests/cachekey/project/elements/compose5.expected
@@ -1 +1 @@
-3a492fc57b9a99af1caef95c537c8fab4e183c7e32b1ea812201dc1058229136 \ No newline at end of file
+4d514e78ad5335a030f4154be773872f70d4bb3c961c3844fd0d2e16d268e025 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import1.expected b/tests/cachekey/project/elements/import1.expected
index c110aef23..1d9bb71c3 100644
--- a/tests/cachekey/project/elements/import1.expected
+++ b/tests/cachekey/project/elements/import1.expected
@@ -1 +1 @@
-40e28a44276c50a06d21a4e11815a0cd101e182f2a3e0d41c42aee8a3cc38083 \ No newline at end of file
+4ad3f24fb7283738ce23ee22b26559ea11f995a56a0f07d66d7bab3f61f4179e \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import2.expected b/tests/cachekey/project/elements/import2.expected
index 1990fdb0a..981dba524 100644
--- a/tests/cachekey/project/elements/import2.expected
+++ b/tests/cachekey/project/elements/import2.expected
@@ -1 +1 @@
-b9812cfe17f497449f92c0b1e8e9dd34bcf9bec13241e98ae50cbdb45b8f585c \ No newline at end of file
+751adb6596c139acc14d6e48bea03b6a73ebd08ad8c897546b667f5d3b1c20b5 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/import3.expected b/tests/cachekey/project/elements/import3.expected
index 2e266feff..525bad4ee 100644
--- a/tests/cachekey/project/elements/import3.expected
+++ b/tests/cachekey/project/elements/import3.expected
@@ -1 +1 @@
-1908932c1c85d6a77f233cbdd0a811142e67e494ae35ceee47e0d847688d1fc2 \ No newline at end of file
+47dbf0fb291273606bee23afa90bd61d60199b438faf409035d7c5f54cdf5134 \ No newline at end of file
diff --git a/tests/cachekey/project/elements/script1.expected b/tests/cachekey/project/elements/script1.expected
index e2b80ddb4..b7473875d 100644
--- a/tests/cachekey/project/elements/script1.expected
+++ b/tests/cachekey/project/elements/script1.expected
@@ -1 +1 @@
-b8d8400afa31654600cb5eb3f1fbc7165e2316ba759cca197e6e5f54fd4cfd04
+e0dfac539f12753f68bcbef67669f1dd66debe449ebc0120fa224a18c5ed45fb \ No newline at end of file
diff --git a/tests/cachekey/project/sources/bzr1.expected b/tests/cachekey/project/sources/bzr1.expected
index ed4072735..8ad869d37 100644
--- a/tests/cachekey/project/sources/bzr1.expected
+++ b/tests/cachekey/project/sources/bzr1.expected
@@ -1 +1 @@
-253316463a7712921ec4095fc804728d38962ed8228a49e9c258b413d3c259da \ No newline at end of file
+7698ed38772af50009cce4cade09eb2a023475d306a3ad651d5ad81b5f146f5f \ No newline at end of file
diff --git a/tests/cachekey/project/sources/git1.expected b/tests/cachekey/project/sources/git1.expected
index e43c19ddd..fe7be55c0 100644
--- a/tests/cachekey/project/sources/git1.expected
+++ b/tests/cachekey/project/sources/git1.expected
@@ -1 +1 @@
-67244d16c75bde36f6b8d2aef49aa0896ab1b261cfd58e223d387f3cc6053c5a \ No newline at end of file
+9fda8c5236b49c0a886270d2f5f9c9821a17702e08fb4ee031dccf528ce93295 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/git2.expected b/tests/cachekey/project/sources/git2.expected
index 77f090c07..dc719eed7 100644
--- a/tests/cachekey/project/sources/git2.expected
+++ b/tests/cachekey/project/sources/git2.expected
@@ -1 +1 @@
-d8c6cfc83bad0419c1a35d5cf2af0e07b31519ded8f04aaa960d2d669da53541 \ No newline at end of file
+0845128c2d465362075129a0ffd45bae2789fe6cee273293aa2f9dddc8ecc948 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/local1.expected b/tests/cachekey/project/sources/local1.expected
index c110aef23..1d9bb71c3 100644
--- a/tests/cachekey/project/sources/local1.expected
+++ b/tests/cachekey/project/sources/local1.expected
@@ -1 +1 @@
-40e28a44276c50a06d21a4e11815a0cd101e182f2a3e0d41c42aee8a3cc38083 \ No newline at end of file
+4ad3f24fb7283738ce23ee22b26559ea11f995a56a0f07d66d7bab3f61f4179e \ No newline at end of file
diff --git a/tests/cachekey/project/sources/local2.expected b/tests/cachekey/project/sources/local2.expected
index e90e004d6..aeda5dac0 100644
--- a/tests/cachekey/project/sources/local2.expected
+++ b/tests/cachekey/project/sources/local2.expected
@@ -1 +1 @@
-60f56c0ea299e36260f834b23aa3966fd727b2f4a3af5b8cd1830d89aa7357f8 \ No newline at end of file
+a768571d58fedb28f70ca59b98a298b5a95c08f5909d57e0717ca13df15edf29 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/ostree1.expected b/tests/cachekey/project/sources/ostree1.expected
index 12a92f1e5..01f50cb89 100644
--- a/tests/cachekey/project/sources/ostree1.expected
+++ b/tests/cachekey/project/sources/ostree1.expected
@@ -1 +1 @@
-8990e4c3bf97e64b78cd81acf4d22d3e96bd04bacd7dedb20fb14276b8546165 \ No newline at end of file
+ba89a536096b5cac0f4ad09770189132eea929531d5716ea5b400f314f3e2552 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch1.expected b/tests/cachekey/project/sources/patch1.expected
index c1b4e6b7f..be110f9c5 100644
--- a/tests/cachekey/project/sources/patch1.expected
+++ b/tests/cachekey/project/sources/patch1.expected
@@ -1 +1 @@
-5213b528f286e8dd6b223167492ac04a89a57f3c3cc9953d4530c256297a0e7f \ No newline at end of file
+223677ae43c0980dbb2958ccb78b289e9154eaa57daea99558bea80cbbcdde30 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch2.expected b/tests/cachekey/project/sources/patch2.expected
index 3f7d2a24a..ff7a10397 100644
--- a/tests/cachekey/project/sources/patch2.expected
+++ b/tests/cachekey/project/sources/patch2.expected
@@ -1 +1 @@
-06c3f3b9fb7739c05d0b8cf5275d385b84a08ce22ae5ee8d997faf0091b55ce9 \ No newline at end of file
+f1cf814806f9a8828754f24a4b31e8fdc2ea5533ce808d9a20b1986641f0a53b \ No newline at end of file
diff --git a/tests/cachekey/project/sources/patch3.expected b/tests/cachekey/project/sources/patch3.expected
index 52d7b6b0d..209f9c231 100644
--- a/tests/cachekey/project/sources/patch3.expected
+++ b/tests/cachekey/project/sources/patch3.expected
@@ -1 +1 @@
-91b51db2184a013cd05c17775949c1b5ceb55daccfa70a4b5d020674fbf248dd \ No newline at end of file
+8d28355abf2d2abbc5626eea4b0fa3955bb8dc7dab50cb2c6a446fd333eacfb7 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/tar1.expected b/tests/cachekey/project/sources/tar1.expected
index 34d07fcab..5723abaa7 100644
--- a/tests/cachekey/project/sources/tar1.expected
+++ b/tests/cachekey/project/sources/tar1.expected
@@ -1 +1 @@
-5f6e2d02c9927ed10a7095923d582a2eedb2b9988f74d5df3a334807c8dc3f9f \ No newline at end of file
+709d8a389869aed817521c470a70afe41e9ce3aa287c7c6db9f4728b5cbeee1e \ No newline at end of file
diff --git a/tests/cachekey/project/sources/tar2.expected b/tests/cachekey/project/sources/tar2.expected
index a2ea3a890..4460f9fc9 100644
--- a/tests/cachekey/project/sources/tar2.expected
+++ b/tests/cachekey/project/sources/tar2.expected
@@ -1 +1 @@
-98512664b1b7a41ee993d7d808a16eec12b39310dac64fc771ed4dd19d22f3a4 \ No newline at end of file
+8dda4496e14f20236d45b6a5f2a11648329621f313ce6e821ae1ca1f8af88d6c \ No newline at end of file
diff --git a/tests/cachekey/project/sources/zip1.expected b/tests/cachekey/project/sources/zip1.expected
index 8d4d99679..73f2dfae3 100644
--- a/tests/cachekey/project/sources/zip1.expected
+++ b/tests/cachekey/project/sources/zip1.expected
@@ -1 +1 @@
-0b5672ca53b52a39ef2a1bf442ff09f781d68776c4772fc01500c8cf659d135f \ No newline at end of file
+b58c2a51ff1593c9f73f8838b8d90e7fcdb5487c704a095e7715a22d8f97cfd3 \ No newline at end of file
diff --git a/tests/cachekey/project/sources/zip2.expected b/tests/cachekey/project/sources/zip2.expected
index 55d294dcb..ffb13498f 100644
--- a/tests/cachekey/project/sources/zip2.expected
+++ b/tests/cachekey/project/sources/zip2.expected
@@ -1 +1 @@
-7a8726d0eb60b96d4bb056c3726339403a5d7bf8fd84569781354e2e457e989e \ No newline at end of file
+f72d89fc47e5d3c949a68b1ceef57e2fd10a6e0f41630ef2b321107870892168 \ No newline at end of file
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index 5ecbc0a3a..784e3f2a0 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-8eabd313b3c2c744450fef4c5b52d68babe6d39a278e80e39f5ef886fd49e799
+f2a5127dc0539eb54b57d405ba64d97d5c951a561a8386619624b1e36f65a059 \ No newline at end of file