ports-mgmt/portlint: Update to 2.19.6

* Allow ports without any leading comment section [1]
  loader@ submitted a patch on which this was based
* Add a check to make sure the license is actually valid
PR:		255520 [1]
This commit is contained in:
Joe Marcus Clarke 2021-05-14 12:57:48 -04:00
parent 4d001c7726
commit 122c3ecb51
2 changed files with 35 additions and 24 deletions

View File

@ -1,7 +1,7 @@
# Created by: Jun-ichiro itojun Hagino <itojun@itojun.org>
PORTNAME= portlint
PORTVERSION= 2.19.5
PORTVERSION= 2.19.6
CATEGORIES= ports-mgmt
MASTER_SITES= # none
DISTFILES= # none

View File

@ -14,7 +14,7 @@
# bsd.port.mk. There are significant differences in those so non-FreeBSD code
# was removed.
#
# $MCom: portlint/portlint.pl,v 1.525 2021/04/19 20:48:32 jclarke Exp $
# $MCom: portlint/portlint.pl,v 1.528 2021/05/14 16:53:31 jclarke Exp $
#
use strict;
@ -49,7 +49,7 @@ $portdir = '.';
# version variables
my $major = 2;
my $minor = 19;
my $micro = 5;
my $micro = 6;
# default setting - for FreeBSD
my $portsdir = '/usr/ports';
@ -2663,34 +2663,39 @@ xargs xmkmf
}
}
$idx = 0;
my @linestocheck = ();
#
# section 1: comment lines.
#
print "OK: checking comment section of $file.\n" if ($verbose);
my @linestocheck = split("\n", <<EOF);
# check if all lines in the first section are comments
if (grep(/^#/, split(/\n/, $sections[$idx])) == split(/\n/, $sections[$idx])) {
#
# section 1: comment lines.
#
print "OK: checking comment section of $file.\n" if ($verbose);
@linestocheck = split("\n", <<EOF);
Whom
Date [cC]reated
EOF
$tmp = $sections[$idx++];
$tmp = "\n" . $tmp; # to make the begin-of-line check easier
$tmp = $sections[$idx++];
$tmp = "\n" . $tmp; # to make the begin-of-line check easier
if ($tmp =~ /\n[^#]/) {
&perror("FATAL", $file, -1, "non-comment line in comment section.");
}
if ($tmp =~ m/Version [rR]equired/) {
&perror("WARN", $file, -1, "Version required is no longer needed in the comment section.");
}
if ($tmp =~ /\n[^#]/) {
&perror("FATAL", $file, -1, "non-comment line in comment section.");
}
if ($tmp =~ m/Version [rR]equired/) {
&perror("WARN", $file, -1, "Version required is no longer needed in the comment section.");
}
#
# for the rest of the checks, comment lines are not important.
#
for ($i = 0; $i < scalar(@sections); $i++) {
$sections[$i] = "\n" . $sections[$i];
$sections[$i] =~ s/\n#[^\n]*//g;
$sections[$i] =~ s/\n\n+/\n/g;
$sections[$i] =~ s/^\n//;
#
# for the rest of the checks, comment lines are not important.
#
for ($i = 0; $i < scalar(@sections); $i++) {
$sections[$i] = "\n" . $sections[$i];
$sections[$i] =~ s/\n#[^\n]*//g;
$sections[$i] =~ s/\n\n+/\n/g;
$sections[$i] =~ s/^\n//;
}
}
#
@ -3224,6 +3229,12 @@ MAINTAINER COMMENT
}
}
# Last-ditch check to make sure the license is sanely defined.
my $lic_check = system("make check-license 2>&1 >/dev/null");
if ($lic_check) {
&perror("FATAL", $file, -1, "Failed to validate port LICENSE '$makevar{LICENSE}' with ``make check-license''");
}
$idx++;
push(@varnames, qw(