Date: Sun, 26 Jun 2011 08:36:10 GMT From: "Ilya A. Arkhipov" <micro@heavennet.ru> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/158306: [patch] Add logic to ports-mgmt/portlint Message-ID: <201106260836.p5Q8aA5B053176@red.freebsd.org> Resent-Message-ID: <201106260840.p5Q8e1tB080868@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 158306 >Category: ports >Synopsis: [patch] Add logic to ports-mgmt/portlint >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: Sun Jun 26 08:40:00 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Ilya A. Arkhipov >Release: FreeBSD 9.0-CURRENT >Organization: >Environment: FreeBSD micro 9.0-CURRENT FreeBSD 9.0-CURRENT #2: Fri Mar 18 07:11:37 UTC 2011 root@micro:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Add logical check LICENSE after MAINTAINER block >How-To-Repeat: >Fix: Patch attached with submission follows: --- portlint.pl_old 2011-03-21 09:27:45.173097885 +0300 +++ portlint.pl 2011-06-26 12:19:41.829771354 +0400 @@ -2234,7 +2234,6 @@ } # - # # section 2: PORTNAME/PORTVERSION/... # print "OK: checking first section of $file (PORTNAME/...).\n" @@ -2393,21 +2392,6 @@ } } - # check value of LICENSE_COMB - if ($makevar{LICENSE_COMB} && $makevar{LICENSE_COMB} !~ /^(single|dual|multi$)/) { - &perror("FATAL", $file, -1, "LICENSE_COMB contains invalid value '$1' - must be one of 'single', 'dual', 'multi'"); - } - - # check LICENSE - if ($makevar{LICENSE} && $makevar{LICENSE} ne '') { - my $comb = $makevar{LICENSE_COMB} // 'single'; - - my @tokens = split(/ /, $makevar{LICENSE}); - if ($comb eq 'single' && scalar(@tokens) > 1) { - &perror("FATAL", $file, -1, "LICENSE contains multiple licenses but LICENSE_COMB is not set to 'dual' or 'multi'"); - } - } - # check the URL if (($tmp =~ /\nMASTER_SITES[+?]?=[ \t]*([^\n]*)\n/ && $1 !~ /^[ \t]*$/) || ($makevar{MASTER_SITES} ne '')) { @@ -2703,7 +2687,7 @@ # print "OK: checking third section of $file (MAINTAINER).\n" if ($verbose); - $tmp = $sections[$idx++]; + $tmp = $sections[$idx]; &checkearlier($file, $tmp, @varnames); &checkorder('MAINTAINER', $tmp, $file, qw( @@ -2756,14 +2740,53 @@ } } + $idx++; + push(@varnames, qw( MAINTAINER COMMENT )); # - # section 5: *_DEPENDS (may not be there) + # section 5: LICENSE + # + print "OK: checking fourth section of $file (LICENSE).\n" + if ($verbose); + $tmp = $sections[$idx]; + + if ($makevar{LICENSE}){ + + &checkorder('LICENSE', $tmp, $file, qw( + LICENSE LICENSE_COMB LICENSE_GROUPS LICENSE_NAME + LICENSE_TEXT LICENSE_FILE LICENSE_PERMS + )); + + # check LICENSE + if ($makevar{LICENSE} && $makevar{LICENSE} ne '') { + my $comb = $makevar{LICENSE_COMB} // 'single'; + + my @tokens = split(/ /, $makevar{LICENSE}); + if ($comb eq 'single' && scalar(@tokens) > 1) { + &perror("FATAL", $file, -1, "LICENSE contains multiple licenses but LICENSE_COMB is not set to 'dual' or 'multi'"); + } + } + + # check value of LICENSE_COMB + if ($makevar{LICENSE_COMB} && $makevar{LICENSE_COMB} !~ /^(single|dual|multi$)/) { + &perror("FATAL", $file, -1, "LICENSE_COMB contains invalid value '$1' - must be one of 'single', 'dual', 'multi'"); + } + + $idx++; + + push(@varnames, qw( + LICENSE LICENSE_COMB LICENSE_GROUPS LICENSE_NAME + LICENSE_TEXT LICENSE_FILE LICENSE_PERMS + )); + } + + # + # section 6: *_DEPENDS (may not be there) # - print "OK: checking fourth section of $file (*_DEPENDS).\n" + print "OK: checking fifth section of $file (*_DEPENDS).\n" if ($verbose); $tmp = $sections[$idx]; >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106260836.p5Q8aA5B053176>