summaryrefslogtreecommitdiff
path: root/ports-mgmt/portlint/src
diff options
context:
space:
mode:
authorJoe Marcus Clarke <marcus@FreeBSD.org>2018-05-11 21:33:55 +0000
committerJoe Marcus Clarke <marcus@FreeBSD.org>2018-05-11 21:33:55 +0000
commit18bdf5dabf18c7a92ff55bba1024c13226c57fcb (patch)
treed2d008d888ab65cf8314b13eff78937fa183857b /ports-mgmt/portlint/src
parentmath/gnome-calculator: update 3.24.0 -> 3.26.0 (diff)
Update to 2.18.0. Enough has happened that it's time for a minor bump.
* Fix the check for duplicate SHEBANG_LANG values [1] * Check to make sure patch files end with newlines [2] * Allow flavored *_DEPENDS in the DEPENDS section [3] * Check that kde:4 OR kde:5 is defined with USE_KDE [4] * Add a check to make sure pkg-descr is at least a certain number of lines [5] * Fix a couple of typos [6] [7] * Allow for any *_DEPENDS item in the DEPENDS section and fix a bug in the dependency syntax checking [8] * Add a check to make sure Python dependencies include a FLAVOR [9] PR: 226709 [1] 226109 [2] 226581 [3] 227255 [5] 227729 [6] 227878 [7] 227556 [8] 225654 [9] Submitted by: tcberner [4] 0mp [5][6][7] Differential Revision: D13723 [4]
Notes
Notes: svn path=/head/; revision=469697
Diffstat (limited to 'ports-mgmt/portlint/src')
-rw-r--r--ports-mgmt/portlint/src/portlint.pl85
1 files changed, 69 insertions, 16 deletions
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++;