From 51e3a5f0e2af70df05d3a433112db054820c312a Mon Sep 17 00:00:00 2001 From: Richard Larkin Date: Fri, 25 Nov 2016 14:25:22 +0200 Subject: [PATCH] Prevent saving of state on corrupt download references #179 --- toolchain.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/toolchain.py b/toolchain.py index 57554c7..487ec42 100755 --- a/toolchain.py +++ b/toolchain.py @@ -578,7 +578,8 @@ class Recipe(object): value = self.ctx.state.get(key) if not value: value = self.get_archive_rootdir(self.archive_fn) - self.ctx.state[key] = value + if value is not None: + self.ctx.state[key] = value return value def execute(self): @@ -614,7 +615,9 @@ class Recipe(object): fn = self.archive_fn if not exists(fn): self.download_file(self.url.format(version=self.version), fn) - self.ctx.state[key] = self.get_archive_rootdir(self.archive_fn) + status = self.get_archive_rootdir(self.archive_fn) + if status is not None: + self.ctx.state[key] = status @cache_execution def extract(self):