From owner-freebsd-ports Wed May 10 12:15:14 2000 Delivered-To: freebsd-ports@freebsd.org Received: from andrsn.stanford.edu (andrsn.Stanford.EDU [171.66.112.163]) by hub.freebsd.org (Postfix) with ESMTP id 923EE37B6D5 for ; Wed, 10 May 2000 12:15:04 -0700 (PDT) (envelope-from andrsn@andrsn.stanford.edu) Received: from localhost (andrsn@localhost.stanford.edu [127.0.0.1]) by andrsn.stanford.edu (8.9.3/8.9.1) with ESMTP id MAA58232 for ; Wed, 10 May 2000 12:13:27 -0700 (PDT) Date: Wed, 10 May 2000 12:13:27 -0700 (PDT) From: Annelise Anderson To: freebsd-ports@freebsd.org Subject: "make search" problem (pending/18455) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org This send-pr also got misfiled, as admin rather than ports, so I'm forwarding this downloaded copy. Annelise Problem Report pending/18455 "make search" doesn't work when PORTSDIR isn't /usr/ports Confidential: no Severity: non-critical Priority: medium Responsible: gnats-admin@FreeBSD.org State: open Class: sw-bug Submitter-Id: current-users Arrival-Date: Mon May 08 14:00:01 PDT 2000 Last-Modified: never Originator: Annelise Anderson Release FreeBSD: 4.0-STABLE i386 Environment: Ports collection moved to /usr/local/ports and export PORTSDIR=/usr/local/port (zsh shell older version; I don't think that's creating the problem, but it mig ht be) Description: make search key= and make search name= don't work when /usr/local/port is the PORTSDIR (and so exported) make search doesn't work under circumstances described above. It did, however, work with $PORTSDIR as /usr/local/port when starting in /usr/ports (which I still had on the system in question), which seems to be consistent with what the makefile in /usr/local/ports/Mk actually does, i.e., the code becomes grep /usr/ports/ /usr/local/ports/INDEX | grep -i and so forth, which is fine from /usr/ports; but if starting in /usr/local/ports one gets grep /usr/local/ports/ /usr/local/ports/INDEX | grep -i and so forth, and that fails. How-To-Repeat cp -r /usr/ports /usr/local/ports export PORTSDIR=/usr/local/port cd /usr/local/ports make search key=dict (or whatever) OR make -n search key= Fix I changed /usr/local/ports/Mk/bsd.port.subdir.mk as follows, which seems to work in a changed PORTSDIR as well as /usr/ports; I'm not sure what else might not work as a result. [If life were this simple, life would already have been simplified?] --- bsd.port.subdir.mk.orig Thu Mar 23 04:29:52 2000 +++ bsd.port.subdir.mk Mon May 8 13:33:17 2000 @@ -242,14 +242,11 @@ search: ${PORTSDIR}/INDEX - @here=`pwd`; \ - cd ${PORTSDIR}; \ - top=`pwd`; \ - there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \ + @cd ${PORTSDIR}; \ if [ $$key ]; then \ - grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | awk -F\| '{ print f("Port:\t%s\nPath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps :\t%s\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ + grep -i "${key}" ${PORTSDIR}/INDEX | awk -F\| '{ printf("Port:\t%s\nP ath:\t%s\nInfo:\t%s\nMaint:\t%s\nIndex:\t%s\nB-deps:\t%s\nR-deps:\t%s\n\n", $$1 , $$2, $$4, $$6, $$7, $$8, $$9); }'; \ elif [ $$name ]; then \ - grep $$there ${PORTSDIR}/INDEX | grep -i "^[^|]*${name}[^|]*|" | 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\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ + grep -i "^[^|]*${name}[^|]*|" ${PORTSDIR}/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\n\n", $$1, $$2, $$4, $$6, $$7, $$8, $$9); }'; \ else \ echo "The search target requires a keyword parameter or name paramete r,"; \ echo "e.g.: \"make search key=somekeyword\""; \ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message