Correctly handle a checksummed file that depends on a non-checksummed file.

We were rebuilding the checksummed file every time because redo-ifchange was
incorrectly assuming that a child's changed_runid that's greater than my
changed_runid means I'm dirty.  But if my checked_runid is >= the child's
checked_runid, then I'm clean, because my checksum didn't change.

Clear as mud?
This commit is contained in:
Avery Pennarun 2010-12-11 03:29:38 -08:00
commit 1355ade7c7
7 changed files with 21 additions and 7 deletions

View file

@ -38,7 +38,7 @@ def dirty_deps(f, depth, max_changed):
return True return True
elif mode == 'm': elif mode == 'm':
if dirty_deps(f2, depth = depth + ' ', if dirty_deps(f2, depth = depth + ' ',
max_changed = f.changed_runid): max_changed = max(f.changed_runid, f.checked_runid)):
debug('%s-- DIRTY (sub)\n' % depth) debug('%s-- DIRTY (sub)\n' % depth)
return True return True
if f.is_override: if f.is_override:

View file

@ -3,7 +3,7 @@
( (
echo ".timeout 5000" echo ".timeout 5000"
echo "pragma synchronous = off;" echo "pragma synchronous = off;"
echo "update Files set checked_runid=null, " \ echo "update Files set checked_runid=checked_runid-1, " \
" changed_runid=changed_runid-1, " \ " changed_runid=changed_runid-1, " \
" failed_runid=failed_runid-1;" " failed_runid=failed_runid-1;"
) | sqlite3 "$REDO_BASE/.redo/db.sqlite3" ) | sqlite3 "$REDO_BASE/.redo/db.sqlite3"

1
t/stamp/.gitignore vendored
View file

@ -2,3 +2,4 @@
/usestamp /usestamp
/stampy /stampy
/inp /inp
/bob

1
t/stamp/bob.do Normal file
View file

@ -0,0 +1 @@
echo $$

View file

@ -1 +1 @@
rm -f *.log usestamp stampy inp *~ .*~ rm -f *.log usestamp stampy inp bob *~ .*~

View file

@ -18,12 +18,23 @@ redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 41 [ "$(wc -l <stampy.log)" -eq 2 ] || exit 41
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42 [ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42
../flush-cache.sh
redo bob
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 43
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 44
../flush-cache.sh
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 45
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 46
../flush-cache.sh ../flush-cache.sh
echo two >inp echo two >inp
redo stampy redo stampy
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 51 [ "$(wc -l <stampy.log)" -eq 4 ] || exit 51
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 52 [ "$(wc -l <usestamp.log)" -eq 2 ] || exit 52
redo-ifchange usestamp redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 61 [ "$(wc -l <stampy.log)" -eq 4 ] || exit 61
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 62 [ "$(wc -l <usestamp.log)" -eq 3 ] || exit 62

View file

@ -1,3 +1,4 @@
echo $$ >>stampy.log echo $$ >>stampy.log
redo-ifchange inp bob
cat inp cat inp
redo-stamp <inp redo-stamp <inp