diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-20 17:18:05 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2012-04-20 17:18:05 +0000 |
commit | 44764506c64ec132e593e5a0b060361c21107cb2 (patch) | |
tree | 51c8850097625daa9a5624f51b279fb00d5dbe42 | |
parent | 8d740a4bdd34f095e530c17ef5eb3f182fb566a7 (diff) | |
download | morph-44764506c64ec132e593e5a0b060361c21107cb2.tar.gz |
morph: add cache id to the meta files
This is probably excessively large right now
-rwxr-xr-x | morph | 1 | ||||
-rw-r--r-- | morphlib/artifact.py | 2 | ||||
-rw-r--r-- | morphlib/builder2.py | 4 | ||||
-rw-r--r-- | morphlib/builder2_tests.py | 1 |
4 files changed, 7 insertions, 1 deletions
@@ -197,6 +197,7 @@ class Morph(cliapp.Application): artifacts = ar.resolve_artifacts(srcpool) for artifact in artifacts: artifact.cache_key = ckc.compute_key(artifact) + artifact.cache_id = ckc.get_cache_id(artifact) order = morphlib.buildorder.BuildOrder(artifacts) needed = [] diff --git a/morphlib/artifact.py b/morphlib/artifact.py index cea2f2f3..9be47d48 100644 --- a/morphlib/artifact.py +++ b/morphlib/artifact.py @@ -23,6 +23,7 @@ class Artifact(object): * ``source`` -- the source from which the artifact is built * ``name`` -- the name of the artifact * ``cache_key`` -- a cache key to uniquely identify the artifact + * ``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 @@ -34,6 +35,7 @@ class Artifact(object): def __init__(self, source, name): self.source = source self.name = name + self.cache_id = None self.cache_key = None self.dependencies = [] self.dependents = [] diff --git a/morphlib/builder2.py b/morphlib/builder2.py index 5dd4b994..b8c51539 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -54,6 +54,8 @@ class BuilderBase(object): 'original_ref': self.artifact.source.original_ref, 'sha1': self.artifact.source.sha1, 'morphology': self.artifact.source.filename, + 'cache-key': self.artifact.cache_key, + 'cache-id': self.artifact.cache_id, } return meta @@ -82,7 +84,7 @@ class BuilderBase(object): # Unit tests use StringIO, which in Python 2.6 isn't usable with # the "with" statement. So we don't do it with "with". f = self._open(filename, 'w') - f.write(json.dumps(meta)) + f.write(json.dumps(meta, indent=4, sort_keys=True)) f.close() def new_artifact(self, artifact_name): diff --git a/morphlib/builder2_tests.py b/morphlib/builder2_tests.py index 53fd6711..44608c75 100644 --- a/morphlib/builder2_tests.py +++ b/morphlib/builder2_tests.py @@ -55,6 +55,7 @@ class FakeArtifact(object): self.name = name self.source = FakeSource() self.cache_key = 'blahblah' + self.cache_id = {} class FakeBuildEnv(object): |