Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jun 2004 17:22:55 +0200
From:      Roman Neuhauser <neuhauser@chello.cz>
To:        Tom Alsberg <alsbergt@cs.huji.ac.il>
Cc:        FreeBSD Ports List <freebsd-ports@freebsd.org>
Subject:   Re: /usr/ports symlink + make search
Message-ID:  <20040615152255.GA2519@isis.wad.cz>
In-Reply-To: <20040615142313.GA26302@cs.huji.ac.il>
References:  <20040615083216.GA24712@cs.huji.ac.il> <20040615103119.GA1704@isis.wad.cz> <20040615142313.GA26302@cs.huji.ac.il>

next in thread | previous in thread | raw e-mail | index | archive | help
# alsbergt@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@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@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@isis /usr/ports 1041:0 > pwd
/usr/ports
roman@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040615152255.GA2519>