| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!@PERL5@ | | 1 | #!@PERL5@ |
2 | | | 2 | |
3 | # $NetBSD: lintpkgsrc.pl,v 1.75 2022/08/11 07:20:52 rillig Exp $ | | 3 | # $NetBSD: lintpkgsrc.pl,v 1.76 2022/08/11 18:55:35 rillig Exp $ |
4 | | | 4 | |
5 | # Written by David Brownlee <abs@netbsd.org>. | | 5 | # Written by David Brownlee <abs@netbsd.org>. |
6 | # | | 6 | # |
7 | # Caveats: | | 7 | # Caveats: |
8 | # The 'Makefile parsing' algorithm used to obtain package versions and | | 8 | # The 'Makefile parsing' algorithm used to obtain package versions and |
9 | # DEPENDS information is geared towards speed rather than perfection, | | 9 | # DEPENDS information is geared towards speed rather than perfection, |
10 | # though it has gotten somewhat better over time, it only parses the | | 10 | # though it has gotten somewhat better over time, it only parses the |
11 | # simpler Makefile conditionals. | | 11 | # simpler Makefile conditionals. |
12 | # | | 12 | # |
13 | # TODO: Handle fun DEPENDS like avifile-devel with | | 13 | # TODO: Handle fun DEPENDS like avifile-devel with |
14 | # {qt2-designer>=2.2.4,qt2-designer-kde>=2.3.1nb1} | | 14 | # {qt2-designer>=2.2.4,qt2-designer-kde>=2.3.1nb1} |
15 | | | 15 | |
16 | use v5.36; | | 16 | use v5.36; |
| @@ -1249,27 +1249,27 @@ sub store_pkgsrc_makefiles($db, $fname) | | | @@ -1249,27 +1249,27 @@ sub store_pkgsrc_makefiles($db, $fname) |
1249 | $varname =~ /^\S+$/ | | 1249 | $varname =~ /^\S+$/ |
1250 | or die "cannot store variable name '$varname'\n"; | | 1250 | or die "cannot store variable name '$varname'\n"; |
1251 | $value =~ /^.*$/ | | 1251 | $value =~ /^.*$/ |
1252 | or die "cannot store variable value '$value'\n"; | | 1252 | or die "cannot store variable value '$value'\n"; |
1253 | print STORE "var\t$varname\t$value\n"; | | 1253 | print STORE "var\t$varname\t$value\n"; |
1254 | } | | 1254 | } |
1255 | } | | 1255 | } |
1256 | close(STORE) | | 1256 | close(STORE) |
1257 | or die("Cannot save pkgsrc store to $fname: $!\n"); | | 1257 | or die("Cannot save pkgsrc store to $fname: $!\n"); |
1258 | } | | 1258 | } |
1259 | | | 1259 | |
1260 | # Remember to update manual page when modifying option list | | 1260 | # Remember to update manual page when modifying option list |
1261 | # | | 1261 | # |
1262 | sub usage_and_exit() { | | 1262 | sub usage_and_exit($status) { |
1263 | print "Usage: lintpkgsrc [opts] [makefiles] | | 1263 | print "Usage: lintpkgsrc [opts] [makefiles] |
1264 | opts: | | 1264 | opts: |
1265 | -h : This help. [see lintpkgsrc(1) for more information] | | 1265 | -h : This help. [see lintpkgsrc(1) for more information] |
1266 | | | 1266 | |
1267 | Installed package options: Distfile options: | | 1267 | Installed package options: Distfile options: |
1268 | -i : Check version against pkgsrc -m : List distinfo mismatches | | 1268 | -i : Check version against pkgsrc -m : List distinfo mismatches |
1269 | -u : As -i + fetch dist (may change) -o : List obsolete (no distinfo) | | 1269 | -u : As -i + fetch dist (may change) -o : List obsolete (no distinfo) |
1270 | -y : Remove orphan distfiles | | 1270 | -y : Remove orphan distfiles |
1271 | -z : Remove installed distfiles | | 1271 | -z : Remove installed distfiles |
1272 | | | 1272 | |
1273 | Prebuilt package options: Makefile options: | | 1273 | Prebuilt package options: Makefile options: |
1274 | -p : List old/obsolete -B : List packages marked as 'BROKEN' | | 1274 | -p : List old/obsolete -B : List packages marked as 'BROKEN' |
1275 | -O : List OSVERSION_SPECIFIC -d : Check 'DEPENDS' up to date | | 1275 | -O : List OSVERSION_SPECIFIC -d : Check 'DEPENDS' up to date |
| @@ -1278,27 +1278,27 @@ Prebuilt package options: Makefile opti | | | @@ -1278,27 +1278,27 @@ Prebuilt package options: Makefile opti |
1278 | Misc: | | 1278 | Misc: |
1279 | -E file : Export the internal pkgsrc database to file | | 1279 | -E file : Export the internal pkgsrc database to file |
1280 | -I file : Import the internal pkgsrc database to file (for use with -i) | | 1280 | -I file : Import the internal pkgsrc database to file (for use with -i) |
1281 | -g file : Generate 'pkgname pkgdir pkgver' map in file | | 1281 | -g file : Generate 'pkgname pkgdir pkgver' map in file |
1282 | -r : Remove bad files (Without -m -o -p or -V implies all, can use -R) | | 1282 | -r : Remove bad files (Without -m -o -p or -V implies all, can use -R) |
1283 | | | 1283 | |
1284 | Modifiers: | | 1284 | Modifiers: |
1285 | -K path : Set PACKAGES basedir (default PKGSRCDIR/packages) | | 1285 | -K path : Set PACKAGES basedir (default PKGSRCDIR/packages) |
1286 | -M path : Set DISTDIR (default PKGSRCDIR/distfiles) | | 1286 | -M path : Set DISTDIR (default PKGSRCDIR/distfiles) |
1287 | -P path : Set PKGSRCDIR (default $conf_pkgsrcdir) | | 1287 | -P path : Set PKGSRCDIR (default $conf_pkgsrcdir) |
1288 | -D : Debug makefile and glob parsing | | 1288 | -D : Debug makefile and glob parsing |
1289 | -L : List each Makefile when scanned | | 1289 | -L : List each Makefile when scanned |
1290 | "; | | 1290 | "; |
1291 | exit; | | 1291 | exit $status; |
1292 | } | | 1292 | } |
1293 | | | 1293 | |
1294 | # Could speed up by building a cache of package names to paths, then processing | | 1294 | # Could speed up by building a cache of package names to paths, then processing |
1295 | # each package name once against the tests. | | 1295 | # each package name once against the tests. |
1296 | sub check_prebuilt_packages() { | | 1296 | sub check_prebuilt_packages() { |
1297 | | | 1297 | |
1298 | if ($_ eq 'distfiles' || $_ eq 'pkgsrc') { | | 1298 | if ($_ eq 'distfiles' || $_ eq 'pkgsrc') { |
1299 | # Skip these subdirs if present | | 1299 | # Skip these subdirs if present |
1300 | $File::Find::prune = 1; | | 1300 | $File::Find::prune = 1; |
1301 | | | 1301 | |
1302 | } elsif (/(.+)-(\d.*)\.t[bg]z$/) { | | 1302 | } elsif (/(.+)-(\d.*)\.t[bg]z$/) { |
1303 | my ($pkg, $ver) = ($1, $2); | | 1303 | my ($pkg, $ver) = ($1, $2); |
1304 | | | 1304 | |
| @@ -1598,27 +1598,27 @@ sub check_outdated_installed_packages($p | | | @@ -1598,27 +1598,27 @@ sub check_outdated_installed_packages($p |
1598 | system("$conf_make fetch-list | sh"); | | 1598 | system("$conf_make fetch-list | sh"); |
1599 | } | | 1599 | } |
1600 | } | | 1600 | } |
1601 | | | 1601 | |
1602 | sub main() { | | 1602 | sub main() { |
1603 | | | 1603 | |
1604 | $ENV{PATH} .= | | 1604 | $ENV{PATH} .= |
1605 | ":/bin:/usr/bin:/sbin:/usr/sbin:$conf_prefix/sbin:$conf_prefix/bin"; | | 1605 | ":/bin:/usr/bin:/sbin:/usr/sbin:$conf_prefix/sbin:$conf_prefix/bin"; |
1606 | | | 1606 | |
1607 | if ( | | 1607 | if ( |
1608 | !getopts('BDE:I:K:LM:OP:RSVdg:himopruyz', \%opt) | | 1608 | !getopts('BDE:I:K:LM:OP:RSVdg:himopruyz', \%opt) |
1609 | || $opt{h} | | 1609 | || $opt{h} |
1610 | || !grep(/[BDEORSdgimopruyz]/, keys %opt)) { | | 1610 | || !grep(/[BDEORSdgimopruyz]/, keys %opt)) { |
1611 | usage_and_exit(); | | 1611 | usage_and_exit($opt{h} ? 0 : 1); |
1612 | } | | 1612 | } |
1613 | $| = 1; | | 1613 | $| = 1; |
1614 | | | 1614 | |
1615 | get_default_makefile_vars(); # $default_vars | | 1615 | get_default_makefile_vars(); # $default_vars |
1616 | | | 1616 | |
1617 | if ($opt{D} && @ARGV) { | | 1617 | if ($opt{D} && @ARGV) { |
1618 | debug_parse_makefiles(@ARGV); | | 1618 | debug_parse_makefiles(@ARGV); |
1619 | exit; | | 1619 | exit; |
1620 | } | | 1620 | } |
1621 | | | 1621 | |
1622 | my $pkgsrcdir = $default_vars->{PKGSRCDIR}; | | 1622 | my $pkgsrcdir = $default_vars->{PKGSRCDIR}; |
1623 | my $pkgdistdir = $default_vars->{DISTDIR}; | | 1623 | my $pkgdistdir = $default_vars->{DISTDIR}; |
1624 | | | 1624 | |