summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2014-01-08 14:29:14 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2014-01-16 16:58:24 +0000
commit90678ea8f8a0cbb95c049ef1fad9f40c3a2122a7 (patch)
tree5addd1f80f3890cad8b4967b7871768a4d918b84
parentb5e881996901e9b5646afc58b7c7dadc82491059 (diff)
downloadmorph-90678ea8f8a0cbb95c049ef1fad9f40c3a2122a7.tar.gz
CacheKeyComputer: Include split rules in computation
Chunk artifacts need the [(artifact_name, [regular_expression])] so that if the default split rules change, or the blending rule changes, then an extra version field doesn't need to be added to the cache key computer. This is for future plans to allow the split rules to be configurable and allow us to more easily change them. System and Stratum artifact computations don't need this, since those splitting rules are already expressed in the dependencies information.
-rw-r--r--morphlib/cachekeycomputer.py4
-rw-r--r--tests.as-root/run-in-artifact-with-different-artifacts.stderr2
2 files changed, 4 insertions, 2 deletions
diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py
index d7e2e3b1..2312abc3 100644
--- a/morphlib/cachekeycomputer.py
+++ b/morphlib/cachekeycomputer.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 Codethink Limited
+# Copyright (C) 2012-2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -90,6 +90,8 @@ class CacheKeyComputer(object):
keys['build-mode'] = artifact.source.build_mode
keys['prefix'] = artifact.source.prefix
keys['tree'] = artifact.source.tree
+ keys['split-rules'] = [(a, [rgx.pattern for rgx in r._regexes])
+ for (a, r) in artifact.source.split_rules]
elif kind in ('system', 'stratum'):
morphology = artifact.source.morphology
le_dict = dict((k, morphology[k]) for k in morphology.keys())
diff --git a/tests.as-root/run-in-artifact-with-different-artifacts.stderr b/tests.as-root/run-in-artifact-with-different-artifacts.stderr
index 5fc4fb0f..6e9a5f8f 100644
--- a/tests.as-root/run-in-artifact-with-different-artifacts.stderr
+++ b/tests.as-root/run-in-artifact-with-different-artifacts.stderr
@@ -1 +1 @@
-ERROR: Artifact TMP/cache/artifacts/67596ea97123eeb66afce92675dbb63eb8fd840d01f38902d4bf6f573b609499.stratum.linux-stratum cannot be extracted or mounted
+ERROR: Artifact TMP/cache/artifacts/ef470cc0efd6c64992198f9d224e4b68dc452528919e2b7cf3f10efa1b88541a.stratum.linux-stratum cannot be extracted or mounted