Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 May 2000 12:13:27 -0700 (PDT)
From:      Annelise Anderson <andrsn@andrsn.stanford.edu>
To:        freebsd-ports@freebsd.org
Subject:   "make search" problem (pending/18455)
Message-ID:  <Pine.BSF.4.10.10005101200420.58158-100000@andrsn.stanford.edu>

next in thread | raw e-mail | index | archive | help
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 <andrsn@andrsn.stanford.edu>
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=<something> and make search name=<somename> 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=<something>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10005101200420.58158-100000>