[Midnightbsd-cvs] mports: ports-mgmt/portlint: * Add some USE_GCC checks [1] * Check to

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Sep 13 16:45:05 EDT 2008


Log Message:
-----------
* Add some USE_GCC checks [1]
* Check to make sure pkg-descr lines do not end with CRLF [2]
* Warn against using != in assignments [2]
* Check for a valid WWW syntax in pkg-descr [2]

Modified Files:
--------------
    mports/ports-mgmt/portlint:
        Makefile (r1.7 -> r1.8)
    mports/ports-mgmt/portlint/src:
        portlint.pl (r1.6 -> r1.7)

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mports/ports-mgmt/portlint/Makefile,v
retrieving revision 1.7
retrieving revision 1.8
diff -L ports-mgmt/portlint/Makefile -L ports-mgmt/portlint/Makefile -u -r1.7 -r1.8
--- ports-mgmt/portlint/Makefile
+++ ports-mgmt/portlint/Makefile
@@ -9,7 +9,7 @@
 #
 
 PORTNAME=	portlint
-PORTVERSION=	2.9.7
+PORTVERSION=	2.9.10
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none
Index: portlint.pl
===================================================================
RCS file: /home/cvs/mports/ports-mgmt/portlint/src/portlint.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -L ports-mgmt/portlint/src/portlint.pl -L ports-mgmt/portlint/src/portlint.pl -u -r1.6 -r1.7
--- ports-mgmt/portlint/src/portlint.pl
+++ ports-mgmt/portlint/src/portlint.pl
@@ -47,7 +47,7 @@
 # version variables
 my $major = 2;
 my $minor = 9;
-my $micro = 7;
+my $micro = 10;
 
 sub l { '[{(]'; }
 sub r { '[)}]'; }
@@ -238,19 +238,12 @@
 my @site_groups = grep($_ = /^MASTER_SITE_(\w+)/ && $1, <MK>);
 close(MK);
 
-$cmd = join(' -V MASTER_SITE_', "make $makeenv -f - all", @site_groups);
+$cmd = join(' -V MASTER_SITE_', "make $makeenv ", @site_groups);
 
 $i = 0;
 
 open2(\*IN, \*OUT, $cmd);
 
-print OUT <<EOF;
-all:
-	# do nothing
-
-.include "$sites_mk"
-EOF
-
 close(OUT);
 
 while (<IN>) {
@@ -612,7 +605,20 @@
 	open(IN, "< $file") || return 0;
 	while (<IN>) {
 		$tmp .= $_;
-		chomp || &perror("WARN", $file, -1, "should terminate in '\n'.");
+		chomp || &perror("WARN", $file, -1, "lines should terminate with a ".
+			"newline (i.e. '\\n').");
+		if (/
$/) {
+			&perror("WARN", $file, -1, "lines should not contain carriage ".
+				"returns.  Strip all carriage returns (e.g. run dos2unix) ".
+				"in $file.");
+		}
+		if (/^WWW:\s*(\S*)/) {
+			my $wwwurl = $1;
+			if ($wwwurl !~ m|^http://|) {
+				&perror("WARN", $file, -1, "WWW URL, $wwwurl should begin ".
+					"with \"http://\".");
+			}
+		}
 		$linecnt++;
 		$longlines++ if ($maxchars{$file} < length);
 	}
@@ -867,6 +873,12 @@
 			}
 		}
 
