[Cook] (ingredients-)fingerprint question.

dwark pieter at dwark.nl
Sun Nov 15 11:35:30 EST 2009


Hi List,

I am new to cook and I'm trying to create a recipe that will
create a summary out of a changing set of files.  The summary
should be rebuilt whenever a file is added/removed or updated
(i.e. contents changed).

The combination of fingerprints and ingredients-fingerprint
looks to be a perfect match and indeed works largely as advertised.
Except for when the set of input files grows from 1 to 2 files,
for the first time.

It looks like the ingredients-fingerprint is not taken when
the target is being built for the first time. The second
time around, cook can't see if the list has changed.

Another thing is that fingerprinting the target itself, seems
to rejuvenate the target file to an age younger than it should
be (in the example below, summ should not be younger than 2.txt
during the second run).

Am I missing something, like an additional flag or something?  

The current workaround is to force the recipe when there are 
only 2 input files.

Any hints/pointers would be appreciated.

Thanks,

-- 
pieter


The recipe:

set fingerprint;
summ : [glob "*.txt"]
    set ingredients-fingerprint
{
    cat [need] > [target];
}


# At the start we have only .cookrc (as shown above).

ls -lpah --time-style=+%s
total 52
drwxr-xr-x  2 pdh pdh 16384 1258243512 ./
drwxr-xr-x 12 pdh pdh 20480 1258204203 ../
-rw-r--r--  1 pdh pdh   102 1258198033 .cookrc


# create the first (input) file.

echo 1 > 1.txt

cook
/* .cookrc.list, /home/pdh/dev/buildtools/cook, Sun Nov 15 01:05 2009 */
cook: cat 1.txt > summ

ls -ltc --time-style=+%s
total 8
-rw-r--r-- 1 pdh pdh 2 1258243531 summ
-rw-r--r-- 1 pdh pdh 2 1258243531 1.txt


cat .cook.fp:
"1.txt" = { 1258243531
".4CLFTK5xPYw5FeI8bG8u8J0LCIjs0NLTho0SpjIrGdJ5Keipp8iX88ICq0EVZ3R0ntqF40NdtwQ" }


# summ is not fingerprinted (no need)
# but ingredients-list is not fingerprinted either.

# now the second run
# create the second input file

echo 2 > 2.txt
cook

/* .cookrc.list, /home/pdh/dev/buildtools/cook, Sun Nov 15 01:05 2009 */
cook: the "summ" file is already up to date, no action required

ls -ltc --time-style=+%s
total 12
-rw-r--r-- 1 pdh pdh 2 1258243533 2.txt
-rw-r--r-- 1 pdh pdh 2 1258243531 summ
-rw-r--r-- 1 pdh pdh 2 1258243531 1.txt

cat .cook.fp
"1.txt" = { 1258243531
".4CLFTK5xPYw5FeI8bG8u8J0LCIjs0NLTho0SpjIrGdJ5Keipp8iX88ICq0EVZ3R0ntqF40NdtwQ" }
"2.txt" = { 1258243533
".:EEaxKnhRJWpD49ubks2Sy0Qu0Kh03LT800DElUiSBI72h6gdyKVBLJH80voXgX0LEhdl0PJiD4" }
"summ" = { 1258243534 1258243534 1258243531
".4CLFTK5xPYw5FeI8bG8u8J0LCIjs0NLTho0SpjIrGdJ5Keipp8iX88ICq0EVZ3R0ntqF40NdtwQ"
"DqFpFO17Df1sv18e9L2n3J80GWFJN0fmq2P02pgm1bUsyh.IYqb4k8u9Qz0X5zw40usnhH030g3M" }











More information about the Cook-users mailing list