/usr/ports symlink + make search

Roman Neuhauser neuhauser at chello.cz
Tue Jun 15 15:22:58 GMT 2004


# alsbergt at cs.huji.ac.il / 2004-06-15 17:23:13 +0300:
> On Tue, Jun 15, 2004 at 12:31:19PM +0200, Roman Neuhauser wrote:
> > What does make search print for you with this patch applied?
> > <snip />
> > +           print top; print there, exit; \
> 
> Which version of awk do you have there?  Here, with /usr/bin/awk = GNU
> Awk 3.0.6, "print there, exit" is an error and it complains.

    s/,/;/ sorry!
 
> If I change the comma (,) to a semicolon (;), though, I get:
> 
> $ make search name=foo 
> 0
> /r+d/ports
> /r+d/ports/

    Ok, so the problem is the plus sign. The sed was using BRE,
    awk does ERE, and the changed metacharacter syntax broke it for
    you.
    
    Does it work with this patch?

Index: Mk/bsd.port.subdir.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.54
diff -u -r1.54 bsd.port.subdir.mk
--- Mk/bsd.port.subdir.mk       10 Jun 2004 07:30:19 -0000      1.54
+++ Mk/bsd.port.subdir.mk       15 Jun 2004 15:20:31 -0000
@@ -349,7 +349,9 @@
            -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}"\
            -v display="$${display:-${PORTSEARCH_DISPLAY_FIELDS}}" \
        'BEGIN { \
-           sub(top, "${PORTSDIR}", there); \
+           if (substr(there, 1, length(top)) == top) \
+             there = "${PORTSDIR}" substr(there, 1 + length(top)); \
+           therelen = length(there); \
            IGNORECASE=icase; \
            keylen = length(key); keylim = keylim && keylen; \
            if (!keylim && keylen) \
@@ -377,7 +379,7 @@
            } \
          } \
          { \
-           if ($$2 !~ there) \
+           if (substr($$2, 1, therelen) != there) \
              next; \
            for (i in parms) \
              if ($$i !~ parms[i]) \

    it does seem to work here:

roman at isis /usr/ports 1040:1 > make search name=php-xd        
Port:   php-xdebug-1.3.0
Path:   /usr/ports/devel/php-xdebug
Info:   Xdebug extension for PHP
Maint:  rehsack at liwing.de
B-deps: apache-1.3.29_3 autoconf-2.53_1 automake-1.5,1 expat-1.95.7 libiconv-1.9.1_3 libtool-1.3.5_2 m4-1.4_1 mysql-client-4.0.18_1 php4-4.3.6
R-deps: apache-1.3.29_3 expat-1.95.7 libiconv-1.9.1_3 mysql-client-4.0.18_1 php4-4.3.6

roman at isis /usr/ports 1041:0 > pwd
/usr/ports
roman at isis /usr/ports 1042:0 > pwd -P
/usr/var/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