Date: Sat, 20 Aug 2011 20:49:38 +0100 From: Chris Rees <crees@zeus.bayofrum.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: cperciva@FreeBSD.org Subject: ports/159946: [PATCH] [bsd.port.mk] Add support for make search license= Message-ID: <BLU0-SMTP70EAAFC543BFAC695AAA78A92D0@phx.gbl> Resent-Message-ID: <201108201950.p7KJoAJP038046@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BLU0-SMTP70EAAFC543BFAC695AAA78A92D0>