Update to 2.13.6.

* Be more careful is searching for WITH(OUT)_FOO OPTIONS checks so to avoid
false positive warnings. [1]
* Support := in the *_DEPENDS section. [2]
* Make sure we expand DISTNAME to catch potential superfluous uses of it. [3]
* Fix the error seen when one passes CPPFLAGS to CONFIGURE_ENV. [4]
* Add the license block check after the MAINTAINER block [5]
* Add a check for use of ${FIND}...${XARGS} ${RM}. [6]

PR:		156164 [1]
		155753 [2]
		154320 [3]
		158305 [5]
		157566 [6]
Submitted by:	sahil [1]
		"Ilya A. Arkhipov" <micro@heavennet.ru> [5]
Reported by:	pav [4]
This commit is contained in:
Joe Marcus Clarke 2011-06-26 21:31:55 +00:00
parent 1cf16de13e
commit e8ef7bfbd0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=276458
3 changed files with 74 additions and 31 deletions

View file

@ -8,7 +8,7 @@
# #
PORTNAME= portlint PORTNAME= portlint
PORTVERSION= 2.13.5 PORTVERSION= 2.13.6
CATEGORIES= ports-mgmt CATEGORIES= ports-mgmt
MASTER_SITES= # none MASTER_SITES= # none
DISTFILES= # none DISTFILES= # none
@ -23,6 +23,12 @@ USE_PERL5_RUN= yes
SRC= ${.CURDIR}/src SRC= ${.CURDIR}/src
MAN1= portlint.1 MAN1= portlint.1
PLIST_FILES= bin/portlint
.if !defined(NOPORTEXAMPLES)
PLIST_FILES+= %%EXAMPLESDIR%%/portlintgrep
PLIST_DIRS= %%EXAMPLESDIR%%
.endif
do-fetch: do-fetch:
@${DO_NADA} @${DO_NADA}
@ -38,7 +44,6 @@ post-patch:
do-install: do-install:
${INSTALL_SCRIPT} ${WRKSRC}/portlint.pl ${PREFIX}/bin/portlint ${INSTALL_SCRIPT} ${WRKSRC}/portlint.pl ${PREFIX}/bin/portlint
${INSTALL_MAN} ${WRKSRC}/portlint.1 ${MAN1PREFIX}/man/man1 ${INSTALL_MAN} ${WRKSRC}/portlint.1 ${MAN1PREFIX}/man/man1
${MKDIR} ${EXAMPLESDIR}
.if !defined(NOPORTEXAMPLES) .if !defined(NOPORTEXAMPLES)
${INSTALL} -o ${SHAREOWN} -g ${SHAREGRP} -m ${BINMODE} -d ${EXAMPLESDIR} ${INSTALL} -o ${SHAREOWN} -g ${SHAREGRP} -m ${BINMODE} -d ${EXAMPLESDIR}
${INSTALL_SCRIPT} ${WRKSRC}/portlintgrep.pl ${EXAMPLESDIR}/portlintgrep ${INSTALL_SCRIPT} ${WRKSRC}/portlintgrep.pl ${EXAMPLESDIR}/portlintgrep

View file

@ -1,3 +0,0 @@
bin/portlint
%%PORTEXAMPLES%%%%EXAMPLESDIR%%/portlintgrep
@dirrm %%EXAMPLESDIR%%

View file