+		if ($_ =~ m{^%%PORT(\w+)%%(.*?)%%(\w+)DIR%%(.*)$} and $1 ne $3) {
+			&perror("WARN", $file, $., "Do not mix %%PORT$1%% with %%$3DIR%%. ".
+				"Use '%%PORT$3%%$2%%$3DIR%%$4' instead and update Makefile ".
+				"accordingly.");
+		}
+
 		if ($_ =~ m#man/([^/]+/)?man([$manchapters])/([^\.]+\.[$manchapters])(\.gz)?$#) {
 			if ($4 eq '') {
 				$plistman{$2} .= ' ' . $3;
@@ -1149,6 +1161,18 @@
 	}
 
 	#
+	# whole file: use of !=
+	#
+	print "OK: checking for use of !=.\n" if ($verbose);
+	if ($whole =~ /^[\w\d_]+\!=/m) {
+		my $lineno = &linenumber($`);
+		&perror("WARN", $file, $lineno, "use of != in assignments is almost ".
+			"never a good thing to do.  Try to avoid using them.  See ".
+			"http://lists.freebsd.org/pipermail/freebsd-ports/2008-July/049777.html ".
+			"for some helpful hints on what to do instead.");
+	}
+
+	#
 	# whole file: use of .elseif
 	#
 	print "OK: checking for use of .elseif.\n" if ($verbose);
@@ -1358,6 +1382,16 @@
 	}
 
 	#
+	# whole file: USE_GETOPT_LONG
+	#
+	print "OK: checking for USE_GETOPT_LONG.\n" if ($verbose);
+	if ($whole =~ /\nUSE_GETOPT_LONG.?=/) {
+		my $lineno = &linenumber($`);
+		&perror("WARN", $file, $lineno, "USE_GETOPT_LONG is now obsolete. ".
+			"You can safely remove this macro from your Makefile.");
+	}
+
+	#
 	# whole file: EXPIRATION_DATE
 	#
 	print "OK: checking for valid EXPIRATION_DATE.\n" if ($verbose);
@@ -1639,6 +1673,29 @@
 	}
 
 	#
+	# whole file: USE_GCC checks
+	#
+	if ($whole =~ /^USE_GCC[?:]?=\s*(.*)$/m) {
+		my $lineno = &linenumber($`);
+		my $gcc_val = $1;
+		if ($gcc_val =~ /3\.[234]\+/) {
+			&perror("WARN", $file, $lineno, "USE_GCC=3.2+, USE_GCC=3.3+, ".
+				"and USE_GCC=3.4+ are noops on all currently (and future) ".
+				"supported versions of FreeBSD.  Do not use them.");
+		} elsif ($gcc_val eq "4.1+") {
+			&perror("WARN", $file, $lineno, "USE_GCC=4.2+ is recommended ".
+				"over USE_GCC=4.1+ since the former is the system compiler ".
+				"for FreeBSD 7.X.");
+		} elsif ($gcc_val !~ /\+/) {
+			&perror("WARN", $file, $lineno, "Setting a specific version for ".
+				"USE_GCC should only be done as a last resort.  Unless you ".
+				"have confirmed this port does not build with later ".
+				"versions of GCC, please use USE_GCC=$gcc_val+.");
+		}
+	}
+
+
+	#
 	# whole file: USE_JAVA check
 	#
 	if ($whole =~ /^USE_JAVA[?:]?=\s*(.*)$/m) {
@@ -2356,6 +2413,11 @@
 
 				print "OK: checking dependency value for $j.\n"
 					if ($verbose);
+				if ($k =~ /\${((PATCH_|EXTRACT_|LIB_|BUILD_|RUN_|FETCH_)*DEPENDS)}/) {
+					&perror("WARN", $file, -1, "do not set $j to $k. ".
+						"Instead, explicity list out required $j dependencies.");
+				}
+
 				if (($j ne 'DEPENDS'
 				  && scalar(@l) != 2 && scalar(@l) != 3)) {
 					&perror("WARN", $file, -1, "wrong dependency value ".
@@ -2407,13 +2469,6 @@
 						"USE_QT.");
 				}
 
-				# check USE_GETOPT_LONG
-				if ($m{'dep'} =~ /^(gnugetopt\.\d)+$/) {
-					&perror("WARN", $file, -1, "dependency to $1 ".
-							"listed in $j.  consider using ".
-							"USE_GETOPT_LONG.");
-				}
-
 				# check LIBLTDL
 				if ($m{'dep'} =~ /^(ltdl\.\d)+$/) {
 					&perror("WARN", $file, -1, "dependency to $1 ".


More information about the Midnightbsd-cvs mailing list