[Midnightbsd-cvs] mports [23729] trunk/ports-mgmt/portlint: update portlint

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Aug 17 18:29:32 EDT 2018


Revision: 23729
          http://svnweb.midnightbsd.org/mports/?rev=23729
Author:   laffer1
Date:     2018-08-17 18:29:31 -0400 (Fri, 17 Aug 2018)
Log Message:
-----------
update portlint

Modified Paths:
--------------
    trunk/ports-mgmt/portlint/Makefile
    trunk/ports-mgmt/portlint/src/portlint.pl

Modified: trunk/ports-mgmt/portlint/Makefile
===================================================================
--- trunk/ports-mgmt/portlint/Makefile	2018-08-17 21:13:02 UTC (rev 23728)
+++ trunk/ports-mgmt/portlint/Makefile	2018-08-17 22:29:31 UTC (rev 23729)
@@ -4,7 +4,7 @@
 # This port is self contained in the src directory.
 
 PORTNAME=	portlint
-PORTVERSION=	2.16.4
+PORTVERSION=	2.18.3
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none

Modified: trunk/ports-mgmt/portlint/src/portlint.pl
===================================================================
--- trunk/ports-mgmt/portlint/src/portlint.pl	2018-08-17 21:13:02 UTC (rev 23728)
+++ trunk/ports-mgmt/portlint/src/portlint.pl	2018-08-17 22:29:31 UTC (rev 23729)
@@ -49,8 +49,8 @@
 
 # version variables
 my $major = 2;
-my $minor = 16;
-my $micro = 4;
+my $minor = 18;
+my $micro = 3;
 
 # default setting - for MidnightBSD
 my $portsdir = '/usr/mports';
@@ -153,13 +153,14 @@
 	WRKDIR WRKSRC NO_WRKSUBDIR SCRIPTDIR FILESDIR
 	PKGDIR COMMENT DESCR PLIST PKGCATEGORY PKGINSTALL PKGDEINSTALL
 	PKGREQ PKGMESSAGE DISTINFO_FILE .CURDIR USE_LDCONFIG USE_AUTOTOOLS
-	USE_GNOME USE_PERL5 INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION
+	USE_GNOME USE_PERL5 USE_QT5 INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION
 	PLIST_FILES PLIST_DIRS PORTDOCS PORTEXAMPLES
 	OPTIONS_DEFINE OPTIONS_RADIO OPTIONS_SINGLE OPTIONS_MULTI
 	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
+	DEVELOPER SUB_FILES SHEBANG_LANG MASTER_SITES_SUBDIRS FLAVORS
+	USE_PYTHON
 );
 
 my %makevar;
@@ -214,7 +215,26 @@
 close(IN);
 
 open(MK, 'Makefile') || die "Makefile: $!";
-my @muses = grep($_ = /^USES[?+]?=\s*(.*)/ && $1, <MK>);
+my $ulineno = -1;
+my $uulineno = -1;
+my @muses = ();
+while (my $mline = <MK>) {
+	if ($uulineno == -1 && $mline =~ /^USE_/) {
+		$uulineno = $.;
+	}
+    if ($mline =~ /^USES[?+]?=\s*(.*)/) {
+		if ($ulineno == -1) {
+		    $ulineno = $.;
+		}
+	    if ($1) {
+		    push @muses, split(/\s+/, $1);
+		}
+    }
+}
+if ($uulineno > -1 && $ulineno > -1 && $uulineno < $ulineno) {
+	&perror("WARN", 'Makefile', $uulineno, "USE_* seen before USES.  ".
+		"According to the porters-handbook, USES must appear first.");
+}
 foreach my $muse (@muses) {
 	$makevar{USES} .= " " . $muse;
 }
@@ -391,10 +411,16 @@
 	while (<IN>) {
 		if (/^\s*$/) {
 			&perror("FATAL", $file, $., "found blank line.");
+			next;
 		}
-		m/(\S+)\s+\((\S+)\)\s+=\s+(\S+)/;
-
-		if ($1 ne "" && $2 ne "" && $3 ne "") {
+		if (/^TIMESTAMP\s+=\s+(\d+)$/) {
+			my $now = time;
+			if ($1 > $now) {
+				&perror("FATAL", $file, $., "TIMESTAMP is in the future");
+			}
+			next;
+		}
+		if (/(\S+)\s+\((\S+)\)\s+=\s+(\S+)/) {
 			my ($tag, $path, $value) = ($1, $2, $3);
 			$records{$path}{$tag} = $value;
 
@@ -441,8 +467,13 @@
 	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;
@@ -475,8 +506,11 @@
 		$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);
 	}
@@ -489,14 +523,14 @@
 			"other local characters.  files should be in ".
 			"plain 7-bit ASCII");
 	}
