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.
This commit is contained in:
Avery Pennarun 2010-11-21 05:25:47 -08:00
commit d6c5c06364

View file

@ -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 = '')