summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-03-22 20:36:55 +0000
committerjoe <joe@FreeBSD.org>2000-03-22 20:36:55 +0000
commit17e258716735a734ac78453f933869cf17475890 (patch)
tree8c009969cb6751d92bad3c9ab5d7c6a5a025f131
parent41468e9c93b33035d055c0a7b9d4bcba799b7b8c (diff)
downloadFreeBSD-ports-17e258716735a734ac78453f933869cf17475890.zip
FreeBSD-ports-17e258716735a734ac78453f933869cf17475890.tar.gz
Additions to the 'make search' mechanism.
* You can now 'make search' from a ports subdirectory. This will will restrict the search to ports within this subdirectory. * Added an additional search option to search just the port names, e.g. 'make search name=foo' will only return ports that have 'foo' in their name. Approved by: asami
-rw-r--r--Makefile8
-rw-r--r--Mk/bsd.port.subdir.mk21
2 files changed, 21 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 9a151e0c..5748604 100644
--- a/Makefile
+++ b/Makefile
@@ -70,14 +70,6 @@ ${.CURDIR}/INDEX:
print-index: ${.CURDIR}/INDEX
@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); }' < ${.CURDIR}/INDEX
-search: ${.CURDIR}/INDEX
-.if !defined(key)
- @echo "The search target requires a keyword parameter,"
- @echo "e.g.: \"make search key=somekeyword\""
-.else
- @grep -i "${key}" ${.CURDIR}/INDEX | 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); }'
-.endif
-
parallel: ${.CURDIR}/INDEX
.for dir in ${SUBDIR}
@echo "all:: ${dir}-all"
diff --git a/Mk/bsd.port.subdir.mk b/Mk/bsd.port.subdir.mk
index a84a020..8887b31 100644
--- a/Mk/bsd.port.subdir.mk
+++ b/Mk/bsd.port.subdir.mk
@@ -34,6 +34,9 @@
# depend, depends, describe, extract, fetch, fetch-list, ignorelist,
# install, package, package-loop, readmes, realinstall, reinstall, tags
#
+# search:
+# Search for ports using either 'make search key=<keyword>'
+# or 'make search name=<keyword>'.
.MAIN: all
@@ -235,3 +238,21 @@ README.html:
OSVERSION="${OSVERSION:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}" \
PORTOBJFORMAT="${PORTOBJFORMAT:S/"/"'"'"/g:S/\$/\$\$/g:S/\\/\\\\/g}"
.endif
+
+# Ports may be symlinked to somewhere else. Convert the directory path
+# back into one that lives within the ports collection.
+PORTSACTUALDIR!=perl -e '($$subdir = "${.CURDIR}") =~ s!.*/([^/]+)!$$1/!; \
+ print "${PORTSACTUALDIR}/"; print $$subdir unless "${PORTSTOP}";'
+search: ${PORTSDIR}/INDEX
+.if !defined(key) && !defined(name)
+ @echo "The search target requires a keyword parameter or name parameter,"
+ @echo "e.g.: \"make search key=somekeyword\""
+ @echo "or \"make search name=somekeyword\""
+.else
+.if defined(key)
+ @grep ${PORTSACTUALDIR} ${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); }'
+.endif
+.if defined(name)
+ @grep ${PORTSACTUALDIR} ${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); }'
+.endif
+.endif
OpenPOWER on IntegriCloud