@ -17,7 +17,7 @@
# OpenBSD and NetBSD will be accepted. # OpenBSD and NetBSD will be accepted.
# #
# $FreeBSD$ # $FreeBSD$
# $MCom: portlint/portlint.pl,v 1.216 2011/03/21 00:58:39 marcus Exp $ # $MCom: portlint/portlint.pl,v 1.223 2011/06/26 21:25:51 marcus Exp $
# #
use strict; use strict;
@ -52,7 +52,7 @@ $portdir = '.';
# version variables # version variables
my $major = 2; my $major = 2;
my $minor = 13; my $minor = 13;
my $micro = 5; my $micro = 6;
sub l { '[{(]'; } sub l { '[{(]'; }
sub r { '[)}]'; } sub r { '[)}]'; }
@ -1541,7 +1541,7 @@ sub checkmakefile {
pos($whole) = 0; pos($whole) = 0;
print "OK: checking OPTIONS.\n" if ($verbose); print "OK: checking OPTIONS.\n" if ($verbose);
@oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg); @oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg);
while ($whole =~ /\n[^#\n]*?\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg) { while ($whole =~ /\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg) {
push @mopt, $1; push @mopt, $1;
my $lineno = &linenumber($`) + 1; my $lineno = &linenumber($`) + 1;
&perror("FATAL", $file, $lineno, "option WITH(OUT)_$1 is used before ". &perror("FATAL", $file, $lineno, "option WITH(OUT)_$1 is used before ".
@ -1916,6 +1916,18 @@ ruby sed sh sort sysctl touch tr which xargs xmkmf
"\"-p\" by default."); "\"-p\" by default.");
} }
#
# check for use of ${FIND} ... ${XARGS} ${RM}
#
print "OK: checking for instances of \${FIND} ... \${XARGS} \${RM}.\n"
if ($verbose);
if ($j =~ /\$\{FIND\}.*\|.*\$\{XARGS\}.*\$\{RM\}/) {
my $lineno = &linenumber($`);
&perror("WARN", $file, $lineno, "possible use of ".
"\"\${FIND} ... \${XARGS} \${RM}\" when ".
"\"\${FIND} ... -delete\" will work.");
}
# #
# whole file: ${MACHINE_ARCH} # whole file: ${MACHINE_ARCH}
# #
@ -2101,13 +2113,19 @@ ruby sed sh sort sysctl touch tr which xargs xmkmf
if ($configure_env =~ /(FC)=/ || if ($configure_env =~ /(FC)=/ ||
$configure_env =~ /(F77)=/ || $configure_env =~ /(F77)=/ ||
$configure_env =~ /(CPPFLAGS)=/ ||
$configure_env =~ /(FFLAGS)=/) { $configure_env =~ /(FFLAGS)=/) {
&perror("FATAL", $file, -1, "$1 is already ". &perror("FATAL", $file, -1, "$1 is already ".
"passed in CONFIGURE_ENV via bsd.gcc.mk. If you need to ". "passed in CONFIGURE_ENV via bsd.gcc.mk. If you need to ".
"override the default value, alter $1 in the Makefile ". "override the default value, alter $1 in the Makefile ".
"instead with $1=..."); "instead with $1=...");
} }
if ($configure_env =~ /(CPPFLAGS)=/) {
&perror("FATAL", $file, -1, "$1 is already ".
"passed in CONFIGURE_ENV via bsd.port.mk. If you need to ".
"override the default value, alter $1 in the Makefile ".
"instead with $1=...");
}
} }
# #
@ -2233,7 +2251,6 @@ EOF
$sections[$i] =~ s/^\n//; $sections[$i] =~ s/^\n//;
} }
#
# #
# section 2: PORTNAME/PORTVERSION/... # section 2: PORTNAME/PORTVERSION/...
# #
@ -2393,21 +2410,6 @@ DIST_SUBDIR EXTRACT_ONLY
} }
} }
# 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 # check the URL
if (($tmp =~ /\nMASTER_SITES[+?]?=[ \t]*([^\n]*)\n/ if (($tmp =~ /\nMASTER_SITES[+?]?=[ \t]*([^\n]*)\n/
&& $1 !~ /^[ \t]*$/) || ($makevar{MASTER_SITES} ne '')) { && $1 !~ /^[ \t]*$/) || ($makevar{MASTER_SITES} ne '')) {
@ -2475,11 +2477,12 @@ DIST_SUBDIR EXTRACT_ONLY
print "OK: sanity checking PORTNAME/PORTVERSION/DISTVERSIONPREFIX/DISTVERSION/DISTVERSIONSUFFIX.\n" if ($verbose); print "OK: sanity checking PORTNAME/PORTVERSION/DISTVERSIONPREFIX/DISTVERSION/DISTVERSIONSUFFIX.\n" if ($verbose);
if ($distname ne '') { if ($distname ne '') {
if ($distname eq "$portname-$portversion") { my $exp_distname = $makevar{DISTNAME};
if ($exp_distname eq "$portname-$portversion") {
&perror("WARN", $file, -1, "DISTNAME is \${PORTNAME}-\${PORTVERSION} by ". &perror("WARN", $file, -1, "DISTNAME is \${PORTNAME}-\${PORTVERSION} by ".
"default, you don't need to define DISTNAME."); "default, you don't need to define DISTNAME.");
} else { } else {
if ($distname eq "$portname-$distversionprefix$distversion$distversionsuffix") { if ($exp_distname eq "$portname-$distversionprefix$distversion$distversionsuffix") {
&perror("WARN", $file, -1, "DISTNAME is \${PORTNAME}-\${DISTVERSIONPREFIX}\${DISTVERSION}\${DISTVERSIONSUFFIX} by ". &perror("WARN", $file, -1, "DISTNAME is \${PORTNAME}-\${DISTVERSIONPREFIX}\${DISTVERSION}\${DISTVERSIONSUFFIX} by ".
"default, you don't need to define DISTNAME."); "default, you don't need to define DISTNAME.");
} }
@ -2703,7 +2706,7 @@ PATCH_SITES PATCHFILES PATCH_DIST_STRIP
# #
print "OK: checking third section of $file (MAINTAINER).\n" print "OK: checking third section of $file (MAINTAINER).\n"
if ($verbose); if ($verbose);
$tmp = $sections[$idx++]; $tmp = $sections[$idx];
&checkearlier($file, $tmp, @varnames); &checkearlier($file, $tmp, @varnames);
&checkorder('MAINTAINER', $tmp, $file, qw( &checkorder('MAINTAINER', $tmp, $file, qw(
@ -2756,14 +2759,52 @@ MAINTAINER COMMENT
} }
} }
$idx++;
push(@varnames, qw( push(@varnames, qw(
MAINTAINER COMMENT MAINTAINER COMMENT
)); ));
# #
# section 5: *_DEPENDS (may not be there) # section 5: LICENSE
# #
print "OK: checking fourth section of $file (*_DEPENDS).\n" 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 fifth section of $file (*_DEPENDS).\n"
if ($verbose); if ($verbose);
$tmp = $sections[$idx]; $tmp = $sections[$idx];
@ -2789,7 +2830,7 @@ FETCH_DEPENDS DEPENDS_TARGET
check_depends_syntax($tmp, $file); check_depends_syntax($tmp, $file);
foreach my $i (@linestocheck) { foreach my $i (@linestocheck) {
$tmp =~ s/$i[?+]?=[^\n]+\n//g; $tmp =~ s/$i[?+:]?=[^\n]+\n//g;
} }
&checkextra($tmp, '*_DEPENDS', $file); &checkextra($tmp, '*_DEPENDS', $file);