diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2017-07-21 16:18:33 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2017-07-26 10:49:02 +0100 |
commit | 2267d1e520dc290f8f91e8f823f9c1934a5a76d4 (patch) | |
tree | 501b384329b4e4fd2ef7086b9b37d4e5ed1c50af | |
parent | d30550048d53a06985cb3dffda7422813980de1f (diff) | |
download | buildstream-2267d1e520dc290f8f91e8f823f9c1934a5a76d4.tar.gz |
dpkg_build.py: Prevent cache-key changing mid-build
-rw-r--r-- | buildstream/plugins/elements/dpkg_build.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/buildstream/plugins/elements/dpkg_build.py b/buildstream/plugins/elements/dpkg_build.py index ecbecc256..d7e90a242 100644 --- a/buildstream/plugins/elements/dpkg_build.py +++ b/buildstream/plugins/elements/dpkg_build.py @@ -125,8 +125,23 @@ class DpkgElement(BuildElement): with open(controlpath) as f: return re.findall(r"Package:\s*(.+)\n", f.read()) + def configure(self, node): + # __original_commands is needed for cache-key generation, + # as commands can be altered during builds and invalidate the key + super().configure(node) + self.__original_commands = dict(self.commands) + + def get_unique_key(self): + key = super().get_unique_key() + # Overriding because we change self.commands mid-build, making it + # unsuitable to be included in the cache key. + for domain, cmds in self.__original_commands.items(): + key[domain] = cmds + + return key + def assemble(self, sandbox): - # Replace %{packages} if no variable was set + # Replace <PACKAGES> if no variable was set packages = self._get_packages(sandbox) self.commands = dict([ (group, [ |