git: 415d07a06fc5 - main - ports-mgmt/portlint: Update to 2.19.12
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 17 Jul 2022 15:38:23 UTC
The branch main has been updated by marcus:
URL: https://cgit.FreeBSD.org/ports/commit/?id=415d07a06fc5429d9d3630166b99b33219150d02
commit 415d07a06fc5429d9d3630166b99b33219150d02
Author: Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-07-17 15:37:21 +0000
Commit: Joe Marcus Clarke <marcus@FreeBSD.org>
CommitDate: 2022-07-17 15:37:21 +0000
ports-mgmt/portlint: Update to 2.19.12
In a discussion with members of the port managers team (tcberner, rene) the issue of conflicting package base names came up.
I have offered to create portlint checks for 2 possible Makefile issues:
1) Conflicting use of ${PKGBASE} of an existing port.
2) Multiple flavors resulting in the same ${PKGBASE}.
The attached patch adds checks for both possible issues:
1) Check for the existence of the new PKGBASE in the INDEX file (if present) and warn if it is used for a different ORIGIN.
2) Generate PKGBASE for all FLAVORS and check for duplicates.
PR: 263807
---
ports-mgmt/portlint/Makefile | 2 +-
ports-mgmt/portlint/src/portlint.pl | 42 +++++++++++++++++++++++++++++++++++--
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/ports-mgmt/portlint/Makefile b/ports-mgmt/portlint/Makefile
index e14f2f36de92..68beab3bef29 100644
--- a/ports-mgmt/portlint/Makefile
+++ b/ports-mgmt/portlint/Makefile
@@ -1,7 +1,7 @@
# Created by: Jun-ichiro itojun Hagino <itojun@itojun.org>
PORTNAME= portlint
-PORTVERSION= 2.19.11
+PORTVERSION= 2.19.12
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 ddeb7d290c7d..c2cd2dbb0e9d 100644
--- a/ports-mgmt/portlint/src/portlint.pl
+++ b/ports-mgmt/portlint/src/portlint.pl
@@ -49,7 +49,7 @@ $portdir = '.';
# version variables
my $major = 2;
my $minor = 19;
-my $micro = 11;
+my $micro = 12;
# default setting - for FreeBSD
my $portsdir = '/usr/ports';
@@ -1364,6 +1364,7 @@ sub checkmakefile {
my(@mman, @pman);
my(@aopt, @mopt, @opt);
my($pkg_version, $versiondir, $versionfile) = ('', '', '');
+ my $indexfile = '';
my $useindex = 0;
my %deprecated = ();
my @deplist = ();
@@ -3013,10 +3014,11 @@ DIST_SUBDIR EXTRACT_ONLY
$versiondir = $ENV{VERSIONDIR} // '/var/db/chkversion';
+ $indexfile = "$portsdir/$makevar{INDEXFILE}";
$versionfile = "$versiondir/VERSIONS";
$useindex = !-r "$versionfile";
- $versionfile = "$portsdir/$makevar{INDEXFILE}"
+ $versionfile = $indexfile
if $useindex;
if (-r "$versionfile") {
@@ -3054,6 +3056,42 @@ DIST_SUBDIR EXTRACT_ONLY
close VERSIONS;
}
+ # use INDEX (if present) to check for PKGBASE collisions
+ if (-r "$indexfile") {
+ open INDEX, "<$portsdir/$makevar{INDEXFILE}";
+ while (<INDEX>) {
+ my($origin, $pkgbase) = ('', '');
+ chomp;
+ next if /^(#|$)/;
+ ($pkgbase, $origin) = split /\|/;
+ $pkgbase =~ s,-[^-]+$,,;
+ $origin =~ s,^.*/([^/]+/[^/]+)/?$,$1,;
+ if ($pkgbase eq $makevar{PKGBASE} and $origin ne $makevar{PKGORIGIN}) {
+ &perror("FATAL", $file, -1, "The package base name \"$makevar{PKGBASE}\" is already in use by the \"$origin\" port. ".
+ "Choose another PORTNAME or use a PKGNAMEPREFIX or PKGNAMESUFFIX.");
+ }
+ }
+ close INDEX;
+ }
+
+ # verify that all flavors have distinct names
+ if ($makevar{FLAVORS}) {
+ my %PKGFLAVOR;
+ my @FLAVORS = split(/ /, $makevar{FLAVORS});
+ my $makeenv_save = $makeenv;
+ for my $flavor (@FLAVORS) {
+ $makeenv = $makeenv_save . " FLAVOR=$flavor";
+ my $pkgbase = &get_makevar("PKGBASE");
+ if ($PKGFLAVOR{$pkgbase}) {
+ &perror("FATAL", $file, -1, "The flavors \"$PKGFLAVOR{$pkgbase}\" and \"$flavor\" both generate a package named \"$pkgbase\". ".
+ "Make the package names unique, e.g., with different PKGNAMEPREFIX or PKGNAMESUFFIX values for each flavor.");
+ } else {
+ $PKGFLAVOR{$pkgbase} = $flavor;
+ }
+ }
+ my $makeenv = $makeenv_save;
+ }
+
# if DISTFILES have only single item, it is better to avoid DISTFILES
# and to use combination of DISTNAME and EXTRACT_SUFX (unless USE_GITHUB
# or USE_GITLAB is set to nodefault in which case it is fine).