From owner-freebsd-ports-bugs@FreeBSD.ORG Sat Aug 20 19:50:10 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD9771065675 for ; Sat, 20 Aug 2011 19:50:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 936718FC1D for ; Sat, 20 Aug 2011 19:50:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KJoAnu038047 for ; Sat, 20 Aug 2011 19:50:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7KJoAJP038046; Sat, 20 Aug 2011 19:50:10 GMT (envelope-from gnats) Resent-Date: Sat, 20 Aug 2011 19:50:10 GMT Resent-Message-Id: <201108201950.p7KJoAJP038046@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Chris Rees Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C9931065670; Sat, 20 Aug 2011 19:50:00 +0000 (UTC) (envelope-from utisoft@hotmail.com) Received: from blu0-omc1-s12.blu0.hotmail.com (blu0-omc1-s12.blu0.hotmail.com [65.55.116.23]) by mx1.freebsd.org (Postfix) with ESMTP id 19D788FC15; Sat, 20 Aug 2011 19:49:59 +0000 (UTC) Received: from BLU0-SMTP70 ([65.55.116.8]) by blu0-omc1-s12.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 20 Aug 2011 12:49:59 -0700 Received: from zeus.bayofrum.net ([90.216.242.219]) by BLU0-SMTP70.phx.gbl over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sat, 20 Aug 2011 12:49:58 -0700 Received: from zeus.bayofrum.net (crees@localhost [127.0.0.1]) by zeus.bayofrum.net (8.14.4/8.14.4) with ESMTP id p7KJnc01016749 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Sat, 20 Aug 2011 20:49:38 +0100 (BST) (envelope-from crees@zeus.bayofrum.net) Received: (from crees@localhost) by zeus.bayofrum.net (8.14.4/8.14.4/Submit) id p7KJncv5016748; Sat, 20 Aug 2011 20:49:38 +0100 (BST) (envelope-from crees) Message-Id: Date: Sat, 20 Aug 2011 20:49:38 +0100 From: Chris Rees Sender: To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: cperciva@FreeBSD.org Subject: ports/159946: [PATCH] [bsd.port.mk] Add support for make search license= X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Chris Rees List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 19:50:10 -0000 >Number: 159946 >Category: ports >Synopsis: [PATCH] [bsd.port.mk] Add support for make search license= >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: Sat Aug 20 19:50:10 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Chris Rees >Release: FreeBSD 8.2-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD zeus.bayofrum.net 8.2-RELEASE-p1 FreeBSD 8.2-RELEASE-p1 #0: Sat Apr 30 15:09:06 BST 2011 root@zeus.bayofrum.net:/usr/obj/usr/src/sys/ZEUS i386 >Description: It has been suggested recently [1] that we should be able to search by license for ports -- I took this task on as I was curious about delphij's suggestion of modifying INDEX. The code has added a field at the end of INDEX (so unless programs are stupid and backtrack from the end nothing should break), and to my (pleasant) surprise it actually works: [crees@zeus]/usr/ports% make search license=EULA | grep '^Path:' | cut -d ' ' -f 2 | xargs -n 1 make -V LICENSE -C EULA EULA EULA GPLv2 CCbyNCSA3 EULA ASL EULA EULA [crees@zeus]/usr/ports% Can anyone see any serious problems with the code? [1] http://groups.google.com/group/mailing.freebsd.ports/browse_thread/thread/0ee74faf111ebe7b?pli=1 Portsnap maintainer duly CC'd. >How-To-Repeat: >Fix: --- index-license.diff begins here --- Index: Mk/bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.692 diff -u -r1.692 bsd.port.mk --- Mk/bsd.port.mk 12 Aug 2011 16:39:23 -0000 1.692 +++ Mk/bsd.port.mk 20 Aug 2011 19:41:14 -0000 @@ -5468,7 +5468,7 @@ # # distribution-name|port-path|installation-prefix|comment| \ # description-file|maintainer|categories|extract-depends| \ -# patch-depends|fetch-depends|build-depends|run-depends|www site +# patch-depends|fetch-depends|build-depends|run-depends|www site|license # # If this ever changes, portmgr should contact the portsnap maintainer # first to avoid gratuitous breakage. @@ -5505,7 +5505,8 @@ break; \ ;; \ esac; \ - done < ${DESCR}; ${ECHO_CMD}) >>${INDEX_OUT} + done < ${DESCR}; \ + ${ECHO_CMD} -n "|${LICENSE}" ; ${ECHO_CMD}) >>${INDEX_OUT} . endif www-site: Index: Mk/bsd.port.subdir.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.subdir.mk,v retrieving revision 1.79 diff -u -r1.79 bsd.port.subdir.mk --- Mk/bsd.port.subdir.mk 21 Jul 2011 05:04:39 -0000 1.79 +++ Mk/bsd.port.subdir.mk 20 Aug 2011 19:41:14 -0000 @@ -378,7 +378,7 @@ _JAVA_PORTS_INSTALLED="${_JAVA_PORTS_INSTALLED}" .endif -PORTSEARCH_DISPLAY_FIELDS?=name,path,info,maint,index,bdeps,rdeps,www +PORTSEARCH_DISPLAY_FIELDS?=name,path,info,maint,index,bdeps,rdeps,www,license PORTSEARCH_KEYLIM?=0 PORTSEARCH_XKEYLIM?=0 PORTSEARCH_IGNORECASE?=1 @@ -398,7 +398,8 @@ -z "$$cat" -a -z "$$xcat" -a \ -z "$$bdeps" -a -z "$$xbdeps" -a \ -z "$$rdeps" -a -z "$$xrdeps" -a \ - -z "$$www" -a -z "$$xwww" ]; \ + -z "$$www" -a -z "$$xwww" -a \ + -z "$$license" -a -z "$$xlicense" ]; \ then \ ${ECHO_MSG} "The ${.TARGET} target requires a keyword parameter or name parameter,"; \ ${ECHO_MSG} "e.g.: \"make ${.TARGET} key=somekeyword\""; \ @@ -415,6 +416,7 @@ -v bdeps="$$bdeps" -v xbdeps="$$xbdeps" \ -v rdeps="$$rdeps" -v xrdeps="$$xrdeps" \ -v www="$$www" -v xwww="$$xwww" \ + -v license="$$license" -v xlicense="$$xlicense" \ -v icase="$${icase:-${PORTSEARCH_IGNORECASE}}" \ -v keylim="$${keylim:-${PORTSEARCH_KEYLIM}}" \ -v xkeylim="$${xkeylim:-${PORTSEARCH_XKEYLIM}}" \ @@ -440,6 +442,7 @@ if (length(bdeps)) parms[8] = tolower(bdeps); if (length(xbdeps)) xparms[8] = tolower(xbdeps); \ if (length(rdeps)) parms[9] = tolower(rdeps); if (length(xrdeps)) xparms[9] = tolower(xrdeps); \ if (length(www)) parms[10] = tolower(www); if (length(xwww)) xparms[10] = tolower(xwww); \ + if (length(license)) parms[14] = tolower(license); if (length(xlicense)) xparms[14] = tolower(xlicense); \ } else { \ if (length(name)) parms[1] = name; if (length(xname)) xparms[1] = xname; \ if (length(path)) parms[2] = path; if (length(xpath)) xparms[2] = xpath; \ @@ -449,6 +452,7 @@ if (length(bdeps)) parms[8] = bdeps; if (length(xbdeps)) xparms[8] = xbdeps; \ if (length(rdeps)) parms[9] = rdeps; if (length(xrdeps)) xparms[9] = xrdeps; \ if (length(www)) parms[10] = www; if (length(xwww)) xparms[10] = xwww; \ + if (length(license)) parms[14] = license; if (length(xlicense)) xparms[14] = xlicense; \ } \ fields["name"] = 1; names[1] = "Port"; \ fields["path"] = 2; names[2] = "Path"; \ @@ -458,6 +462,7 @@ fields["bdeps"] = 8; names[8] = "B-deps"; \ fields["rdeps"] = 9; names[9] = "R-deps"; \ fields["www"] = 10; names[10] = "WWW"; \ + fields["license"] = 14; names[14] = "license"; \ split(display, d, /,[ \t]*/); \ split(xdisplay, xd, /,[ \t]*/); \ for (i in d) { \ @@ -483,7 +488,7 @@ if ((icase ? tolower($$i) : $$i) ~ xparms[i]) \ next; \ found = 0; \ - for (i = 1; i < 11; i++) \ + for (i = 1; i < 14; i++) \ if (i in disp) { \ if (xkeylim && (icase ? tolower($$i) : $$i) ~ xkey) \ next; \ @@ -492,7 +497,7 @@ } \ if (keylim && !found) \ next; \ - for (i = 1; i < 11; i++) \ + for (i = 1; i < 14; i++) \ if (i in disp) \ printf("%s:\t%s\n", names[i], $$i); \ print(""); \ Index: Tools/make_index =================================================================== RCS file: /home/pcvs/ports/Tools/make_index,v retrieving revision 1.14 diff -u -r1.14 make_index --- Tools/make_index 19 Jul 2008 17:59:41 -0000 1.14 +++ Tools/make_index 20 Aug 2011 19:41:14 -0000 @@ -117,7 +117,8 @@ 'fdep' => [split(/ /, $f[9])], 'bdep' => [split(/ /, $f[10])], 'rdep' => [split(/ /, $f[11])], - 'rest' => join('|', splice(@f, 12)), + 'www' => $f[12], + 'license' => $f[13], 'text' => join('|', splice(@f, 0, 7)) }; $index{$name} = $pkg; @@ -168,12 +169,13 @@ print join(' ', sort(@{$pkg->{bdep}})) if @{$pkg->{bdep}}; print "|"; print join(' ', sort(@{$pkg->{rdep}})) if @{$pkg->{rdep}}; - print "|$pkg->{rest}|"; + print "|$pkg->{www}|"; print join(' ', sort(@{$pkg->{edep}})) if @{$pkg->{edep}}; print "|"; print join(' ', sort(@{$pkg->{pdep}})) if @{$pkg->{pdep}}; print "|"; print join(' ', sort(@{$pkg->{fdep}})) if @{$pkg->{fdep}}; + print "|$pkg->{license}"; print "\n"; ++$pkg->{'PRINTED'}; } --- index-license.diff ends here --- -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. >Release-Note: >Audit-Trail: >Unformatted: