summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports-mgmt/portlint/Makefile2
-rw-r--r--ports-mgmt/portlint/pkg-descr8
-rw-r--r--ports-mgmt/portlint/src/portlint.pl85
3 files changed, 76 insertions, 19 deletions
diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile
index 826de1021d8e..daadd9554652 100644
--- a/ports-mgmt/portlint/Makefile
+++ b/ports-mgmt/portlint/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= portlint
-PORTVERSION= 2.17.16
+PORTVERSION= 2.18.0
CATEGORIES= ports-mgmt
MASTER_SITES= # none
DISTFILES= # none
diff --git a/ports-mgmt/portlint/pkg-descr b/ports-mgmt/portlint/pkg-descr
index f7408b5ed432..541ff7b41dee 100644
--- a/ports-mgmt/portlint/pkg-descr
+++ b/ports-mgmt/portlint/pkg-descr
@@ -1,2 +1,6 @@
-portlint makes a small set of sanity checks for port directory. Check out
-portlint(1) for more details.
+portlint tries to verify the content of a port directory with a small set of
+sanity checks. The purpose of portlint can be separated into two parts: (1) to
+let the submitters easily polish their own port directory, and (2) to decrease
+the labor of the committers.
+
+Check out portlint(1) for more details.
diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl
index 22c0a2e4ce3f..d2d887e3b4d1 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.449 2018/02/18 21:02:27 jclarke Exp $
+# $MCom: portlint/portlint.pl,v 1.459 2018/05/11 21:26:56 jclarke Exp $
#
use strict;
@@ -49,8 +49,8 @@ $portdir = '.';
# version variables
my $major = 2;
-my $minor = 17;
-my $micro = 16;
+my $minor = 18;
+my $micro = 0;
# default setting - for FreeBSD
my $portsdir = '/usr/ports';
@@ -159,7 +159,8 @@ my @varlist = qw(
OPTIONS_GROUP OPTIONS_SUB INSTALLS_OMF USE_RC_SUBR USES DIST_SUBDIR
ALLFILES CHECKSUM_ALGORITHMS INSTALLS_ICONS GNU_CONFIGURE
CONFIGURE_ARGS MASTER_SITE_SUBDIR LICENSE LICENSE_COMB NO_STAGE
- DEVELOPER SUB_FILES SHEBANG_LANG MASTER_SITES_SUBDIRS
+ DEVELOPER SUB_FILES SHEBANG_LANG MASTER_SITES_SUBDIRS FLAVORS
+ USE_PYTHON
);
my %makevar;
@@ -466,8 +467,13 @@ sub checkdescr {
my($file) = @_;
my(%maxchars) = ($makevar{DESCR}, 80);
my(%maxlines) = ($makevar{DESCR}, 24);
- my(%errmsg) = ($makevar{DESCR}, "exceeds $maxlines{$makevar{DESCR}} ".
+ my(%minlines) = ($makevar{DESCR}, 3);
+ my(%toolongerrmsg) = ($makevar{DESCR},
+ "exceeds $maxlines{$makevar{DESCR}} ".
"lines, make it shorter if possible.");
+ my(%tooshorterrmsg) = ($makevar{DESCR},
+ "contains less than $minlines{$makevar{DESCR}} ".
+ "lines, make it longer if possible.");
my($longlines, $linecnt, $tmp) = (0, 0, "");
open(IN, "< $file") || return 0;
@@ -499,8 +505,11 @@ sub checkdescr {
$longlines++ if ($maxchars{$file} < length);
}
if ($linecnt > $maxlines{$file}) {
- &perror("WARN", $file, -1, "$errmsg{$file}".
+ &perror("WARN", $file, -1, "$toolongerrmsg{$file}".
"(currently $linecnt lines)");
+ } elsif ($linecnt < $minlines{$file}) {
+ &perror("WARN", $file, -1, "$tooshorterrmsg{$file}".
+ "(currently $linecnt ".($linecnt > 1 ? "lines" : "line").")");
} else {
print "OK: $file: has $linecnt lines.\n" if ($verbose);
}
@@ -834,7 +843,7 @@ sub checkplist {
"DOCSDIR-safe (that is, a user can override DOCSDIR ".
"when building this port and the port will still work ".
"correctly) consider using DOCSDIR macro; if you are ".
- "unsure if this this port is DOCSDIR-safe, then ignore ".
+ "unsure if this port is DOCSDIR-safe, then ignore ".
"this warning");
$sharedocused++;
} elsif ($_ =~ /^(\%\%PORTDOCS\%\%)?\%\%DOCSDIR\%\%/) {
@@ -1037,7 +1046,7 @@ sub checkpatch {
"``make makepatch'' when you need to [re-]generate a ".
"patch to ensure proper patch format.");
}
- last;
+ # last;
}
}
@@ -1055,6 +1064,11 @@ sub checkpatch {
"from source files.");
}
+ if ($whole !~ /\n$/s) {
+ &perror("FATAL", $file, -1, "patch does not end with a newline, and the commit check ".
+ "hook will fail.");
+ }
+
close(IN);
}
@@ -1079,13 +1093,17 @@ sub check_depends_syntax {
next;
}
print "OK: checking ports listed in $j.\n" if ($verbose);
- foreach my $k (split(/\s+/, $i)) {
+ my @ks = split(/\s+/, $i);
+ while (@ks) {
+ my $k = shift @ks;
if ($k =~ /^#/) {
last;
}
my $ok = $k;
if ($k =~ /^\$\{(\w+)\}$/) {
$k = get_makevar($1);
+ push @ks, split(/\s+/, $k);
+ next;
}
if ($k eq '') {
next;
@@ -1109,7 +1127,9 @@ sub check_depends_syntax {
}
my %m = ();
$m{'dep'} = $l[0];
- $m{'dir'} = (split(/\@/, $l[1]))[0];
+ my ($di, $fl) = split(/\@/, $l[1]);
+ $m{'dir'} = $di;
+ $m{'fla'} = $fl // '';
$m{'tgt'} = $l[2] // '';
my %depmvars = ();
foreach my $dv ($m{'dep'}, $m{'dir'}, $m{'tgt'}) {
@@ -1125,6 +1145,24 @@ sub check_depends_syntax {
}
}
+ # check Python flavor
+ my $bdir = basename($m{'dir'});
+ if ($bdir =~ /^py-/) {
+ if (!defined($makevar{USE_PYTHON}) ||
+ $makevar{USE_PYTHON} eq 'noflavors' ||
+ $makevar{USE_PYTHON} eq '') {
+ if ($m{'fla'} ne '${PY_FLAVOR}') {
+ &perror("FATAL", $file, -1, "directory for dependency ".
+ "$m{'dep'} must be $m{'dir'}:\@\${PY_FLAVOR}");
+ }
+ } else {
+ if ($m{'fla'} ne '${FLAVOR}') {
+ &perror("FATAL", $file, -1, "directory for dependency ".
+ "$m{'dep'} must be $m{'dir'}:\@\${FLAVOR}");
+ }
+ }
+ }
+
# check JAVALIBDIR
if ($m{'dep'} =~ m|share/java/classes|) {
&perror("FATAL", $file, -1, "you should use \${JAVALIBDIR} ".
@@ -1995,7 +2033,7 @@ xargs xmkmf
$cmdnames{'env'} = '${SETENV}';
$cmdnames{'gunzip'} = '${GUNZIP_CMD}';
$cmdnames{'gzip'} = '${GZIP_CMD}';
- $cmdnames{'install'} = '${INSTALL_foobaa}';
+ $cmdnames{'install'} = '${INSTALL_foobar}';
$cmdnames{'python'} = '${PYTHON_CMD}';
$cmdnames{'sdl-config'} = '${SDL_CONFIG}';
$cmdnames{'strip'} = '${STRIP_CMD}';
@@ -2227,10 +2265,10 @@ xargs xmkmf
# whole file: USE_KDE check
#
if ($whole =~ /^USE_KDE[?:]?=\s*(.*)$/m) {
- if ($makevar{USES} !~ /\bkde:5/) {
+ if ($makevar{USES} !~ /\bkde:[45]/) {
my $lineno = &linenumber($`);
&perror("WARN", $file, $lineno, "USE_KDE is defined without ".
- "defining USES=kde:5");
+ "defining USES=kde:[45]");
}
}
@@ -2341,10 +2379,17 @@ xargs xmkmf
#
# whole file: check for redundant SHEBANG_LANGs
#
- if ($whole =~ /\nSHEBANG_LANG[?+]?=\s*([^\s#]*).*\n/) {
- my @shebang_langs = split(/\s+/, $1 // '');
+ if ($whole =~ /^SHEBANG_LANG[?+]?=\s*(.*)$/m) {
+ my $sh_lang = $1;
+ my @shebang_langs = split(/\s+/, $makevar{SHEBANG_LANG} // '');
+ my %sh_seen = ();
foreach my $shebang_lang (@shebang_langs) {
- if ($makevar{SHEBANG_LANG} =~ /\b$shebang_lang\b/) {
+ if ($sh_seen{$shebang_lang}) {
+ $sh_seen{$shebang_lang}++;
+ } else {
+ $sh_seen{$shebang_lang} = 1;
+ }
+ if ($sh_seen{$shebang_lang} > 1 && $sh_lang =~ /\b$shebang_lang\b/) {
&perror("WARN", $file, -1, "$shebang_lang is already included in ".
"SHEBANG_LANG. You should remove this from $file.");
}
@@ -3123,9 +3168,17 @@ TEST_DEPENDS FETCH_DEPENDS DEPENDS_TARGET
check_depends_syntax($tmp, $file);
foreach my $i (@linestocheck) {
+ foreach my $flavor (split(/\s+/, $makevar{FLAVORS} // '')) {
+ $tmp =~ s/${flavor}_$i[?+:]?=[^\n]+\n//g;
+ }
$tmp =~ s/$i[?+:]?=[^\n]+\n//g;
}
+ # Remove any other *_DEPENDS lines as people may
+ # use a macro for common depends as described in
+ # section 5.9.2 of the Porter's Handbook.
+ $tmp =~ s/.+_DEPENDS[?+:]?=[^\n]+\n//g;
+
&checkextra($tmp, '*_DEPENDS', $file);
$idx++;