summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@gmail.com>2014-09-10 10:34:06 +0000
committerRichard Maw <richard.maw@gmail.com>2014-09-19 12:43:25 +0000
commit8184edabc5999ecb43e49a4ef03f73e4270e5347 (patch)
treee53c5950ee7774d3717af97d218e31bbcb7d0cd5
parent59e1a82ab96115b6630269de28aadecf61d9bba9 (diff)
downloadmorph-8184edabc5999ecb43e49a4ef03f73e4270e5347.tar.gz
Move metadata_version value to cachekeycomputer
metadata_version is for when the format of the /baserock metadata files changes. This means it would make sense for it to either live with the code for generating the metadata, or the cache key code so it lives with the rest of the compatibility values. Since the code for generating the metadata isn't in a nice module anywhere, I've put it in the cachekeycomputer module.
-rw-r--r--morphlib/artifact.py4
-rw-r--r--morphlib/cachekeycomputer.py2
2 files changed, 1 insertions, 5 deletions
diff --git a/morphlib/artifact.py b/morphlib/artifact.py
index 1e67643e..cf5cbdbb 100644
--- a/morphlib/artifact.py
+++ b/morphlib/artifact.py
@@ -26,9 +26,6 @@ class Artifact(object):
* ``cache_id`` -- a dict describing the components of the cache key
* ``dependencies`` -- list of Artifacts that need to be built beforehand
* ``dependents`` -- list of Artifacts that need this Artifact to be built
- * ``metadata_version`` -- When the format of the artifact metadata
- changes, this version number is raised causing
- any existing cached artifacts to be invalidated
The ``dependencies`` and ``dependents`` lists MUST be modified by
the ``add_dependencies`` and ``add_dependent`` methods only.
@@ -42,7 +39,6 @@ class Artifact(object):
self.cache_key = None
self.dependencies = []
self.dependents = []
- self.metadata_version = 1
def add_dependency(self, artifact):
'''Add ``artifact`` to the dependency list.'''
diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py
index cf44f76e..a9f5aabe 100644
--- a/morphlib/cachekeycomputer.py
+++ b/morphlib/cachekeycomputer.py
@@ -85,7 +85,7 @@ class CacheKeyComputer(object):
'env': self._filterenv(self._build_env.env),
'kids': [{'artifact': a.name, 'cache-key': self.compute_key(a)}
for a in artifact.dependencies],
- 'metadata-version': artifact.metadata_version
+ 'metadata-version': 1 # bump if /baserock metadata format changes
}
kind = artifact.source.morphology['kind']