Wed Aug 17 18:18:20 2022 UTC ()
lintpkgsrc: fix parse-guessing of pkgsrc-wip packages using an SCM


(rillig)
diff -r1.110 -r1.111 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

cvs diff -r1.110 -r1.111 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl (expand / switch to unified diff)

--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl 2022/08/17 17:47:50 1.110
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl 2022/08/17 18:18:20 1.111
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#!@PERL5@ 1#!@PERL5@
2# $NetBSD: lintpkgsrc.pl,v 1.110 2022/08/17 17:47:50 rillig Exp $ 2# $NetBSD: lintpkgsrc.pl,v 1.111 2022/08/17 18:18:20 rillig Exp $
3 3
4# Written by David Brownlee <abs@netbsd.org>. 4# Written by David Brownlee <abs@netbsd.org>.
5# 5#
6# Caveats: 6# Caveats:
7# The 'Makefile parsing' algorithm used to obtain package versions and 7# The 'Makefile parsing' algorithm used to obtain package versions and
8# DEPENDS information is geared towards speed rather than perfection, 8# DEPENDS information is geared towards speed rather than perfection,
9# though it has gotten somewhat better over time, it only parses the 9# though it has gotten somewhat better over time, it only parses the
10# simpler Makefile conditionals. 10# simpler Makefile conditionals.
11# 11#
12# TODO: Handle fun DEPENDS like avifile-devel with 12# TODO: Handle fun DEPENDS like avifile-devel with
13# {qt2-designer>=2.2.4,qt2-designer-kde>=2.3.1nb1} 13# {qt2-designer>=2.2.4,qt2-designer-kde>=2.3.1nb1}
14 14
15use v5.36; 15use v5.36;
@@ -989,28 +989,32 @@ sub parse_makefile_pkgsrc($file) { @@ -989,28 +989,32 @@ sub parse_makefile_pkgsrc($file) {
989 chomp @errors; 989 chomp @errors;
990 if (@errors) { warn "\n$file: @errors\n"; } 990 if (@errors) { warn "\n$file: @errors\n"; }
991 991
992 if ($makepkgname =~ /(.*)-(\d.*)/) { 992 if ($makepkgname =~ /(.*)-(\d.*)/) {
993 $pkgname = $makepkgname; 993 $pkgname = $makepkgname;
994 } 994 }
995 } 995 }
996 } 996 }
997 997
998 if (defined $pkgname) { 998 if (defined $pkgname) {
999 $pkgname = canonicalize_pkgname($pkgname); 999 $pkgname = canonicalize_pkgname($pkgname);
1000 1000
1001 my $pkgrevision = $vars->{PKGREVISION}; 1001 my $pkgrevision = $vars->{PKGREVISION};
1002 if (defined $pkgrevision and not $pkgrevision =~ /^\s*$/) { 1002 if (defined $pkgrevision && $pkgrevision !~ /^\s*$/) {
1003 if ($pkgrevision =~ /^\$\{(_(CVS|GIT|HG|SVN)_PKGVERSION):.*\}$/) { 1003 if ($pkgrevision =~ /^\$\{ (?:
 1004 _CVS_PKGVERSION |
 1005 _GIT_PKGVERSION_CMD |
 1006 _HG_PKGVERSION_CMD |
 1007 _SVN_PKGREVISION_CMD) :.* \}$ /x) {
1004 # See wip/mk/*-package.mk. 1008 # See wip/mk/*-package.mk.
1005 } elsif ($pkgrevision =~ /\D/) { 1009 } elsif ($pkgrevision =~ /\D/) {
1006 print "\n"; 1010 print "\n";
1007 print "Bogus: PKGREVISION $pkgrevision (from $file)\n"; 1011 print "Bogus: PKGREVISION $pkgrevision (from $file)\n";
1008 1012
1009 } elsif ($pkgrevision > 0) { 1013 } elsif ($pkgrevision > 0) {
1010 $pkgname .= "nb$pkgrevision"; 1014 $pkgname .= "nb$pkgrevision";
1011 } 1015 }
1012 } 1016 }
1013 1017
1014 if ($pkgname =~ /\$/) { 1018 if ($pkgname =~ /\$/) {
1015 print "\nBogus: $pkgname (from $file)\n"; 1019 print "\nBogus: $pkgname (from $file)\n";
1016 1020