From nobody Mon Nov 13 19:04:44 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4STf4X404lz50QDW; Mon, 13 Nov 2023 19:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4STf4X3QFjz4bm7; Mon, 13 Nov 2023 19:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699902284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JbTiP23BG5hFqDfmUyV24ZU1n9Ip/AkzCs+E5PXsr2w=; b=v/yNeSFDtrhOWEJu16KWvdjxiLaqriYY4amL/fiuVbYffqxsMsSJ8BeKcx6fqO7KFgAaW8 sKUAZpLG0ZKzGptJE3Bzlm4+tZRurCq3QnaozPU1lEEFWlicPxhbx0F2PB8HJFAJ1op1Lt wpxAYzsX9jwEh+jwAo66oOb9ULV0++OH1UODECCEkQIhXpU286F5SCFEE3SrN3VcDrtd+R F56etmJT+ETQv8JEJf4RSMdcXjeBX1/L88gzqtO0CQLiraChS5Sz95xf4/SHtcoX8bA/6M DKXTmOaeeAvCV6MRRCfblcW4GVEZZCNMZYTzSREiu413x6mJ1sGahpvk51cFBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699902284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JbTiP23BG5hFqDfmUyV24ZU1n9Ip/AkzCs+E5PXsr2w=; b=IKVvLrn5XJpCB71iU9yz1TkG/3CCYOGdzIRkFaSAEOcHetQ5zoKb1G2sA/gzaTYoZ8SHrX 1Aeqj0z2Yl6tK71vkH2pn3V0YVCnmUXPM1bqr8R+6TVmgBtFNML31ESTQ3GyA3kGvzSH+b OpPNUjnp1RWvRV+Me4mDgDoC8oms0FJXqzjBfHtiC9czMkAV1ZnVfT2RQ6vLIMFmbmKGDC OTFbUfnJtHtcBgRaAHd6fofUEDFScDAWsteNr6mLoRP8vQrnsZf4jrPPvDvFzwIcmKAqGu n/TQfAiEdp3SHVm5syaOIJ+ez7seKxxwMi7xPw8owZdTSSz3PA5QN9cJDGP3kg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699902284; a=rsa-sha256; cv=none; b=ug24A/04kKN2RMzlokfO/tY9R0SSb3jyyZQyrOf1eI76BHfRK0fdq+Xfn98AyHvaYczavn /CTVMJdXMjvajU9k6Ot/kwQsQeqklU6yV32RhFdCoeUdtNed2Hz9yH6QdJRJJwywXXuND9 9NTgPMuWlR0Z563V4/seQ7eklHer+lbYaugBg/GfETzg2xImocolVBhC+7tkoBw1Rwl5Kp 3wU+X64w1skEyf7u1t2A27QZr2eYSeI30DoLiDowmGsKFDCJLQ1DSAqg/xqsZ8KB1jm+AW iX+eEDvHXGlHfUKtl2BnypAXNk5Qs1RP43LDiIHY9BpoQlExkXCuv+rpZSAu0A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4STf4X2Rnsz339; Mon, 13 Nov 2023 19:04:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3ADJ4iiE028655; Mon, 13 Nov 2023 19:04:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ADJ4img028653; Mon, 13 Nov 2023 19:04:44 GMT (envelope-from git) Date: Mon, 13 Nov 2023 19:04:44 GMT Message-Id: <202311131904.3ADJ4img028653@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Joe Marcus Clarke Subject: git: 045f9995fb36 - main - ports-mgmt/portlint: Update to 2.21.0 List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: marcus X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 045f9995fb3624885bdae850d12eca43f7625732 Auto-Submitted: auto-generated The branch main has been updated by marcus: URL: https://cgit.FreeBSD.org/ports/commit/?id=045f9995fb3624885bdae850d12eca43f7625732 commit 045f9995fb3624885bdae850d12eca43f7625732 Author: Joe Marcus Clarke AuthorDate: 2023-11-13 19:02:19 +0000 Commit: Joe Marcus Clarke CommitDate: 2023-11-13 19:02:19 +0000 ports-mgmt/portlint: Update to 2.21.0 * Soften the desktop-file-utils message [1] * Avoid a bogus error on ports that append to DISTFILES. [2] * Colorize output for warnings and errors. [3] PR: 271623 [1] 268681 [2] 274981 [3] Inspired by: yuri [3] --- ports-mgmt/portlint/Makefile | 2 +- ports-mgmt/portlint/src/portlint.pl | 37 +++++++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile index 9773520ccc1a..6cdf645fc588 100644 --- a/ports-mgmt/portlint/Makefile +++ b/ports-mgmt/portlint/Makefile @@ -1,5 +1,5 @@ PORTNAME= portlint -PORTVERSION= 2.20.0 +PORTVERSION= 2.21.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 a9918a4e2b36..f8d7185e8827 100644 --- a/ports-mgmt/portlint/src/portlint.pl +++ b/ports-mgmt/portlint/src/portlint.pl @@ -20,10 +20,13 @@ use strict; use warnings; +BEGIN { $ENV{ NO_COLOR } = 1 if not -t STDOUT; } + use Getopt::Std; use File::Find; use IPC::Open2; use File::Basename; +use Term::ANSIColor qw(:constants); use POSIX qw(strftime); sub perror($$$$); @@ -48,7 +51,7 @@ $portdir = '.'; # version variables my $major = 2; -my $minor = 20; +my $minor = 21; my $micro = 0; # default setting - for FreeBSD @@ -403,9 +406,13 @@ if ($err || $warn) { print $msg, "\n"; } } - printf("%d fatal %s and %d %s found.\n", $err, $errtext, $warn, $warntext); + if ($err > 0) { + print BRIGHT_RED sprintf("%d fatal %s and %d %s found.", $err, $errtext, $warn, $warntext), RESET, "\n"; + } else { + print BRIGHT_YELLOW sprintf("%d fatal %s and %d %s found.", $err, $errtext, $warn, $warntext), RESET, "\n"; + } } else { - print "looks fine.\n"; + print BRIGHT_GREEN "looks fine.", RESET, "\n"; } exit $err; @@ -810,8 +817,9 @@ sub checkplist { } if ($_ =~ m|\.desktop$| && $makevar{USES} !~ /\bdesktop-file-utils\b/) { - &perror("FATAL", $file, $., "this port installs .desktop files. ". - "Please add `desktop-file-utils` to USES."); + &perror("WARN", $file, $., "this port installs .desktop files. ". + "If the .desktop file(s) installed contain ``MimeType='', ". + "you must add `desktop-file-utils` to USES."); } if ($_ =~ m|^(%%([^%]+)%%)?.*\.mo$| && $makevar{USES} !~ /\bgettext\b/) { @@ -1347,7 +1355,7 @@ sub checkmakefile { my $tmp; my $bogusdistfiles = 0; my @varnames = (); - my($portname, $portversion, $distfiles, $distversionprefix, $distversion, $distversionsuffix, $distname, $extractsufx) = ('') x 8; + my($portname, $portversion, $distfiles, $all_distfiles, $distversionprefix, $distversion, $distversionsuffix, $distname, $extractsufx) = ('') x 9; my $masterport = 0; my $slaveport = 0; my $use_gnome_hack = 0; @@ -2169,6 +2177,7 @@ xargs xmkmf && $curline !~ /^NO_CDROM(.)?=[^\n]+$i/m && $curline !~ /^MAINTAINER(.)?=[^\n]+$i/m && $curline !~ /^WWW(.)?=[^\n]+$i/m + && $curline !~ /^CPE_VENDOR(.)?=[^\n]+$i/m && $curline !~ /^CATEGORIES(.)?=[^\n]+$i/m && $curline !~ /^(\w+)?USES(.)?=[^\n]+$i/m && $curline !~ /^WX_COMPS(.)?=[^\n]+$i/m @@ -2889,7 +2898,8 @@ DIST_SUBDIR EXTRACT_ONLY } # check DISTFILES and related items. - $distfiles = $1 if ($tmp =~ /\nDISTFILES[+?]?=[ \t]*([^\n]+)\n/); + $distfiles = $1 if ($tmp =~ /\nDISTFILES[?]?=[ \t]*([^\n]+)\n/); + $all_distfiles = $1 if ($tmp =~ /\nDISTFILES[+?]?=[ \t]*([^\n]+)\n/); $portname = $makevar{PORTNAME}; $portversion = $makevar{PORTVERSION}; $distversionprefix = $makevar{DISTVERSIONPREFIX}; @@ -2901,7 +2911,7 @@ DIST_SUBDIR EXTRACT_ONLY # check bogus EXTRACT_SUFX. if ($extractsufx ne '') { print "OK: seen EXTRACT_SUFX, checking value.\n" if ($verbose); - if ($distfiles ne '') { + if ($all_distfiles ne '') { &perror("WARN", $file, -1, "no need to define EXTRACT_SUFX if ". "DISTFILES is defined."); } @@ -3105,7 +3115,7 @@ DIST_SUBDIR EXTRACT_ONLY $bogusdistfiles++; print "OK: seen DISTFILES with single item, checking value.\n" if ($verbose); - &perror("WARN", $file, -1, "use of DISTFILES with single file ". + &perror("WARN", $file, -1, "use of DISTFILES with single file is ". "discouraged. distribution filename should be set by ". "DISTNAME and EXTRACT_SUFX."); if ($distfiles eq (($distname ne '') ? $distname : "$portname-$portversion") . $extractsufx) { @@ -3661,18 +3671,21 @@ TEST_DEPENDS FETCH_DEPENDS DEPENDS_TARGET sub perror($$$$) { my($type, $file, $line, $msg) = @_; + my $color; if ($type eq 'FATAL') { $err++; + $color = BRIGHT_RED; } else { $warn++; + $color = BRIGHT_YELLOW; } if ($grouperrs) { $msg = '%%LINES%%' . $msg; if ($file ne "") { $msg = $file . ": " . $msg; } - $msg = $type . ": " . $msg; + $msg = $color . $type . RESET . ": " . $msg; if (!$errcache{$msg}) { push @errlst, $msg; } @@ -3686,8 +3699,8 @@ sub perror($$$$) { if ($file ne "") { $msg = $file . ": " . $msg; } - $msg = $type . ": " . $msg; - print $msg . "\n"; + $msg = ": " . $msg; + print $color, $type, RESET, $msg . "\n"; } }