From d6c5c063647c2ac279932366976518b0dde62f31 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sun, 21 Nov 2010 05:25:47 -0800 Subject: [PATCH] redo-ifchange: unstamp() was in the wrong spot, causing unnecessary rebuilds. dirty_deps() changed its meaning now that we also have to check state.isbuilt(). Now, just because dirty_deps() returns true doesn't mean that the file should be unstamped (which forces a rebuild); this might have happened because of state.isbuilt, which means someone already *did* do a rebuild. If we get past state.isbuilt() and into looking at the children, however, and one of the children is dirty, then we should definitely unstamp the current target. --- redo-ifchange.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/redo-ifchange.py b/redo-ifchange.py index 62203b8..2d4b207 100755 --- a/redo-ifchange.py +++ b/redo-ifchange.py @@ -4,7 +4,7 @@ import vars, state, builder from helpers import debug, err, mkdirp, unlink -def _dirty_deps(t, depth): +def dirty_deps(t, depth): debug('%s?%s\n' % (depth, t)) if state.isbuilt(t): debug('%s-- DIRTY (built)\n' % depth) @@ -35,18 +35,12 @@ def _dirty_deps(t, depth): elif mode == 'm': if dirty_deps(os.path.join(vars.BASE, name), depth + ' '): debug('%s-- DIRTY (sub)\n' % depth) + state.unstamp(t) # optimization for future callers return True state.mark(t) return False -def dirty_deps(t, depth): - if _dirty_deps(t, depth): - state.unstamp(t) - return True - return False - - def should_build(t): return not state.isbuilt(t) and dirty_deps(t, depth = '')