ports/174697: [patch] ports-mgmt/portlint add basic OptionsNG support, deprecate USE_GNOME=pkgconfig

Alex Kozlov spam at rm-rf.kiev.ua
Tue Dec 25 08:50:01 UTC 2012


>Number:         174697
>Category:       ports
>Synopsis:       [patch] ports-mgmt/portlint add basic OptionsNG support, deprecate USE_GNOME=pkgconfig
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 25 08:50:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Alex Kozlov
>Release:        RELENG_9
>Organization:
private
>Environment:
>Description:
- Add support for optionsNG
- Deprecate USE_GNOME=pkgconfig
- Add missing dot at the end of the sentence (cosmetic)


>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: portlint
@@ -196,8 +196,8 @@
 	WRKDIR WRKSRC NO_WRKSUBDIR SCRIPTDIR FILESDIR
 	PKGDIR COMMENT DESCR PLIST PKGCATEGORY PKGINSTALL PKGDEINSTALL
 	PKGREQ PKGMESSAGE DISTINFO_FILE .CURDIR USE_LDCONFIG USE_AUTOTOOLS
-	INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION PKGINSTALLVER
-	PLIST_FILES OPTIONS INSTALLS_OMF USE_GETTEXT USE_RC_SUBR
+	USE_GNOME INDEXFILE PKGORIGIN CONFLICTS PKG_VERSION PKGINSTALLVER
+	PLIST_FILES OPTIONS OPTIONS_DEFINE INSTALLS_OMF USE_GETTEXT USE_RC_SUBR
 	DIST_SUBDIR ALLFILES IGNOREFILES CHECKSUM_ALGORITHMS INSTALLS_ICONS
 	GNU_CONFIGURE CONFIGURE_ARGS MASTER_SITE_SUBDIR LICENSE LICENSE_COMB
 );
@@ -1374,6 +1374,7 @@
 	my($realwrksrc, $wrksrc, $nowrksubdir) = ('', '', '');
 	my(@mman, @pman);
 	my(@mopt, @oopt);
+	my(@nmopt, @noopt);
 	my($pkg_version, $versiondir, $versionfile) = ('', '', '');
 	my $useindex = 0;
 	my %deprecated = ();
@@ -1383,6 +1384,7 @@
 	my $options_mk_line = 0;
 	my $docsused = 0;
 	my $nlsused = 0;
+	my $newoptused = 0;
 
 	open(IN, "< $file") || return 0;
 	$rawwhole = '';
@@ -1522,8 +1524,17 @@
 	}
 
 	#
-	# whole file: USE_* used too late
+	# whole file: USE_* and others variables used too late
 	#
+	my @options_early = qw(
+		OPTIONS
+		OPTIONS_DEFAULT
+		OPTIONS_DEFINE
+		OPTIONS_EXCLUDE
+		OPTIONS_MULTI.*?
+		OPTIONS_SINGLE.*?
+	);
+
 	pos($whole) = 0;
 	if ($whole =~ /^\.include\s+<bsd\.port\.pre\.mk>$/gm) {
 		# Remember position
@@ -1546,11 +1557,10 @@
 
 		my @other_early = qw(
 			EMACS_PORT_NAME
-			OPTIONS
 		);
 
 		my $earlypattern = join('|', 'USE_(?:'.join('|', @use_early).')',
-			@other_early);
+			@other_early, @options_early);
 
 		while ($whole =~ /^($earlypattern)[+?:!]?=/gmo) {
 			my $lineno = &linenumber($`);
@@ -1559,18 +1569,42 @@
 		}
 	}
 
+	#
+	# whole file: check OPTIONS
+	#
+	# TODO: check OPTIONS_MULTI/OPTIONS_SINGLE
+	#
+	print "OK: checking OPTIONS.\n" if ($verbose);
 	pos($whole) = 0;
 	if ($whole =~ /^\.include\s+<bsd\.port\.options\.mk>$/gm) {
 		# Remember position
 		$options_mk_line = &linenumber($`) + 1;
 	}
