Subject: Proposed fix for fetch-list recursion
To: None <tech-pkg@NetBSD.ORG>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-pkg
Date: 02/22/2002 05:59:07
Before I say anything else, observe:
fredb@tautology-> pwd
/s/pkgsrc/x11/gnome
fredb@tautology-> du -sk /tmp/distfiles
1 /tmp/distfiles
fredb@tautology-> time make fetch-list DISTDIR=/tmp/distfiles | wc
1972 5611 68799
445.32s real 53.85s user 42.16s system
Try that on 1.5.2 tagged pkgsrc! The previous time I tried that
myself, it took several *days*. I calculate that this is therefore an
improvement on the order of 100,000%! Forget about "make fetch-list"
at the top level with an old pkgsrc, which now takes, with this
change, about half an hour on tautology (K6-2 450).
The entire patch may be viewed at
ftp://ftp.netbsd.org/pub/NetBSD/misc/fredb/fetch-list.diff
I'll commit Monday, unless someone raises an objection before then.
There's a couple of things in there that are worthy of note. I've
introduced a few targets that do recursion properly. I expect they
will be useful for fixing up "clean-depends" and "readme", but that's
for another day.
I also did something different in the pre-amble for those targets.
They're declared ".PHONY", to cut down on a few stat()'s, but also,
they're bracketed with ".if make()", rather than ".if target()". The
point of that is, since they're intended to be _utility_ targets, that
is, invoked as recursive "make"'s and not as part of the dependency
graph, they don't need to be in the dependency graph, unless they are,
in fact, invoked on the command line. Observe that the definition of
the "awk" macro, too, is skipped for _normal_ "make"'s. A lot of
targets in bsd.pkg.mk could profitably be treated the same way, but
we'll leave that to another day as well.
Frederick