diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2012-11-29 16:13:48 +0000 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2012-11-29 17:03:08 +0000 |
commit | 36100edc77e8245b080343e12f59c26e35d66f2e (patch) | |
tree | 006f8559ab7de8fe84f9c20a712c588af948a106 /morphlib/cachekeycomputer.py | |
parent | c859d70d86423a52bc7053abf64e9ca21f62a487 (diff) | |
download | morph-36100edc77e8245b080343e12f59c26e35d66f2e.tar.gz |
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
Diffstat (limited to 'morphlib/cachekeycomputer.py')
-rw-r--r-- | morphlib/cachekeycomputer.py | 8 |
1 files changed, 8 insertions, 0 deletions
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() |