On Thu, Oct 05, 2006 at 02:32:03PM +0100, Florent Thoumie wrote: > On Thu, 2006-10-05 at 21:25 +0800, LI Xin wrote: > > Florent Thoumie wrote: > > > > I think teaching ${PORTSDIR}/Makefile about how to do 'make search=' on > > MOVED as well might be good idea, though :-) > > Maybe, I don't use 'make search'. Patches welcome, as usual :-)
I also prefer 'make quicksearch' ;-) Attached is a patch for Mk/bsd.port.subdir.mk that allows to 'make search' in MOVED as well (activated by default) if one uses 'name='. To disable searching in MOVED use 'make PORTSEARCH_MOVED=0 search'. Sample output: # make search name=ethereal Port: net/ethereal Moved: net/wireshark Date: 2006-07-17 Reason: Project name has changed Port: net/ethereal-lite Moved: net/wireshark-lite Date: 2006-07-17 Reason: Project name has changed [...] Any comments are welcome. -Lars
--- bsd.port.subdir.mk.orig Sun Oct 8 01:18:03 2006 +++ bsd.port.subdir.mk Sun Oct 8 04:21:28 2006 @@ -271,6 +271,8 @@ .else INDEXFILE?= INDEX .endif +MOVEDDIR?= ${PORTSDIR} +MOVEDFILE?= MOVED HTMLIFY= sed -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</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,29 @@ 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"; \ + } \ + { \ + if (((icase ? tolower($$1) : $$1) ~ name) || ((icase ? tolower($$2) : $$2) ~ name)) { \ + for (i = 1; i <= 4; i++) { \ + printf("%s:\t%s\n", names[i], $$i); \ + } \ + print(""); \ + } \ + }' ${MOVEDDIR}/${MOVEDFILE}; \ + fi \ + fi search: @${_PORTSEARCH}
pgpv6Gu3HnoPG.pgp
Description: PGP signature