[Cook] Fingerprinting recipes
Peter Miller
millerp at canb.auug.org.au
Sun Jul 20 21:45:37 EST 2003
On Mon, 2003-06-16 at 17:08, Dirk Heinrichs wrote:
> Am Freitag, 13. Juni 2003 16:16 schrieb ext Brendan J Simon:
> > You could put each recipe in it's own file and inlude the recipe files
> > in the master cookbook. Your dependencies will then include this recipe
> > file.
> A recipe can change without editing it (i.e. implizit recipe using a target
> dependant variable). So listing the recipe file as dependency doesn't help.
It is possible to have the ingredients of a recipe fingerprinted, so the
recipe is re-run if the ingredients change, even if everything else is
up-to-date. This is useful for libraries (usually when the ingredients
are reduced).
target: ingredient
set ingredients-fingerprint
{
blah blah;
}
Fingerprinting the recipe itself is much harder. Cook compiles recipe
bodies into byte-code. Fingerprinting the byte-code is simple enough,
but putting the recipe itself into an included file and make it depend
on that file is easier, and requires no changes to Cook.
target: ingredient [__FILE__]
set ingredients-fingerprint
{
blah blah;
}
I often use recipes like
lib%.a: [%_obj]
set unlink ingredients-fingerprint
{
ar cq [target] [need];
}
which a re-run if the list of objects changes, because the list of
ingredients is known at the end of graph-building, so the ingredients
fingerprint is known at graph-walking time.
Cook makes all the power of a 3GL available in recipe bodies, not just
simple command execution. What you asked for, to fingerprint the recipe
*after* all patterns and variables are expanded, isn't available to cook
until *after* the byte-code has been executed. To fingerprint at this
level would require redesign of Cook *and* need more memory to remember
the dependency graph. It also changes a number of order-of-evaluation
semantics, which could result in some users' cookbooks no longer
working. For example the [collect] and [execute] functions mean that
you can't evaluate the recipe bodies after graph building but before
graph walking, because the files they use may not exist yet *and* you
need them in the fingerprint, too.
--
Regards
Peter Miller <millerp at canb.auug.org.au>
/\/\* http://www.canb.auug.org.au/~millerp/
PGP public key ID: 1024D/D0EDB64D
fingerprint = AD0A C5DF C426 4F03 5D53 2BDB 18D8 A4E2 D0ED B64D
See http://www.keyserver.net or any PGP keyserver for public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20030720/14b9e366/attachment.pgp>
More information about the Cook-users
mailing list