From e7f7119f2e663c6849f78871824c97388ea8964c Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 11 Dec 2010 05:43:02 -0800 Subject: [PATCH] If a checksummed file is deleted, we should still use redo-oob. We were giving up and rebuilding the toplevel object, which did eventually rebuild our checksummed file, but then the file turned out to be identical to what it was before, so that nobody *else* who depended on it ended up getting rebuilt. So the results were indeterminate. Now we treat it as if its dirtiness is unknown, so we build it using redo-oob before building any of its dependencies. --- redo-ifchange.py | 13 ++++++++++--- t/stamp/.gitignore | 1 + t/stamp/clean.do | 2 +- t/stamp/stamptest.do | 22 ++++++++++++++++++++-- t/stamp/usestamp2.do | 3 +++ 5 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 t/stamp/usestamp2.do diff --git a/redo-ifchange.py b/redo-ifchange.py index 63c2bc4..d178c71 100755 --- a/redo-ifchange.py +++ b/redo-ifchange.py @@ -28,9 +28,16 @@ def dirty_deps(f, depth, max_changed): if not f.stamp: debug('%s-- DIRTY (no stamp)\n' % depth) return DIRTY - if f.stamp != f.read_stamp(): - debug('%s-- DIRTY (mtime)\n' % depth) - return DIRTY + newstamp = f.read_stamp() + if f.stamp != newstamp: + if newstamp == state.STAMP_MISSING: + debug('%s-- DIRTY (missing)\n' % depth) + else: + debug('%s-- DIRTY (mtime)\n' % depth) + if f.csum: + return [f] + else: + return DIRTY must_build = [] for mode,f2 in f.deps(): diff --git a/t/stamp/.gitignore b/t/stamp/.gitignore index 4e5c0b5..ae5524f 100644 --- a/t/stamp/.gitignore +++ b/t/stamp/.gitignore @@ -3,3 +3,4 @@ /stampy /inp /bob +/usestamp2 diff --git a/t/stamp/clean.do b/t/stamp/clean.do index fac22fd..3bdd118 100644 --- a/t/stamp/clean.do +++ b/t/stamp/clean.do @@ -1 +1 @@ -rm -f *.log usestamp stampy inp bob *~ .*~ +rm -f *.log usestamp usestamp2 stampy inp bob *~ .*~ diff --git a/t/stamp/stamptest.do b/t/stamp/stamptest.do index d5f973b..8b98df0 100644 --- a/t/stamp/stamptest.do +++ b/t/stamp/stamptest.do @@ -1,10 +1,12 @@ -rm -f stampy usestamp stampy.log usestamp.log +rm -f stampy usestamp usestamp2 stampy.log usestamp.log usestamp2.log echo one >inp ../flush-cache.sh redo stampy [ "$(wc -l inp redo stampy [ "$(wc -l >usestamp2.log +cat stampy