Fri Aug 19 05:06:26 2022 UTC ()
lintpkgsrc: fix parse-guessing of Apache modules

When lintpkgsrc parses the package makefile of an Apache module, it
includes mk/apache.mk, and that file defines APACHE_PKG_PREFIX, thereby
hiding the fallback value from $default_vars.


(rillig)
diff -r1.125 -r1.126 pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl

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

--- pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl 2022/08/19 04:34:03 1.125
+++ pkgsrc/pkgtools/lintpkgsrc/files/lintpkgsrc.pl 2022/08/19 05:06:26 1.126
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#!@PERL5@ 1#!@PERL5@
2# $NetBSD: lintpkgsrc.pl,v 1.125 2022/08/19 04:34:03 rillig Exp $ 2# $NetBSD: lintpkgsrc.pl,v 1.126 2022/08/19 05:06:26 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;
@@ -753,27 +753,28 @@ sub get_default_makefile_vars() { @@ -753,27 +753,28 @@ sub get_default_makefile_vars() {
753 # Extract some variables from bsd.pkg.mk 753 # Extract some variables from bsd.pkg.mk
754 my $mkvars = parse_makefile_vars( 754 my $mkvars = parse_makefile_vars(
755 "$default_vars->{PKGSRCDIR}/mk/bsd.pkg.mk", 755 "$default_vars->{PKGSRCDIR}/mk/bsd.pkg.mk",
756 "$default_vars->{PKGSRCDIR}/mk/scripts" 756 "$default_vars->{PKGSRCDIR}/mk/scripts"
757 ); 757 );
758 foreach my $varname (keys %$mkvars) { 758 foreach my $varname (keys %$mkvars) {
759 if ($varname =~ /_REQD$/ || $varname eq 'EXTRACT_SUFX') { 759 if ($varname =~ /_REQD$/ || $varname eq 'EXTRACT_SUFX') {
760 $default_vars->{$varname} = $mkvars->{$varname}; 760 $default_vars->{$varname} = $mkvars->{$varname};
761 } 761 }
762 } 762 }
763 763
764 $default_vars->{PACKAGES} ||= $default_vars->{PKGSRCDIR} . '/packages'; 764 $default_vars->{PACKAGES} ||= $default_vars->{PKGSRCDIR} . '/packages';
765 765
766 $default_vars->{APACHE_PKG_PREFIX} = 'ap12345'; 766 $default_vars->{PKG_APACHE} = 'apache12345';
 767 $default_vars->{'_APACHE_PKG_PREFIX.apache12345'} = 'ap12345';
767 $default_vars->{LUA_PKGPREFIX} = 'lua12345'; 768 $default_vars->{LUA_PKGPREFIX} = 'lua12345';
768 $default_vars->{PHP_PKG_PREFIX} = 'php12345'; 769 $default_vars->{PHP_PKG_PREFIX} = 'php12345';
769 $default_vars->{PYPKGPREFIX} = 'py12345'; 770 $default_vars->{PYPKGPREFIX} = 'py12345';
770 $default_vars->{RUBY_PKGPREFIX} = 'ruby12345'; 771 $default_vars->{RUBY_PKGPREFIX} = 'ruby12345';
771} 772}
772 773
773# Determine if a package version is current. If not, report the correct 774# Determine if a package version is current. If not, report the correct
774# version if found. 775# version if found.
775sub invalid_version($pkgmatch) { 776sub invalid_version($pkgmatch) {
776 777
777 my @warnings; 778 my @warnings;
778 foreach $pkgmatch (expand_braces($pkgmatch)) { 779 foreach $pkgmatch (expand_braces($pkgmatch)) {
779 my ($pkg, $badver) = package_globmatch($pkgmatch); 780 my ($pkg, $badver) = package_globmatch($pkgmatch);