+	pos($whole) = 0;
+	if ($whole =~ /^\.include\s+<bsd\.port\.options\.mk>$/gm) {
+		my $earlypattern = join('|', @options_early);
 
-	#
-	# whole file: check OPTIONS
-	#
+		while ($whole =~ /^($earlypattern)[+?]?=/gmo) {
+			my $lineno = &linenumber($`);
+			&perror("FATAL", $file, $lineno, "$1 is set after ".
+				"including bsd.port.options.mk.");
+		}
+	}
 	pos($whole) = 0;
-	print "OK: checking OPTIONS.\n" if ($verbose);
+	if ($whole =~ /\nOPTIONS_DEFINE[+?]?=/) {
+		$newoptused++;
+	}
 	@oopt = ($makevar{OPTIONS} =~ /(\w+)\s+\".*?\"\s+\w+/sg);
+	@noopt = split(/\s+/, $makevar{OPTIONS_DEFINE});
+	if (scalar(@oopt) && $newoptused) {
+		&perror("FATAL", $file, -1, "Both old and new OPTIONS are found. ".
+			"Remove one or another.");
+	}
+	if (scalar(@oopt)) {
+		&perror("WARN", $file, -1, "Use of OPTIONS is obsolete. Use the ".
+			"new options framework.");
+	}
+	pos($whole) = 0;
 	while ($whole =~ /\(?\s*WITH(?:OUT)?_(\w+)\s*\)?/mg) {
 		push @mopt, $1;
 		my $lineno = &linenumber($`) + 1;
@@ -1585,6 +1619,23 @@
 				"but neither WITH_$i nor WITHOUT_$i appears.");
 		}
 	}
+	if ($newoptused) {
+		pos($whole) = 0;
+		while ($whole =~ /PORT_OPTIONS:M(\w+)/mg) {
+			push @nmopt, $1;
+			my $lineno = &linenumber($`) + 1;
+			&perror("FATAL", $file, $lineno, "option $1 is used before ".
+				"including bsd.port.pre.mk or bsd.port.options.mk.")
+			if ($newoptused && $lineno < $pre_mk_line &&
+				$lineno < $options_mk_line);
+		}
+		foreach my $i (@noopt) {
+			if (!grep(/^$i$/, @nmopt)) {
+				&perror("WARN", $file, -1, "$i is listed in OPTIONS_DEFINE, ".
+					"but no PORT_OPTIONS:M$i appears.");
+			}
+		}
+	}
 	foreach my $i (@mopt) {
 		next if ($i eq 'NLS'); # skip WITHOUT_NLS
 		if (!grep(/^$i$/, @oopt)) {
@@ -1720,6 +1771,15 @@
 	}
 
 	#
+	# whole file: USE_GNOME=pkgconfig
+	#
+	print "OK: checking for USE_GNOME=pkgconfig.\n" if ($verbose);
+	if ($makevar{USE_GNOME} =~ /pkgconfig/) {
+		&perror("WARN", $file, -1, "USE_GNOME=pkgconfig is now obsolete. ".
+			"Use USE_PKGCONFIG instead.");
+	}
+
+	#
 	# whole file: EXPIRATION_DATE
 	#
 	print "OK: checking for valid EXPIRATION_DATE.\n" if ($verbose);
@@ -1769,7 +1829,7 @@
 		$docsused++;
 	}
 	if ($docsused > 1) {
-		&perror("FATAL", $file, -1, "Both NOPORTDOCS and PORT_OPTIONS:MDOCS are found ".
+		&perror("FATAL", $file, -1, "Both NOPORTDOCS and PORT_OPTIONS:MDOCS are found. ".
 			"Remove one or another.");
 	}
 
@@ -1790,7 +1850,7 @@
 		$nlsused++;
 	}
 	if ($nlsused > 1) {
-		&perror("FATAL", $file, -1, "Both WITHOUT_NLS and PORT_OPTIONS:MNLS are found ".
+		&perror("FATAL", $file, -1, "Both WITHOUT_NLS and PORT_OPTIONS:MNLS are found. ".
 			"Remove one or another.");
 	}
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list