Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2002 18:59:50 +0200 (CEST)
From:      Roman Neuhauser <roman@bellavista.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/40699: allow exclude patterns in `make search`
Message-ID:  <20020717165950.9FE3A1AD@freepuppy.bellavista.cz>

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

>Number:         40699
>Category:       ports
>Synopsis:       allow exclude patterns in `make search`
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 17 10:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Roman Neuhauser
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD freepuppy.bellavista.cz 4.6-STABLE FreeBSD 4.6-STABLE #0: Sat Jul 13 08:40:44 CEST 2002 roman@freepuppy.bellavista.cz:/usr/obj/usr/src/sys/FREEPUPPY2_3 i386
>Description:
	I often need to be able to exclude certain patterns from the
    returned results of make search in /usr/ports. Piping it through
    grep -v does not help, because of the output formatting.

    This patch adds "excl" argument to the search target.

>How-To-Repeat:
	
>Fix:

	
--- bsd.port.subdir.mk.orig	Wed Jul 17 17:54:39 2002
+++ bsd.port.subdir.mk	Wed Jul 17 18:37:21 2002
@@ -37,6 +37,9 @@
 #	search:
 #		Search for ports using either 'make search key=<keyword>'
 #		or 'make search name=<keyword>'.
+#		You can exclude ports with 'excl=<keyword>', i. e.
+#		'make search name=<keyword> excl=<keyword>' or
+#		'make search key=<keyword> excl=<keyword>'.
 
 
 .MAIN: all
@@ -255,9 +258,17 @@
 	top=`pwd`; \
 	there=`echo "$$here/" | sed s%$$top%${PORTSDIR}%`; \
 	if [ -n "$$key" ]; then \
-	  grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | 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); }'; \
+	  if [ -n "$$excl" ]; then \
+	    grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | grep -v "${excl}" | 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 \
+	    grep $$there ${PORTSDIR}/INDEX | grep -i "${key}" | 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); }'; \
+	  fi; \
 	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); }'; \
+	  if [ -n "$$excl" ]; then \
+	    grep $$there ${PORTSDIR}/INDEX | grep -i "^[^|]*${name}[^|]*|" | grep -v "${excl}" | 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 \
+	    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); }'; \
+	  fi; \
 	else \
 	  echo "The search target requires a keyword parameter or name parameter,"; \
 	  echo "e.g.: \"make search key=somekeyword\""; \


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

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?20020717165950.9FE3A1AD>