-	if ($file =~ /\bpkg-descr/ && $tmp =~ m,http://,) {
+	if ($file =~ /\bpkg-descr/ && $tmp =~ m,https?://,) {
 		my $has_url = 0;
 		my $has_www = 0;
 		my $cpan_url = 0;
 		my $has_endslash = 0;
-		foreach my $line (grep($_ =~ "http://", split(/\n+/, $tmp))) {
+		foreach my $line (grep($_ =~ "https?://", split(/\n+/, $tmp))) {
 			$has_url = 1;
-			if ($line =~ m,WWW:[ \t]+http://,) {
+			if ($line =~ m,WWW:[ \t]+https?://,) {
 				$has_www = 1;
 				if ($line =~ m,search.cpan.org,) {
 					$cpan_url = 1;
@@ -532,6 +566,9 @@
 
 	my $seen_special = 0;
 	my $item_count = 0;
+	my $owner_seen = 0;
+	my $group_seen = 0;
+	my $found_so = 0;
 
 	# Variables that are allowed to be out-of-sync in the XXXDIR check.
 	# E.g., %%PORTDOCS%%%%RUBY_MODDOCDIR%% will be OK because there is
@@ -580,9 +617,12 @@
 				"be installed.");
 		}
 
-		if (m'lib/perl5/site_perl/%%PERL_VER%%') {
+		if (m'lib/perl5/site_perl/mach/%%PERL_VER%%') {
+			&perror("WARN", $file, $., "use \%\%SITE_ARCH\%\% ".
+				"instead of lib/perl5/site_perl/mach/\%\%PERL_VER\%\%");
+		} elsif (m'lib/perl5/site_perl') {
 			&perror("WARN", $file, $., "use \%\%SITE_PERL\%\% ".
-					"instead of lib/perl5/site_perl/\%\%PERL_VER\%\%.");
+					"instead of lib/perl5/site_perl.");
 		}
 
 		if (m'([\w\d]+-portbld-freebsd\d+\.\d+)') {
@@ -613,6 +653,13 @@
 				"see HANDLE_RC_SCRIPTS in pkg.conf(5).");
 		}
 
+		if (m'^\@(un)?exec') {
+			&perror("WARN", $file, $., "@[un]exec is deprecated in ".
+				"favor of \@<pre|post>[un]exec as the latter specifies ".
+				"the exact part of the pkg lifecycle the commands need ".
+				"to run");
+		}
+
 		$seen_special++ if /[\%\@]/;
 		if ($_ =~ /^\@/) {
 			if ($_ =~ /^\@(cwd|cd)[ \t]+(\S+)/) {
@@ -636,7 +683,7 @@
 					"instead of \"\@unexec rmdir\".");
 			} elsif ($_ =~ /^\@unexec[ \t]+install-info[ \t]+--delete\s+(.+)\s+(.+)$/) {
 				&perror("WARN", $file, $., "\@unexec install-info is deprecated in favor of adding info files into the Makefile using the INFO macro.");
-			} elsif ($_ =~ /^\@(exec|unexec)/) {
+			} elsif ($_ =~ /^\@(pre|post)?(exec|unexec|)/) {
 				if (/ldconfig/) {
 					&perror("WARN", $file, $., "possible ".
 						"direct use of ldconfig ".
@@ -661,13 +708,47 @@
 			} elsif ($_ eq "\@cwd") {
 				; # @cwd by itself means change directory back to the original
 				  # PREFIX.
-		  	} elsif ($_ =~ /^\@sample\s+(\S*)/) {
+			} elsif ($_ =~ /^\@\(/) {
+				if ($_ !~ /^\@\([^,]*,[^,]*,[^\),]*(,[^\)]*)?\)/) {
+					&perror("WARN", $file, $., "Invalid use of \@(...). ".
+						"Arguments should be owner,group,perms[,fflags]");
+				}
+		  	} elsif ($_ =~ /^\@sample\s+(.+)/) {
 				my $sl = $.;
-				if ($1 !~ /\.sample$/) {
+				my @sampleparts = split(/\s+/, $1);
+				if (scalar @sampleparts == 1 && $sampleparts[0] !~ /\.sample$/) {
 					&perror("WARN", $file, $sl, "\@sample directive references".
 						" file that does not end in ``.sample''.  Sample".
 						" files must end in ``.sample''.");
 				}
+			} elsif ($_ =~ /^\@owner/) {
+				if ($_ =~ /^\@owner\s+.+/) {
+					if ($owner_seen > 0) {
+						&perror("WARN", $file, $., "Nested setting of \@owner ".
+							"found.  Reset \@owner before setting it again.");
+					}
+				    $owner_seen++;
+				} else {
+					if ($owner_seen == 0) {
+						&perror("WARN", $file, $., "\@owner reset seen before ".
+							"a new owner section was started.");
+					}
+					$owner_seen--;
+				}
+			} elsif ($_ =~ /^\@group/) {
+				if ($_ =~ /^\@group\s+.+/) {
+					if ($group_seen > 0) {
+						&perror("WARN", $file, $., "Nested setting of \@group ".
+							"found.  Reset \@group before setting it again.");
+					}
+					$group_seen++;
+				} else {
+					if ($group_seen == 0) {
+						&perror("WARN", $file, $., "\@group reset seen before ".
+							"a new group section was started.");
+					}
+					$group_seen--;
+				}
 			} elsif ($_ =~ /^\@(dir|dirrm|dirrmtry|rmtry|option|stopdaemon|owner|group|mode|fc|fcfontsdir|fontsdir|info|shell)\b/) {
 				; # no check made
 			} else {
@@ -703,10 +784,13 @@
 			$makevar{USE_LDCONFIG} eq '') {
 			&perror("WARN", $file, $., "installing shared libraries, ".
 				"please define USE_LDCONFIG as appropriate");
+		} elsif ($_ =~ m|lib[^\/]+\.so(\.\d+)?$|) {
+			$found_so++;
 		}
 
 		if ($_ =~ m|^share/icons/.*/| &&
-			$makevar{INSTALLS_ICONS} eq '') {
+			$makevar{INSTALLS_ICONS} eq '' &&
+			needs_installs_icons()) {
 			&perror("WARN", $file, $., "installing icons, ".
 				"please define INSTALLS_ICONS as appropriate");
 		}
@@ -719,9 +803,18 @@
 				"for more details)");
 		}
 
-		if ($_ =~ m|\.mo$| && $makevar{USES} !~ /\bgettext\b/) {
-			&perror("WARN", $file, $., "installing gettext translation files, ".
-				"please define USES[+]=gettext as appropriate");
+		if ($_ =~ m|^(%%([^%]+)%%)?.*\.mo$| && $makevar{USES} !~ /\bgettext\b/) {
+			my $show_nls_warn = 1;
+			if ($2) {
+				my $mv = get_makevar($2."_USES");
+				if ($mv =~ /\bgettext\b/) {
+					$show_nls_warn = 0;
+				}
+			}
+			if ($show_nls_warn) {
+					&perror("WARN", $file, $., "installing gettext translation files, ".
+						"please define USES[+]=gettext as appropriate");
+			}
 		}
 
 		if ($_ =~ m|\.core$| && $_ !~ /^\@/) {
@@ -751,7 +844,7 @@
 					"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\%\%/) {
@@ -786,6 +879,11 @@
 				"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.  ".
@@ -806,10 +904,25 @@
 		}
 	}
 
+	if ($owner_seen > 0) {
+		&perror("WARN", $file, -1, "A \@owner section was started but never ".
+			"reset.  USe \@owner without any arguments to reset the owner");
+	}
+
+	if ($group_seen > 0) {
+		&perror("WARN", $file, -1, "A \@group section was started but never ".
+			"reset.  Use \@group without any arguments to reset the group");
+	}
+
 	if (!$seen_special && $item_count < $numpitems) {
 		&perror("WARN", $file, -1, "There are only $item_count items in the plist.  Consider using PLIST_FILES instead of pkg-plist when installing less than $numpitems items.");
 	}
 
+	if ($makevar{USE_LDCONFIG} ne '' && !$found_so) {
+		&perror("WARN", $file, -1, "You have defined USE_LDCONFIG, but this ".
+			"port does not install any shared objects.");
+	}
+
 	close(IN);
 	1;
 }
@@ -925,13 +1038,16 @@
 
 	open(IN, "< $file") || return 0;
 	$whole = '';
+	my $checked_header = 0;
 	while (<IN>) {
 		$whole .= $_;
-		if (/^--- /) {
+		if (/^--- / && !$checked_header) {
+			$checked_header = 1;
 			if ($_ !~ /UTC\s*$/) {
 				&perror("WARN", $file, -1, "patch was not generated using ".
 					"``make makepatch''.  It is recommended to use ".
-					"``make makepatch'' to ensure proper patch format.");
+					"``make makepatch'' when you need to [re-]generate a ".
+					"patch to ensure proper patch format.");
 			}
 		}
 	}
@@ -951,6 +1067,11 @@
 			"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);
 }
 
@@ -966,7 +1087,7 @@
 		$j = $1;
 		$seen_depends{$j}++;
 		if ($j ne 'DEPENDS' &&
-			$i =~ /^\${([A-Z_]+DEPENDS)}\s*$/ &&
+			$i =~ /^\$\{([A-Z_]+DEPENDS)}\s*$/ &&
 			$seen_depends{$1} &&
 			$j ne $1)
 		{
@@ -975,19 +1096,27 @@
 			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;
+			}
 			my @l = split(':', $k);
 
 			print "OK: checking dependency value for $j.\n"
 				if ($verbose);
-			if ($k =~ /\${((PATCH_|EXTRACT_|LIB_|BUILD_|RUN_|TEST_|FETCH_)*DEPENDS)}/) {
-				&perror("WARN", $file, -1, "do not set $j to $k. ".
+			if ($ok =~ /\$\{((PATCH_|EXTRACT_|LIB_|BUILD_|RUN_|TEST_|FETCH_)*DEPENDS)}/) {
+				&perror("WARN", $file, -1, "do not set $j to $ok. ".
 					"Instead, explicity list out required $j dependencies.");
 			}
 
@@ -1001,8 +1130,47 @@
 			}
 			my %m = ();
 			$m{'dep'} = $l[0];
-			$m{'dir'} = $l[1];
+			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'}) {
+				foreach my $mv ($dv =~ /\$\{([^}]+)\}/g) {
+					if (defined($depmvars{$mv})) {
+						next;
+					}
+					if (defined($makevar{$mv})) {
+						$depmvars{$mv} = $makevar{$mv};
+					} else {
+						$depmvars{$mv} = &get_makevar($mv);
+					}
+				}
+			}
+
+			# check Python flavor
+			my $bdir = basename($m{'dir'});
+			if ($bdir =~ /^py-/) {
+				if ($m{'fla'} ne '${PY_FLAVOR}') {
+					&perror("WARN", $file, -1, "you may want directory for ".
+						"dependency $m{'dep'} to be $m{'dir'}\@\${PY_FLAVOR}");
+				}
+			}
+
+			# check JAVALIBDIR
+			if ($m{'dep'} =~ m|share/java/classes|) {
+				&perror("FATAL", $file, -1, "you should use \${JAVALIBDIR} ".
+					"in BUILD_DEPENDS/RUN_DEPENDS to define ".
+					"dependencies on JAR files installed in ".
+					"\${JAVAJARDIR}");
+			}
+
+			foreach my $dv ($m{'dep'}, $m{'dir'}, $m{'tgt'}) {
+				foreach my $dmv (keys %depmvars) {
+					$dv =~ s/\$\{$dmv\}/$depmvars{$dmv}/g;
+				}
+			}
+
 			print "OK: dep=\"$m{'dep'}\", ".
 				"dir=\"$m{'dir'}\", tgt=\"$m{'tgt'}\"\n"
 				if ($verbose);
@@ -1015,7 +1183,7 @@
 			}
 
 			# Check for ${SITE_PERL} in depends
