git: 9b67608cf5b3 - main - ports-mgmt/portlint: Update to 2.23.0

From: Joe Marcus Clarke <marcus_at_FreeBSD.org>
Date: Wed, 24 Dec 2025 16:32:38 UTC
The branch main has been updated by marcus:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9b67608cf5b34ab023c6c377ac0d8f2bf6c7d596

commit 9b67608cf5b34ab023c6c377ac0d8f2bf6c7d596
Author:     Joe Marcus Clarke <marcus@FreeBSD.org>
AuthorDate: 2025-12-24 16:29:05 +0000
Commit:     Joe Marcus Clarke <marcus@FreeBSD.org>
CommitDate: 2025-12-24 16:29:05 +0000

    ports-mgmt/portlint: Update to 2.23.0
    
    * Soften .desktop error for both plist and Makefile items [1]
    * Check COMMENT for non-ASCII characters [2]
    * Ensure the order of pre-TARGET, do-TARGET, and post-TARGET sections
      [3]
    * Check for duplicates in LICENSE_PERMS [4]
    
    PR:             291017 [1]
                    289975 [2]
                    284951 [3]
                    284644 [4]
---
 ports-mgmt/portlint/Makefile        |  2 +-
 ports-mgmt/portlint/src/portlint.pl | 61 +++++++++++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile
index ad1eb8e48483..afa898e6281f 100644
--- a/ports-mgmt/portlint/Makefile
+++ b/ports-mgmt/portlint/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	portlint
-PORTVERSION=	2.22.8
+PORTVERSION=	2.23.0
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none
diff --git a/ports-mgmt/portlint/src/portlint.pl b/ports-mgmt/portlint/src/portlint.pl
index 7f3587267eff..4b1e0fcc397b 100644
--- a/ports-mgmt/portlint/src/portlint.pl
+++ b/ports-mgmt/portlint/src/portlint.pl
@@ -28,6 +28,8 @@ use IPC::Open2;
 use File::Basename;
 use Term::ANSIColor qw(:constants);
 use POSIX qw(strftime);
+use open qw(:std :utf8);
+use utf8;
 
 sub perror($$$$);
 our ($opt_a, $opt_A, $opt_b, $opt_C, $opt_c, $opt_g, $opt_h, $opt_m, $opt_t, $opt_v, $opt_M, $opt_N, $opt_B, $opt_V, @ALLOWED_FULL_PATHS);
@@ -51,8 +53,8 @@ $portdir = '.';
 
 # version variables
 my $major = 2;
-my $minor = 22;
-my $micro = 8;
+my $minor = 23;
+my $micro = 0;
 
 # default setting - for FreeBSD
 my $portsdir = '/usr/ports';
@@ -1357,6 +1359,7 @@ sub checkmakefile {
 	my $optused = 0;
 	my $desktop_entries = '';
 	my $conflicts = "";
+	my %targ_hashes = ();
 
 	my $masterdir = $makevar{MASTERDIR};
 	if ($masterdir ne '' && $masterdir ne $makevar{'.CURDIR'}) {
@@ -1557,10 +1560,10 @@ sub checkmakefile {
 					"%%FOO%% variables.  Use make variables and logic instead");
 			}
 			if ($plist_file =~ m|\.desktop$| && $makevar{USES} !~ /\bdesktop-file-utils\b/) {
-				&perror("FATAL", "", -1, "PLIST_FILES: this port installs .desktop files. ".
-					"please add `desktop-file-utils` to USES.");
-			}
-
+            	&perror("WARN", "", -1, "this port installs .desktop files. ".
+                	"If the .desktop file(s) installed contain ``MimeType='', ".
+                	"you must add `desktop-file-utils` to USES.");
+            }
 		}
 	}
 
@@ -3221,6 +3224,9 @@ MAINTAINER COMMENT WWW
 		if (length($makevar{COMMENT}) > 70) {
 			&perror("WARN", $file, -1, "COMMENT exceeds 70 characters limit.");
 		}
+		if ($makevar{COMMENT} =~ /([^[:ascii:]])/) {
+			&perror("WARN", $file, -1, "COMMENT contains non-ASCII characters (e.g., $1).");
+		}
 	}
 
 	# check WWW
@@ -3294,6 +3300,15 @@ MAINTAINER COMMENT WWW
 			}
 		}
 
+		# Check for dups in LICENSE_PERMS
+		my @lic_perms = split(/\s+/, $makevar{LICENSE_PERMS});
+		my %lperm_seen;
+		foreach my $lic (@lic_perms) {
+    		if ($lperm_seen{$lic}++) {
+				&perror("WARN", $file, -1, "license permission $lic is duplicated in LICENSE_PERMS.");
+    		}
+		}
+
 		# Last-ditch check to make sure the license is sanely defined.
 		my $lic_check = system("make check-license 2>&1 >/dev/null");
 		if ($lic_check) {
@@ -3587,6 +3602,40 @@ TEST_DEPENDS FETCH_DEPENDS DEPENDS_TARGET
 			"'do-build:' target when defining USE_ANT");
 	}
 
+	# Check the right sequence of pre-, do-, post-.
+	foreach my $targ_prefix ("pre", "do", "post") {
+		if ($tmp =~ /^${targ_prefix}-([^:]+):/m) {
+			my $targ_lineno = &linenumber($`);
+			my $targ = $1;
+			my $targ_hash;
+			if (!$targ_hashes{$targ}) {
+				$targ_hash = {};
+			} else {
+				$targ_hash = $targ_hashes{$targ};
+			}
+
+			if ($targ_hash->{$targ_prefix}) {
+				# Duplicate target!
+				&perror("FATAL", $file, -1, "Target ${targ_prefix}-${targ} is duplicated!");
+			} else {
+				$targ_hash->{$targ_prefix} = $targ_lineno;
+			}
+
+			$targ_hashes{$targ} = $targ_hash;
+		}
+	}
+
+	foreach my $targ (keys %targ_hashes) {
+		my $tpre = $targ_hashes{$targ}->{'pre'} // "-inf";
+		my $tdo = $targ_hashes{$targ}->{'do'} // $tpre + 1;
+		my $tpost = $targ_hashes{$targ}->{'post'} // $tdo + 1;
+
+		if ($tpre > $tdo || $tpre > $tpost || $tdo > $tpost) {
+			&perror("FATAL", $file, -1, "Target ``$targ'' violates the pre-${targ}, do-${targ}, ".
+				"post-${targ} order.")
+		}
+	}
+
 	#
 	# check for deprecated use of USE_RC_SUBR, and current syntax
 	#