diff options
author | dmcmahill <dmcmahill@pkgsrc.org> | 2003-07-23 09:41:23 +0000 |
---|---|---|
committer | dmcmahill <dmcmahill@pkgsrc.org> | 2003-07-23 09:41:23 +0000 |
commit | 28fd31fa83171df72b457bd86b86fc5dd1d39b08 (patch) | |
tree | b87d783cb2dda0050f33813665088c4d11f50b76 /Makefile | |
parent | 3cd568e4b73e2ec89310d95cb183c830be148ca9 (diff) | |
download | pkgsrc-28fd31fa83171df72b457bd86b86fc5dd1d39b08.tar.gz |
rework the INDEX file generation. The new approach speeds up things by
several orders of magnitude and 'make index' now takes 30 minutes or so
instead of several days on my test machine. The approach now is to take
one pass through every package and extract some key information including
the explicitly listed dependencies. After the data is extracted, the
dependencies are flattened in one step which avoids the extremely
inefficient recursive make that was previously used.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 48 |
1 files changed, 41 insertions, 7 deletions
@@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.55 2003/06/30 22:05:11 hubertf Exp $ +# $NetBSD: Makefile,v 1.56 2003/07/23 09:41:23 dmcmahill Exp $ # .include "mk/bsd.prefs.mk" @@ -101,14 +101,48 @@ README.html: .PRECIOUS _PKGSRCDIR=${.CURDIR} .endif -index: - @${RM} -f ${.CURDIR}/INDEX - @${MAKE} ${.CURDIR}/INDEX +.PHONY: index +index: ${.CURDIR}/INDEX ${.CURDIR}/INDEX: - @${ECHO} -n "Generating INDEX - please wait.." - @${MAKE} describe ECHO_MSG="${ECHO} > /dev/null" > ${.CURDIR}/INDEX - @${ECHO} " Done." + @${RM} -f ${.CURDIR}/DEPENDSDB + @${ECHO_MSG} "Extracting complete dependency database. This may take a while..." + @DB=${.CURDIR}/DEPENDSDB ; \ + PKGSRCDIR=${.CURDIR} ; \ + npkg=1; \ + ${RM} -fr $$DB ; \ + list=`${GREP} '^[[:space:]]*'SUBDIR */Makefile | sed 's,/Makefile.*=[[:space:]]*,/,'` ; \ + for pkgdir in $$list ; do \ + if [ ! -d $$pkgdir ]; then \ + echo " " ; \ + echo "WARNING: the package directory $pkgdir is listed in" > /dev/stderr ; \ + echo $pkgdir | sed 's;/.*;/Makefile;g' > /dev/stderr ; \ + echo "but the directory does not exist. Please fix this!" > /dev/stderr ; \ + else \ + cd $$pkgdir ; \ + l=`${MAKE} print-summary-data` ; \ + if [ $$? != 0 ]; then \ + echo "WARNING (printdepends): the package in $$pkgdir had problem with" \ + > /dev/stderr ; \ + echo " ${MAKE} print-summary-data" > /dev/stderr ; \ + echo " database information for this package" > /dev/stderr ; \ + echo " will be dropped." > /dev/stderr ; \ + ${MAKE} print-summary-data 2>&1 > /dev/stderr ; \ + else \ + echo "$$l" >> $$DB ; \ + fi ; \ + fi ; \ + echo -n "." ; \ + if [ `${EXPR} $$npkg % 100 = 0` -eq 1 ]; then \ + echo " " ; \ + echo "$$npkg" ; \ + fi ; \ + npkg=`${EXPR} $$npkg + 1` ; \ + cd $$PKGSRCDIR ; \ + done + @${RM} -f ${.CURDIR}/INDEX + @${AWK} -f ./mk/scripts/genindex.awk PKGSRCDIR=${.CURDIR} SORT=${SORT} ${.CURDIR}/DEPENDSDB + @${RM} -f ${.CURDIR}/DEPENDSDB print-index: ${.CURDIR}/INDEX @${AWK} -F\| '{ printf("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\nArch:\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9, $$10); }' < ${.CURDIR}/INDEX |