-			if ($m{'dep'} =~ m|^(\${SITE_PERL}/.*)$|) {
+			if ($m{'dep'} =~ m|^(\$\{SITE_PERL}/.*)$|) {
 				&perror("WARN", $file, -1, "dependency to $1 ".
 					"listed in $j. consider using p5-Example-Package-Name>=0.  See ".
 					"http://www.freebsd.org/doc/en/books/porters-handbook/using-perl.html".
@@ -1037,12 +1205,24 @@
 			}
 
 			# check USES=gmake
-			if ($m{'dep'} =~ /^(gmake|\${GMAKE})$/) {
+			if ($m{'dep'} =~ /^(gmake|\$\{GMAKE})$/) {
 				&perror("WARN", $file, -1, "dependency to $1 ".
 					"listed in $j. consider using ".
 					"USES[+]=gmake.");
 			}
 
+			my %udeps = (
+				'bison' => 'bison',
+				'fmake' => 'fmake',
+			);
+			foreach my $udep (keys %udeps) {
+				if ($m{'dep'} =~ /^$udep/) {
+					&perror("WARN", $file, -1, "dependency to $udep ".
+						"listed in $j.  consider using ".
+						"USES[+]=$udeps{$udep}.");
+				}
+			}
+
 			# check USE_QT
 			if ($m{'dep'} =~ /^(qt\d)+$/) {
 				&perror("WARN", $file, -1, "dependency to $1 ".
@@ -1064,16 +1244,9 @@
 					"USE_GHOSTSCRIPT(_BUILD|_RUN).");
 			}
 
-			# check JAVALIBDIR
-			if ($m{'dep'} =~ m|share/java/classes|) {
-				&perror("FATAL", $file, -1, "you should use \${JAVALIBDIR} ".
-					"in BUILD_DEPENDS/RUN_DEPENDS to define ".
-					"dependencies on JAR files installed in ".
-					"\${JAVAJARDIR}");
-			}
 
 			# check for PREFIX
-			if ($m{'dep'} =~ /\${PREFIX}/) {
+			if ($m{'dep'} =~ /\$\{PREFIX}/) {
 				&perror("FATAL", $file, -1, "\${PREFIX} must not be ".
 					"contained in *_DEPENDS. ".
 					"use \${LOCALBASE} instead.");
@@ -1101,9 +1274,7 @@
 			}
 
 			# Check port dir existence
-			$k = $m{'dir'};
-			$k =~ s/\${PORTSDIR}/$ENV{'PORTSDIR'}/;
-			$k =~ s/\$[\({]PORTSDIR[\)}]/$ENV{'PORTSDIR'}/;
+			$k = $ENV{'PORTSDIR'}.'/'.$m{'dir'};
 			if (! -d $k) {
 				&perror("WARN", $file, -1, "no port directory $k ".
 					"found, even though it is ".
@@ -1158,6 +1329,11 @@
 	my $optused = 0;
 	my $desktop_entries = '';
 
+	my $masterdir = $makevar{MASTERDIR};
+	if ($masterdir ne '' && $masterdir ne $makevar{'.CURDIR'}) {
+		$slaveport = 1;
+	}
+
 	open(IN, "< $file") || return 0;
 	$rawwhole = '';
 	$tmp = 0;
@@ -1171,7 +1347,7 @@
 				"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");
@@ -1216,10 +1392,10 @@
 		}
 	# special case for $rcsidsrt\nMCom:
 	} elsif ($lines[1] =~ /^# \$$rcsidstr[:\$]/ and $lines[2] =~ /^#\s+\$MCom[:\$]/ and $lines[3] =~ /^$/) {
-		# DO NOTHING
+        # DO NOTHING
 	} elsif ($lines[1] !~ /^# \$$rcsidstr[:\$]/ or $lines[2] !~ /^$/) {
 		&perror("FATAL", $file, 1, "incorrect header; ".
-			"use Created by: with a single space, then \$$rcsidstr\$.");
+			"simply use \$$rcsidstr\$.");
 	}
 
 	#
@@ -1227,7 +1403,7 @@
 	#
 	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).");
@@ -1239,7 +1415,7 @@
 	#
 	if ($parenwarn) {
 		print "OK: checking for empty(\${VARIABLE}).\n" if ($verbose);
-		if ($whole =~ /empty\(\${[\w\d]+/) {
+		if ($whole =~ /empty\(\$\{[\w\d]+/) {
 			my $lineno = &linenumber($`);
 			&perror("WARN", $file, $lineno, "use empty(VARIABLE), instead of ".
 				"empty(\${VARIABLE}).");
@@ -1290,16 +1466,6 @@
 	}
 
 	#
-	# whole file: use of :LU variable expansion modifiers
-	#
-	print "OK: checking for use of :LU variable expansion modifiers.\n" if ($verbose);
-	if ($whole =~ /\$\{[^}]+:[LU]/m) {
-		my $lineno = &linenumber($`);
-		&perror("FATAL", $file, $lineno, ":U and :L syntax is not supported ".
-			"anymore.  Please use :tu and :tl instead.");
-	}
-
-	#
 	# whole file: use of IGNOREFILES
 	#
 	print "OK: checking for use of IGNOREFILES.\n" if ($verbose);
@@ -1344,11 +1510,22 @@
 					"for more details)");
 			}
 			if ($plist_file =~ m|\.core$| && $plist_file !~ /^\@/) {
-				&perror("WARN", "", -1, "this port installs a file which ".
+				&perror("WARN", "", -1, "PLIST_FILES: this port installs a file which ".
 					"ends in \".core\".  This file may be deleted if ".
 					"daily_clean_disks_enable=\"YES\" in /etc/periodic.conf.  ".
 					"If possible, install this file with a different name.");
 			}
+			if ($plist_file =~ m|^share/icons/.*/| &&
+				$makevar{INSTALLS_ICONS} eq '' &&
+		        needs_installs_icons()) {
+				&perror("WARN", "", -1, "PLIST_FILES: installing icons, ".
+					"please define INSTALLS_ICONS as appropriate");
+			}
+			if ($plist_file =~ /%%[\w_\d]+%%/) {
+				&perror("FATAL", "", -1, "PLIST_FILES: files cannot contain ".
+					"%%FOO%% variables.  Use make variables and logic instead");
+			}
+
 		}
 	}
 
@@ -1458,6 +1635,8 @@
 		CFLAGS
 		CMAKE_OFF
 		CMAKE_ON
+		CMAKE_BOOL_OFF
+		CMAKE_BOOL
 		CONFIGURE_ENABLE
 		CONFIGURE_ENV
 		CONFIGURE_OFF
@@ -1479,6 +1658,8 @@
 		PLIST_FILES
 		USE
 		USES
+		VARS
+		VARS_OFF
 	);
 
 	my $m = join("|", @options_helpers);
@@ -1498,6 +1679,16 @@
 				}
 			}
 		}
