From 1355ade7c7d8e4282cea3cfcfb397b007c9d458f Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Sat, 11 Dec 2010 03:29:38 -0800 Subject: [PATCH] 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? --- redo-ifchange.py | 2 +- t/flush-cache.sh | 2 +- t/stamp/.gitignore | 1 + t/stamp/bob.do | 1 + t/stamp/clean.do | 2 +- t/stamp/stamptest.do | 19 +++++++++++++++---- t/stamp/stampy.do | 1 + 7 files changed, 21 insertions(+), 7 deletions(-) create mode 100644 t/stamp/bob.do diff --git a/redo-ifchange.py b/redo-ifchange.py index e30213a..b0524c2 100755 --- a/redo-ifchange.py +++ b/redo-ifchange.py @@ -38,7 +38,7 @@ def dirty_deps(f, depth, max_changed): return True elif mode == 'm': 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) return True if f.is_override: diff --git a/t/flush-cache.sh b/t/flush-cache.sh index 4a28210..253b43d 100755 --- a/t/flush-cache.sh +++ b/t/flush-cache.sh @@ -3,7 +3,7 @@ ( echo ".timeout 5000" 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, " \ " failed_runid=failed_runid-1;" ) | sqlite3 "$REDO_BASE/.redo/db.sqlite3" diff --git a/t/stamp/.gitignore b/t/stamp/.gitignore index a3a43ae..4e5c0b5 100644 --- a/t/stamp/.gitignore +++ b/t/stamp/.gitignore @@ -2,3 +2,4 @@ /usestamp /stampy /inp +/bob diff --git a/t/stamp/bob.do b/t/stamp/bob.do new file mode 100644 index 0000000..5c73747 --- /dev/null +++ b/t/stamp/bob.do @@ -0,0 +1 @@ +echo $$ diff --git a/t/stamp/clean.do b/t/stamp/clean.do index db9d83e..fac22fd 100644 --- a/t/stamp/clean.do +++ b/t/stamp/clean.do @@ -1 +1 @@ -rm -f *.log usestamp stampy inp *~ .*~ +rm -f *.log usestamp stampy inp bob *~ .*~ diff --git a/t/stamp/stamptest.do b/t/stamp/stamptest.do index db3f397..808eceb 100644 --- a/t/stamp/stamptest.do +++ b/t/stamp/stamptest.do @@ -18,12 +18,23 @@ redo-ifchange usestamp [ "$(wc -l inp redo stampy -[ "$(wc -l >stampy.log +redo-ifchange inp bob cat inp redo-stamp