From 36100edc77e8245b080343e12f59c26e35d66f2e Mon Sep 17 00:00:00 2001 From: Jonathan Maw Date: Thu, 29 Nov 2012 16:13:48 +0000 Subject: Avoid rebuilds when unimportant morphology contents change This changes the cache key generation so that it will ignore unimportant fields of the morphology, e.g. description, build-depends, chunks. description is unimportant because it does not affect building, and build-depends/chunks are unimportant because they are already considered --- morphlib/cachekeycomputer.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'morphlib/cachekeycomputer.py') diff --git a/morphlib/cachekeycomputer.py b/morphlib/cachekeycomputer.py index a11334e3..a4ea10ed 100644 --- a/morphlib/cachekeycomputer.py +++ b/morphlib/cachekeycomputer.py @@ -91,6 +91,14 @@ class CacheKeyComputer(object): elif kind in ('system', 'stratum'): morphology = artifact.source.morphology le_dict = dict((k, morphology[k]) for k in morphology.keys()) + + # Disregard all fields of a morphology that aren't important + ignored_fields = ('strata', 'build-depends', 'description', + 'chunks') + for ignored_field in ignored_fields: + if ignored_field in le_dict: + del le_dict[ignored_field] + checksum = hashlib.sha1() self._hash_thing(checksum, le_dict) keys['morphology-sha1'] = checksum.hexdigest() -- cgit v1.2.1