Subject: pkg/35266: 'make search key=' is broken
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <cheusov@tut.by>
List: pkgsrc-bugs
Date: 12/17/2006 10:20:00
>Number:         35266
>Category:       pkg
>Synopsis:       'make search key=<keyword>' is broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 17 10:20:00 +0000 2006
>Originator:     cheusov@tut.by
>Release:        NetBSD 3.1.0_PATCH
>Organization:
Best regards, Aleksey Cheusov.
>Environment:
System: NetBSD chen.chizhovka.net 3.1.0_PATCH NetBSD 3.1.0_PATCH (GENERIC) #4: Sun Nov 5 01:36:02 EET 2006 cheusov@chen.chizhovka.net:/srv/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
make search key=<keyword>
functionality (described in pkgsrc.txt) is completely broken,
i.e. each time you type this command
from pkgsrc root directory INDEX file is always rebuilt,
and this takes looooong time. This is because
.PHONY: ./PKGDB
./INDEX : ./PKGDB
   ...
   rm ./PKGDB
rules in Makefile

>How-To-Repeat:
make search key=word
make search key=word
>Fix:
The following patch fixes the problem.
P.S.
If you want to force INDEX file rebuilding, IMHO it makes sense to
implement new target 'reindex'.

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/Makefile,v
retrieving revision 1.77
diff -u -r1.77 Makefile
--- Makefile	2 Jul 2006 12:29:22 -0000	1.77
+++ Makefile	17 Dec 2006 10:15:12 -0000
@@ -100,7 +100,6 @@
 .include "${.CURDIR}/mk/bulk/bsd.bulk-pkg.mk"
 .endif
 
-.PHONY: ${.CURDIR}/PKGDB
 ${.CURDIR}/PKGDB:
 	@${RM} -f ${.CURDIR}/PKGDB
 	@${ECHO_MSG} "Extracting complete dependency database.  This may take a while..."
@@ -143,7 +142,6 @@
 ${.CURDIR}/INDEX: ${.CURDIR}/PKGDB
 	@${RM} -f ${.CURDIR}/INDEX
 	@${AWK} -f ./mk/scripts/genindex.awk PKGSRCDIR=${.CURDIR} SORT=${SORT} ${.CURDIR}/PKGDB
-	@${RM} -f ${.CURDIR}/PKGDB
 
 print-index: ${.CURDIR}/INDEX
 	@${AWK} -F\| '{ printf("Pkg:\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