Half-support for using file checksums instead of stamps.

A new redo-stamp program takes whatever you give it as stdin and uses it to
calculate a checksum for the current target.  If that checksum is the same
as last time, then we consider the target to be unchanged, and we set
checked_runid and stamp, but leave changed_runid alone.  That will make
future callers of redo-ifchange see this target as unmodified.

However, this is only "half" support because by the time we run the .do
script that calls redo-stamp, it's too late; the caller is a dependant of
the stamped program, which is already being rebuilt, even if redo-stamp
turns out to say that this target is unchanged.

The other half is coming up.
This commit is contained in:
Avery Pennarun 2010-12-11 02:17:51 -08:00
commit 22617d335c
12 changed files with 117 additions and 16 deletions

View file

@ -1,5 +1,5 @@
redo example/clean curse/clean deps/clean "space dir/clean"
rm -f c c.c c.c.c c.c.c.b c.c.c.b.b d mode1 makedir.log chdir1 \
redo example/clean curse/clean deps/clean "space dir/clean" stamp/clean
rm -f c c.c c.c.c c.c.c.b c.c.c.b.b d mode1 makedir.log chdir1 deltest2 \
hello [by]ellow *.o *~ .*~ CC LD passfail silence silence.do \
touch1 touch1.do
rm -rf makedir

4
t/stamp/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/*.log
/usestamp
/stampy
/inp

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

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

29
t/stamp/stamptest.do Normal file
View file

@ -0,0 +1,29 @@
rm -f stampy usestamp stampy.log usestamp.log
echo one >inp
../flush-cache.sh
redo stampy
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 11
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 21
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 12
../flush-cache.sh
redo stampy
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 31
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 32
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 41
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42
../flush-cache.sh
echo two >inp
redo stampy
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 51
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 52
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 61
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 62

3
t/stamp/stampy.do Normal file
View file

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

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

@ -0,0 +1 @@
redo stamptest

3
t/stamp/usestamp.do Normal file
View file

@ -0,0 +1,3 @@
redo-ifchange stampy
echo $$ >>usestamp.log
cat stampy

View file

@ -2,4 +2,4 @@ redo-ifchange all
./hello >&2
redo deltest deltest2 test.args test2.args passfailtest chdirtest \
curse/test deps/test "space dir/test" modetest makedir2 \
silencetest touchtest
silencetest touchtest stamp/test