diff options
-rw-r--r-- | ports-mgmt/portlint/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/portlint/src/portlint.pl | 60 |
2 files changed, 52 insertions, 10 deletions
diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile index 4530c2365ed6..7f6e52df3117 100644 --- a/ports-mgmt/portlint/Makefile +++ b/ports-mgmt/portlint/Makefile @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= portlint -PORTVERSION= 2.17.11 +PORTVERSION= 2.17.12 CATEGORIES= ports-mgmt MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl index 37e4ca1da97e..41ea730e5d04 100644 --- a/ports-mgmt/portlint/src/portlint.pl +++ b/ports-mgmt/portlint/src/portlint.pl @@ -15,7 +15,7 @@ # was removed. # # $FreeBSD$ -# $MCom: portlint/portlint.pl,v 1.417 2017/08/03 12:52:43 jclarke Exp $ +# $MCom: portlint/portlint.pl,v 1.424 2017/08/15 12:38:42 jclarke Exp $ # use strict; @@ -50,7 +50,7 @@ $portdir = '.'; # version variables my $major = 2; my $minor = 17; -my $micro = 11; +my $micro = 12; # default setting - for FreeBSD my $portsdir = '/usr/ports'; @@ -865,6 +865,11 @@ sub checkplist { "accordingly.") unless ($check_xxxdir_ok{$3} eq $1); } + if ($_ =~ m#share/man/#) { + &perror("FATAL", $file, $., "Man pages must be installed into ". + "``man'' not ``share/man''."); + } + if ($_ =~ m#man/([^/]+/)?man[1-9ln]/([^\.]+\.[1-9ln])(\.gz)?$#) { if (!$3) { &perror("FATAL", $file, $., "Unpacked man file $2 listed. ". @@ -1302,7 +1307,7 @@ sub checkmakefile { "indentation"); } if ($usetabs) { - if (m/^[A-Za-z0-9_-]+.?= /) { + if (m/^[A-Za-z0-9_-]+.?=\t*? \t*?/) { if (m/[?+]=/) { &perror("WARN", $file, $., "use a tab (not space) after a ". "variable name"); @@ -1358,7 +1363,7 @@ sub checkmakefile { # if ($parenwarn) { print "OK: checking for \$(VARIABLE).\n" if ($verbose); - if ($whole =~ /\$\([\w\d]+\)/) { + if ($whole =~ /[^\$]\$\([\w\d]+\)/) { my $lineno = &linenumber($`); &perror("WARN", $file, $lineno, "use \${VARIABLE}, instead of ". "\$(VARIABLE)."); @@ -1629,6 +1634,16 @@ sub checkmakefile { } } } + if (-f 'pkg-plist') { + open(PL, 'pkg-plist'); + my @pcontents = <PL>; + close(PL); + foreach my $i (@pcontents) { + while ($i =~ /\%\%([^%]+)\%\%/g) { + push @popt, $1; + } + } + } # special cases for PORTDOCS/PORTEXAMPLES push @popt, "DOCS" if $makevar{PORTDOCS}; push @popt, "EXAMPLES" if $makevar{PORTEXAMPLES}; @@ -2989,9 +3004,31 @@ MAINTAINER COMMENT } # - # section 6: *_DEPENDS (may not be there) + # section 6: BROKEN/IGNORE/DEPRECATED (may not be there) # - print "OK: checking fifth section of $file (*_DEPENDS).\n" + print "OK: checking sixth section of $file (BROKEN/IGNORE/DEPRECATED).\n" + if ($verbose); + $tmp = $sections[$idx] // ''; + + @linestocheck = qw( +DEPRECATED EXPIRATION_DATE FORBIDDEN BROKEN(_\w+)? IGNORE(_\w+)? +ONLY_FOR_ARCHS ONLY_FOR_ARCHS_REASON(_\w+)? +NOT_FOR_ARCHS NOT_FOR_ARCHS_REASON(_\w+)? + ); + + my $brokenpattern = "^(" . join("|", @linestocheck) . ")[?+:]?="; + + if ($tmp =~ /$brokenpattern/) { + $idx++; + } + + push(@varnames, @linestocheck); + &checkearlier($file, $tmp, @varnames); + + # + # section 7: *_DEPENDS (may not be there) + # + print "OK: checking seventh section of $file (*_DEPENDS).\n" if ($verbose); $tmp = $sections[$idx] // ''; @@ -3357,8 +3394,8 @@ sub checkearlier { print "OK: checking items that has to appear earlier.\n" if ($verbose); foreach my $i (@varnames) { - if ($str =~ /\n$i\??=/) { - &perror("WARN", $file, -1, "\"$i\" has to appear earlier."); + if ($str =~ /\n($i)\??=/) { + &perror("WARN", $file, -1, "\"$1\" has to appear earlier."); } } } @@ -3369,7 +3406,7 @@ sub linenumber { @lines = split /\n/, $text; - return scalar(@lines); + return scalar(@lines) - 1; } sub abspathname { @@ -3402,6 +3439,11 @@ sub abspathname { # MASTER_SITE_SUBDIR lines are ok. $i = ''; } + if ($s =~ /\$\{[^}]*?$i/) { + # If we're inside a make variable, we probably do not have + # an absolute path. + $i = ''; + } } if ($i ne '' && ! grep {$i =~ m|^$_|} @ALLOWED_FULL_PATHS) { $i =~ s/\s.*$//; |