/usr/ports symlink + make search

Roman Neuhauser neuhauser at chello.cz
Tue Jun 15 10:31:32 GMT 2004


# alsbergt at cs.huji.ac.il / 2004-06-15 11:32:16 +0300:
> With the new ports/Mk/bsd.port.subdir.mk, make search (seems like a
> quite revamped awk script, relative to the old one) checks the second
> field of INDEX to be the same as `pwd` (eventually, through awk -v
> there=$here, here=`pwd`)...

> My solution to it was to remove that check from the awk script:
> 
> --- Mk/bsd.port.subdir.mk.orig     Thu Jun 10 10:30:19 2004
> +++ Mk/bsd.port.subdir.mk  Tue Jun 15 11:30:45 2004
> @@ -377,8 +377,6 @@
>             } \
>           } \
>           { \
> -           if ($$2 !~ there) \
> -             next; \
>             for (i in parms) \
>               if ($$i !~ parms[i]) \
>                 next; \
> 
> I'm not sure why this check is necessary (it's all in ports, after
> all), but anyway it causes some trouble and might need to be refined.

Is that really a regression? It seems to work here, and the check was
certainly present in the previous version (although not in the same form,
see below):

-   @here=`pwd`; \
+   @here=${.CURDIR}; \
    cd ${PORTSDIR}; \
-   top=`pwd -P`; \
-   there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \
-   if [ -n "$$key" ]; then \
-     grep $$there ${PORTSDIR}/${INDEXFILE} | grep -i "${key}" ...
-   elif [ $$name ]; then \
-     grep $$there ${PORTSDIR}/${INDEXFILE} | grep -i "^[^|]*$ ...

+   awk -F\| -v there="$$here/" -v top="$$(pwd -P)" \

+   'BEGIN { \
+       sub(top, "${PORTSDIR}", there); \


What does make search print for you with this patch applied?

--- Mk/bsd.port.subdir.mk       10 Jun 2004 07:30:19 -0000      1.54
+++ Mk/bsd.port.subdir.mk       15 Jun 2004 10:29:07 -0000
@@ -349,7 +349,8 @@
            -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}"\
            -v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
        'BEGIN { \
-           sub(top, "${PORTSDIR}", there); \
+           print sub(top, "${PORTSDIR}", there); \
+           print top; print there, exit; \
            IGNORECASE=icase; \
            keylen = length(key); keylim = keylim && keylen; \
            if (!keylim && keylen) \

I get this:

roman at smradoch /usr/ports 1011:0 > make search name=\^p5-
1
/usr/ports-real
/usr/ports/

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html


More information about the freebsd-ports mailing list