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-13 15:38:33 +0000
commita2dec5a5bff0eb82e5e928e76a5a1e794ed1db51 (patch)
treefaa8a816cb0ead1b36340549de291216fa77eb11
parent9b4a7de7fd52507e53bb523aec5addba760a69ee (diff)
downloadmorph-a2dec5a5bff0eb82e5e928e76a5a1e794ed1db51.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