+		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};
@@ -1506,13 +1697,34 @@
 		my %seen = ();
 		@popt = grep { !$seen{$_}++ } @popt;
 	}
+	foreach my $i (@popt) {
+		if ($i eq 'PORTDOCS') {
+			if (!grep(/^DOCS$/, @opt)) {
+				&perror("FATAL", $file, -1, "PORTDOCS appears in plist ".
+					"but DOCS is not listed in OPTIONS_DEFINE.");
+			}
+		} elsif ($i eq 'PORTEXAMPLES') {
+			if (!grep(/^EXAMPLES$/, @opt)) {
+				&perror("FATAL", $file, -1, "PORTEXAMPLES appears in plist ".
+					"but EXAMPLES is not listed in OPTIONS_DEFINE.");
+			}
+		}
+	}
+
 	foreach my $i ((@opt, @aopt)) {
 		# skip global options
 		next if ($i eq 'DOCS' or $i eq 'NLS' or $i eq 'EXAMPLES' or $i eq 'IPV6' or $i eq 'X11' or $i eq 'DEBUG');
 		if (!grep(/^$i$/, (@mopt, @popt))) {
-			if ($whole !~ /\n${i}_($m)(.)?=[^\n]+/) {
-				&perror("WARN", $file, -1, "$i is listed in ".
+			if ($whole !~ /\n${i}_($m)(_\w+)?(.)?=[^\n]+/) {
+				if (!$slaveport) {
+					&perror("WARN", $file, -1, "$i is listed in ".
 						"OPTIONS_DEFINE, but no PORT_OPTIONS:M$i appears.");
+				} else {
+					&perror("WARN", $file, -1, "$i is listed in ".
+						"OPTIONS_DEFINE, but no PORT_OPTIONS:M$i appears ".
+						"in this slave Makefile.  Make sure it appears in ".
+						"the master's Makefile.");
+				}
 			}
 		}
 	}
@@ -1531,7 +1743,7 @@
 	#
 	print "OK: checking DESKTOP_ENTRIES for \${TRUE}/\${FALSE}.\n" if ($verbose);
 	$desktop_entries = &get_makevar_raw('DESKTOP_ENTRIES');
-	if ($desktop_entries =~ /\${TRUE}/ or $desktop_entries =~ /\${FALSE}/ or
+	if ($desktop_entries =~ /\$\{TRUE}/ or $desktop_entries =~ /\$\{FALSE}/ or
 	    $desktop_entries =~ /\"true\"/ or $desktop_entries =~ /\"false\"/) {
 		&perror("FATAL", $file, -1, "Use true/false (without quotes) instead of \${TRUE}/\${FALSE} in DESKTOP_ENTRIES.");
 	}
@@ -1611,6 +1823,13 @@
 			"with a lowercase letter and end without a period.");
 	}
 
+	if ($whole =~ /\nBROKEN[+?]=[ \t]+[^a-z \t]/ ||
+		$whole =~ /^BROKEN[+?]?=[ \t]+.*\.$/m) {
+		my $lineno = &linenumber($`);
+		&perror("WARN", $file, $lineno, "BROKEN messages should begin ".
+			"with a lowercase letter and end without a period.");
+	}
+
 	#
 	# whole file: PKGNAME
 	#
@@ -1636,16 +1855,22 @@
 	}
 
 	#
-	# whole file: Check if USES is sorted
+	# whole file: Check if some macros are sorted
 	#
-	print "OK: checking to see if USES is sorted.\n" if ($verbose);
-	while ($whole =~ /\nUSES.=\s*(.+)\n/g) {
-		my $lineno = &linenumber($`);
-		my $srex = $1;
-		my @suses = sort(split / /, $srex);
-		if (join(" ", @suses) ne $srex) {
-			&perror("WARN", $file, $lineno, "the options to USES are not ".
-				"sorted.  Please consider sorting them.");
+	my @macros_to_sort = qw(
+	    ONLY_FOR_ARCHS
+		NOT_FOR_ARCHS
+	);
+	print "OK: checking to see if certain macros are sorted.\n" if ($verbose);
+	foreach my $sorted_macro (@macros_to_sort) {
+		while ($whole =~ /\n$sorted_macro.?=\s*(.+)\n/g) {
+			my $lineno = &linenumber($`);
+			my $srex = $1;
+			my @smacros = sort(split / /, $srex);
+			if (join(" ", @smacros) ne $srex) {
+				&perror("WARN", $file, $lineno, "the arguments to $sorted_macro ".
+					"are not sorted.  Please consider sorting them.");
+			}
 		}
 	}
 
@@ -1659,6 +1884,14 @@
 	}
 
 	#
+	# whole file: using INSTALLS_ICONS when it is not wanted
+	#
+	if (!($makevar{INSTALLS_ICONS} eq '') &&
+		!needs_installs_icons()) {
+		&perror("WARN", $file, -1, "INSTALLS_ICONS is set, but should not be.");
+	}
+
+	#
 	# whole file: EXPIRATION_DATE
 	#
 	print "OK: checking for valid EXPIRATION_DATE.\n" if ($verbose);
@@ -1795,7 +2028,7 @@
 	$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}';
@@ -1817,6 +2050,7 @@
 		# XXX This is a hack.  Really, we should break $j up into individual
 		# lines, and go through each one.
 		while ($j =~ /^(.*\b$i\b.*)$/gm) {
+			my $lineno = &linenumber($`);
 			my $curline = $1;
 			my $dte_test = $curline;
 			$dte_test =~ s/^\s+//g;
@@ -1823,23 +2057,23 @@
 			if ($desktop_entries =~ /\Q$dte_test\E$/) {
 				next;
 			}
-			my $lineno = &linenumber($`);
 			if ($curline =~ /(?:^|\s)[\@\-]{0,2}$i(?:$|\s)/
 				&& $curline !~ /^[A-Z]+_TARGET[?+]?=[^\n]+$i/m
 				&& $curline !~ /^[A-Z]+_INSTALL_TARGET[?+]?=[^\n]+$i/m
-				&& $curline !~ /^IGNORE(.)?=[^\n]+$i/m
-				&& $curline !~ /^BROKEN(.)?=[^\n]+$i/m
+				&& $curline !~ /^IGNORE(_[\w\d]+)?(.)?=[^\n]+$i/m
+				&& $curline !~ /^BROKEN(_[\w\d]+)?(.)?=[^\n]+$i/m
 				&& $curline !~ /^RESTRICTED(.)?=[^\n]+$i/m
 				&& $curline !~ /^NO_PACKAGE(.)?=[^\n]+$i/m
 				&& $curline !~ /^NO_CDROM(.)?=[^\n]+$i/m
 				&& $curline !~ /^MAINTAINER(.)?=[^\n]+$i/m
 				&& $curline !~ /^CATEGORIES(.)?=[^\n]+$i/m
-				&& $curline !~ /^USES(.)?=[^\n]+$i/m
+				&& $curline !~ /^(\w+)?USES(.)?=[^\n]+$i/m
 				&& $curline !~ /^WX_COMPS(.)?=[^\n]+$i/m
-				&& $curline !~ /^ONLY_FOR_ARCHS_REASON(.)?=[^\n]+$i/m
-				&& $curline !~ /^NOT_FOR_ARCHS_REASON(.)?=[^\n]+$i/m
+				&& $curline !~ /^ONLY_FOR_ARCHS_REASON(_[\w\d]+)?(.)?=[^\n]+$i/m
+				&& $curline !~ /^NOT_FOR_ARCHS_REASON(_[\w\d]+)?(.)?=[^\n]+$i/m
 				&& $curline !~ /^SHEBANG_FILES(.)?=[^\n]+$i/m
 				&& $curline !~ /^[A-Z0-9_]+_DESC=[^\n]+$i/m
+				&& $curline !~ /#.*?$i/m
 				&& $curline !~ /^\s*#.+$/m
 				&& $curline !~ /\$\{MAKE_CMD\}.*\binstall\b/m
 				&& $curline !~ /\-\-$i/m
@@ -1890,8 +2124,8 @@
 	my %pathnames = ();
 	print "OK: checking for paths that have macro replacements.\n"
 		if ($verbose);
-	$pathnames{'${PREFIX}/share/java/classes'} = 'JAVADIR';
-	$pathnames{'${PREFIX}/share/java'} = 'JAVASHAREDIR';
+	$pathnames{'$\{PREFIX\}/share/java/classes'} = 'JAVADIR';
+	$pathnames{'$\{PREFIX\}/share/java'} = 'JAVASHAREDIR';
 	foreach my $i (keys %pathnames) {
 		my $lineno = &linenumber($`);
 		if ($j =~ m|$i|gm) {
@@ -1905,7 +2139,7 @@
 	#
 	print "OK: checking for compression arguments passed to \${GZIP_CMD}.\n"
 		if ($verbose);
-	if ($j =~ /\${GZIP_CMD}\s+-(\w+(\s+-)?)*(\d)/) {
+	if ($j =~ /\$\{GZIP_CMD}\s+-(\w+(\s+-)?)*(\d)/) {
 		my $lineno = &linenumber($`);
 		&perror("WARN", $file, $lineno, "possible use of \"\${GZIP_CMD} -$3\" ".
 			"found. \${GZIP_CMD} includes \"-\${GZIP}\" which ".
@@ -1916,7 +2150,7 @@
 	# whole file: ${CHMOD} used
 	#
 	print "OK: checking for \${CHMOD}.\n" if ($verbose);
-	if ($j =~ /\n\s*\${CHMOD}/) {
+	if ($j =~ /\n\s*\$\{CHMOD}/) {
 		my $lineno = &linenumber($`);
 		&perror("WARN", $file, $lineno, "possible use of \"\${CHMOD}\" ".
 			"found. Use @(owner,group,mode) syntax or \@owner/\@group ".
@@ -1927,7 +2161,7 @@
 	# whole file: ${INSTALL} -o | -g used
 	#
 	print "OK: checking for \${INSTALL} -o | -g.\n" if ($verbose);
-	if ($j =~ /\n\s*\${INSTALL}(.*-\b(o|g)\b.*)/) {
+	if ($j =~ /\n\s*\$\{INSTALL}(.*-\b(o|g)\b.*)/) {
 		my $lineno = &linenumber($`);
 		&perror("WARN", $file, $lineno, "possible use of \"\${INSTALL} -o | -g\" ".
 			"found. Use @(owner,group,mode) syntax or \@owner/\@group ".
@@ -1939,7 +2173,7 @@
 	#
 	print "OK: checking for \${MKDIR} -p.\n"
 		if ($verbose);
-	if ($j =~ /\${MKDIR}\s+-p/) {
+	if ($j =~ /\$\{MKDIR}\s+-p/) {
 		my $lineno = &linenumber($`);
 		&perror("WARN", $file, $lineno, "possible use of \"\${MKDIR} -p\" ".
 			"found. \${MKDIR} includes ".
@@ -1963,7 +2197,7 @@
 	#
 	print "OK: checking for instances of \${MACHINE_ARCH} being test.\n"
 		if ($verbose);
-	if ($j =~ /\${MACHINE_ARCH}\s*[!=]=/) {
+	if ($j =~ /\$\{MACHINE_ARCH}\s*[!=]=/) {
 		my $lineno = &linenumber($`);
 		&perror("FATAL", $file, $lineno, "MACHINE_ARCH should never be tested ".
 			"directly; use ARCH instead.");
@@ -1985,9 +2219,9 @@
 	}
 
 	#
-	# whole file: ${LOCALBASE}/lib/perl5/site_perl/${PERL_VER}
+	# whole file: ${LOCALBASE}/lib/perl5/site_perl
 	#
-	if ($j =~ m'\${(?:LOCALBASE|PREFIX)}/lib/perl5/site_perl/\${PERL_VER}') {
+	if ($j =~ m'\$\{(?:LOCALBASE|PREFIX)}/lib/perl5/site_perl') {
 		my $lineno = &linenumber($`);
 		if ($1 !~ /PREFIX/) {
 			&perror("WARN", $file, $lineno, "possible use of \"\${LOCALBASE}/lib/perl5/site_perl\" ".
@@ -1999,7 +2233,7 @@
 	}
 
 	#
-	# whole file: check for misuse of FAKE with SITE_PERL and SITE_ARCH
+	# whole file: check for misuse of STAGE with SITE_PERL and SITE_ARCH
 	#
 	if ($j =~ m'\${FAKE_DESTDIR}\${SITE_PERL}') {
 		my $lineno = &linenumber($`);
@@ -2007,7 +2241,7 @@
 			"replaced by \${FAKE_DESTDIR}\${PREFIX}/\${SITE_PERL_REL}.");
 	}
 
-	if ($j =~ m'\${STAGEDIR}\${SITE_ARCH}') {
+	if ($j =~ m'\$\{STAGEDIR}\$\{SITE_ARCH}') {
 		my $lineno = &linenumber($`);
 		&perror("WARN", $file, $lineno, "\${STAGEDIR}\${SITE_ARCH} should be ".
 			"replaced by \${STAGEDIR}\${PREFIX}/\${SITE_ARCH_REL}.");
@@ -2023,9 +2257,28 @@
 	}
 
 	#
+	# whole file: USE_KDE check
+	#
+	if ($whole =~ /^USE_KDE[?:]?=\s*(.*)$/m) {
+		if ($makevar{USES} !~ /\bkde:[45]/) {
+			my $lineno = &linenumber($`);
+			&perror("WARN", $file, $lineno, "USE_KDE is defined without ".
+				"defining USES=kde:[45]");
+		}
+	}
+
+	#
+	# whole file: USES=pyqt:5
+	#
+	if ($makevar{USES} =~ /\bpyqt:5/ && $whole !~ /^USE_PYQT[?:]?=\s(.*)$/m) {
+		&perror("WARN", $file, -1, "When USES=pyqt:5 is defined, you must also define ".
+			"USE_PYQT=xxxx");
+	}
+
+	#
 	# whole file: USE_GCC checks
 	#
-	if ($whole =~ /^USE_GCC[?:]?=\s*(.*)$/m) {
+	if ($whole =~ /^USE_GCC[?:]?=\s*([^\s#]*).*$/m) {
 		my $lineno = &linenumber($`);
 		my $gcc_val = $1;
 		if ($gcc_val eq 'any' || $gcc_val eq 'yes') {
@@ -2067,7 +2320,7 @@
 	#
 	# whole file: check for USE_ANT and USES=gmake both defined
 	#
-	if ($use_ant && $makevar{USES} !~ /\bgmake\b/) {
+	if ($use_ant && $makevar{USES} =~ /\bgmake\b/) {
 		&perror("WARN", $file, -1, "a port shall not define both USE_ANT ".
 			"and USES[+]=gmake");
 	}
@@ -2119,6 +2372,26 @@
 	}
 
 	#
+	# whole file: check for redundant SHEBANG_LANGs
+	#
+	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 ($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.");
+			}
+		}
+	}
+
+	#
 	# whole file: CONFIGURE_ENV
 	#
 	if ($whole =~ /\nCONFIGURE_ENV[?:+]?=\s*([^\\\n]+(\\\n[^\\\n]+)*)/) {
@@ -2215,9 +2488,7 @@
 	#
 	# slave port check
 	#
-	my $masterdir = $makevar{MASTERDIR};
-	if ($masterdir ne '' && $masterdir ne $makevar{'.CURDIR'}) {
-		$slaveport = 1;
+	if ($slaveport) {
 		print "OK: slave port detected, checking for inclusion of $masterdir/Makefile.\n"
 			if ($verbose);
 		if ($whole =~ /^\.\s*include\s*[<"]bsd\.port(?:\.post)?\.mk[">]/m) {
@@ -2486,14 +2757,28 @@
 						if ($verbose);
 				}
 			} else {
-				print "OK: non-URL \"$i\" ok.\n"
-					if ($verbose);
+				my $good_ms = 1;
+				foreach my $mss (split(/\s+/, $makevar{MASTER_SITES_SUBDIRS})) {
+					my ($ms, $sd) = split(/:/, $mss);
+					if ($i =~ /^$ms/ && $i ne $ms) {
+						my $ip = $i;
+						$ip =~ s/^$ms\///;
+						my $exp_sd = get_makevar($ip);
+						if ($exp_sd eq $sd) {
+							&perror("WARN", $file, -1, "typically when you specify magic site $ms ".
+								"you do not need anything else as $sd is assumed");
+							$good_ms = 0;
+						}
+					}
+				}
+				if ($good_ms) {
+					print "OK: non-URL \"$i\" ok.\n"
+						if ($verbose);
+				}
 				# Assume variables contain an ftp/http site.
 				$ftphttp = 1;
 			}
 		}
-		&perror("WARN", $file, -1, "no ftp/http mirror in MASTER_SITES ".
-			"for users behind a proxy.") if ($urlseen && ! $ftphttp);
 	} else {
 		&perror("WARN", $file, -1, "no MASTER_SITES found. is it ok?");
 	}
@@ -2603,13 +2888,6 @@
 		foreach my $conflict (split ' ', $makevar{CONFLICTS}) {
 			`$pkg_version -T '$makevar{PKGNAME}' '$conflict'`;
 			my $selfconflict = !$?;
-			if ($conflict !~ /(?:[<>=]|[]?*]$)/) {
-				&perror("WARN", "", -1, "Conflict \"$conflict\" specified too narrow. ".
-					"You should end it with a wildcard (-[0-9]*).");
-			} elsif ($conflict !~ /[<>=-][^-]*[0-9][^-]*$/) {
-				&perror("WARN", "", -1, "Conflict \"$conflict\" specified too broad. ".
-					"You should end it with a version number fragment (-[0-9]*).");
-			}
 			if ($selfconflict) {
 				&perror("FATAL", "", -1, "Package conflicts with itself. ".
 					"You should remove \"$conflict\" from CONFLICTS.");
@@ -2802,7 +3080,7 @@
 	#
 	print "OK: checking fourth section of $file (LICENSE).\n"
 		if ($verbose);
-	$tmp = $sections[$idx];
+	$tmp = $sections[$idx] // '';
 
 	if ($makevar{LICENSE}) {
 		&checkorder('LICENSE', $tmp, $file, qw(
@@ -2837,14 +3115,40 @@
 	}
 
 	#
-	# 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++;
+	}
+
+	foreach my $i (@linestocheck) {
+		$tmp =~ s/$i[?+:]?=[^\n]+\n//g;
+	}
+
+	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] // '';
+
 	# Check for direct assignment of BUILD_DEPENDS to RUN_DEPENDS.
-	if ($tmp =~ /\nRUN_DEPENDS=[ \t]*\${BUILD_DEPENDS}/) {
+	if ($tmp =~ /\nRUN_DEPENDS=[ \t]*\$\{BUILD_DEPENDS}/) {
 		&perror("FATAL", $file, -1, "RUN_DEPENDS should not be set to ".
 			"\${BUILD_DEPENDS} as \${BUILD_DEPENDS} includes other ".
 			"implicit dependencies.  Instead, copy the explicit dependencies ".
@@ -2864,9 +3168,17 @@
 		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++;
@@ -2956,7 +3268,7 @@
 
 	# various MAN'uals related checks
 	if ($makevar{USE_PERL5} =~ /\b(configure|modbuild|modbuildtiny)\b/
-		&& $tmp =~ /\nMAN3PREFIX=\s*\${PREFIX}\/lib\/perl5\/\${PERL_VER/) {
+		&& $tmp =~ /\nMAN3PREFIX=\s*\$\{PREFIX}\/lib\/perl5\/\$\{PERL_VER/) {
 		&perror("WARN", $file, -1, "MAN3PREFIX is ".
 			"\"\${PREFIX}/lib/perl5/\${PERL_VERSION}\" ".
 			"when USE_PERL5=configure|modbuild|modbuildtiny is set.  You do not need to specify it.");
@@ -3032,22 +3344,7 @@
 				"should be a corresponding file in the files/ directory.");
 		} else {
 			foreach my $i (split(/\s/, $subr_value)) {
-				my $mvar;
-				if ($i =~ /\$\{([^}]+)\}/) {
-					$mvar = $1;
-					if (defined($makevar{$mvar})) {
-						$i = $makevar{$mvar};
-					} else {
-						$i = &getMakevar($mvar);
-					}
-				}
-				if ($i ne '' && ! -f "files/$i.in") {
-					&perror("FATAL", $file, -1, "$i listed in USE_RC_SUBR, ".
-						"but files/$i.in is missing.");
-				} elsif ($i eq '' && $mvar && $mvar ne '') {
-					&perror("WARN", $file, -1, "possible undefined make variable ".
-						"$mvar used as the value for USE_RC_SUBR.");
-				} elsif ($i ne '' && -f "files/$i.in") {
+				if ($i ne '' && -f "files/$i.in") {
 					if (open(RCIN, "< files/$i.in")) {
 						my @rccontents = <RCIN>;
 						my $found_provide = 0;
@@ -3066,8 +3363,34 @@
 						close(RCIN);
 					}
 				}
+			}
+		}
+	}
 
+	# check for health of SUB_FILES
+
+	if ($tmp =~ /\nSUB_FILES=([\s]*)(.*)/) {
+		my $subr_value = $makevar{SUB_FILES};
+		if ($subr_value eq '') {
+			$subr_value = $2;
+		}
+		foreach my $i (split(/\s/, $subr_value)) {
+			my $mvar;
+			if ($i =~ /\$\{([^}]+)\}/) {
+				$mvar = $1;
+				if (defined($makevar{$mvar})) {
+					$i = $makevar{$mvar};
+				} else {
+					$i = &get_makevar($mvar);
+				}
 			}
+			if ($i ne '' && ! -f "files/$i.in") {
+				&perror("FATAL", $file, -1, "$i listed in SUB_FILES/USE_RC_SUBR, ".
+					"but files/$i.in is missing.");
+			} elsif ($i eq '' && $mvar && $mvar ne '') {
+				&perror("WARN", $file, -1, "possible undefined make variable ".
+					"$mvar used as the value for SUB_FILES/USE_RC_SUBR.");
+			}
 		}
 	}
 
@@ -3188,14 +3511,13 @@
 
 sub checkearlier {
 	my($file, $str, @varnames) = @_;
-	my($i);
 
 	$str //= '';
 
-	print "OK: checking items that has to appear earlier.\n" if ($verbose);
+	print "OK: checking items that have 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.");
 		}
 	}
 }
@@ -3206,7 +3528,7 @@
 
 	@lines = split /\n/, $text;
 
-	return scalar(@lines);
+	return scalar(@lines) - 1;
 }
 
 sub abspathname {
@@ -3239,6 +3561,11 @@
 				# MASTER_SITE_SUBDIR lines are ok.
 				$i = '';
 			}
+			if ($s =~ /\$\{[^}]*?\Q$i\E/) {
+				# 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.*$//;
@@ -3299,7 +3626,7 @@
 sub get_makevar {
 	my($cmd, $result);
 
-	$cmd = join(' -V ', "make $makeenv MASTER_SITE_BACKUP=''", @_);
+	$cmd = join(' -V ', "make $makeenv MASTER_SITE_BACKUP=''", map { "'$_'" } @_);
 	$result = `$cmd`;
 	chomp $result;
 
@@ -3314,7 +3641,7 @@
 sub get_makevar_raw {
 	my($cmd, $result);
 
-	$cmd = join(' -XV ', "make $makeenv MASTER_SITE_BACKUP=''", @_);
+	$cmd = join(' -XV ', "make $makeenv MASTER_SITE_BACKUP=''", map { "'$_'" } @_);
 	$result = `$cmd`;
 	chomp $result;
 
@@ -3354,7 +3681,7 @@
 	if ($url !~ m#^\w+://#) {
 		&perror("WARN", $file, -1, "\"$url\" doesn't appear to be a URL to me.");
 	}
-	if ($url !~ m#/(:[^/:]+)?$#) {
+	if ($url !~ m#/(:[^/:]+)?$# && $url !~ m#:$#) {
 		&perror("FATAL", $file, -1, "URL \"$url\" should ".
 			"end with \"/\" or a group name (e.g. :something).");
 	}
@@ -3363,6 +3690,13 @@
 				"extra \":\".");
 	}
 }
+
+# GNOME wants INSTALL_ICONS, but Qt-based applications, including KDE, don't.
+# Be pessimistic: everything needs it unless we know it doesn't.
+sub needs_installs_icons {
+	return $makevar{USE_QT5} eq ''
+}
+
 sub TRUE {1;}
 
 # Local variables:



More information about the Midnightbsd-cvs mailing list