From 642d60a7c97fb7c8d192de5ce403607f6115f478 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Mon, 17 Jan 2011 23:57:20 -0800 Subject: [PATCH] state.File.set_static(): barf if we set_static() a nonexistent file. If that ever happens, we probably got our paths mangled (like in the previous commit) so we should die right away rather than allow weird things to happen later. --- state.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/state.py b/state.py index 7798c70..fe814e3 100644 --- a/state.py +++ b/state.py @@ -216,7 +216,7 @@ class File(object): self.is_generated = True def set_static(self): - self.update_stamp() + self.update_stamp(must_exist=True) self.is_override = False self.is_generated = False @@ -224,8 +224,10 @@ class File(object): self.update_stamp() self.is_override = True - def update_stamp(self): + def update_stamp(self, must_exist=False): newstamp = self.read_stamp() + if must_exist and newstamp == STAMP_MISSING: + raise Exception("%r does not exist" % self.name) if newstamp != self.stamp: debug2("STAMP: %s: %r -> %r\n" % (self.name, self.stamp, newstamp)) self.stamp = newstamp