Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Oct 2006 15:12:23 +0200 (CEST)
From:      Lars Engels <lars.engels@0x20.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/104161: Let 'make search' also search in /usr/ports/MOVED
Message-ID:  <200610081312.k98DCNLQ008912@bart.bsd-geek.de>
Resent-Message-ID: <200610081320.k98DKGn1019505@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         104161
>Category:       ports
>Synopsis:       Let 'make search' also search in /usr/ports/MOVED
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 08 13:20:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Lars Engels
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD bart.bsd-geek.de 7.0-CURRENT FreeBSD 7.0-CURRENT #11: Thu Oct 5 11:21:39 CEST 2006 lars@bart.bsd-geek.de:/usr/obj/usr/src/sys/BART i386


	
>Description:
When ports are moved, renamed or deleted, they're added to /usr/ports/MOVED.
Often they cannot be found with 'make search' afterwards.
The attached patch adds functionality to search in the MOVED file as well if you search for
'name=<name>'.
To prevent searching in MOVED, set PORTSEARCH_MOVED >= 0.

	
>How-To-Repeat:
	
>Fix:

	

--- search_moved.patch begins here ---
--- bsd.port.subdir.mk.orig	Sun Oct  8 01:18:03 2006
+++ bsd.port.subdir.mk	Sun Oct  8 14:59:24 2006
@@ -271,6 +271,8 @@
 .else
 INDEXFILE?=	INDEX
 .endif
+MOVEDDIR?=	${PORTSDIR}
+MOVEDFILE?=	MOVED
 
 HTMLIFY=	sed -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
 
@@ -331,6 +333,7 @@
 PORTSEARCH_KEYLIM?=0
 PORTSEARCH_XKEYLIM?=0
 PORTSEARCH_IGNORECASE?=1
+PORTSEARCH_MOVED?=1
 
 _PORTSEARCH=	\
 	here=${.CURDIR}; \
@@ -409,11 +412,11 @@
 	    split(display, d, /,[ \t]*/); \
 	    split(xdisplay, xd, /,[ \t]*/); \
 	    for (i in d) { \
-            toprint = 1;\
+            toprint = 1; \
 	      for (j in xd) { \
                 if (d[i] == xd[j] ) { \
                        toprint=0; \
-                       break;\
+                       break; \
                  }\
 	      } \
       	    if (toprint == 1 ) disp[fields[d[i]]] = 1; \
@@ -443,7 +446,31 @@
 	        printf("%s:\t%s\n", names[i], $$i); \
 	    print(""); \
 	  }' ${INDEXDIR}/${INDEXFILE}; \
-	fi
+	  if [ "$$name" -o "$$xname" ] && [ ${PORTSEARCH_MOVED} -gt 0 ]; \
+	  then \
+	    awk -F\| -v name="$$name"        -v xname="$$xname" \
+	        -v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \
+	    'BEGIN { \
+	        if (icase) { \
+	    	if (length(name))  name = tolower(name);  if (length(xname))  xname = tolower(xname); \
+	        } \
+	        fields["name"]  = 1;  names[1]  = "Port"; \
+	        fields["destination"]  = 2;  names[2]  = "Moved"; \
+	        fields["date"]  = 3;  names[3]  = "Date"; \
+	        fileds["reason"] = 4;  names[4] = "Reason"; \
+	     } \
+	    { \
+		oldname = $$1;  newname = $$2; \
+		sub(".*\/", "", oldname);  newname = sub(".*\/", "", newname); \
+	        if (((icase ? tolower(oldname) : oldname) ~ name) || ((icase ? tolower(newname) : newname) ~ name)) { \
+	    	    for (i = 1; i <= 4; i++) { \
+	    		printf("%s:\t%s\n", names[i], $$i); \
+	    	    } \
+	        print(""); \
+	        } \
+	    }' ${MOVEDDIR}/${MOVEDFILE}; \
+	  fi \
+	fi 
 
 search:
 	@${_PORTSEARCH}
--- search_moved.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



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