diff options
author | abs <abs@pkgsrc.org> | 2004-06-28 09:55:44 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2004-06-28 09:55:44 +0000 |
commit | 2a71890df1772557a5961cadd35be7df82cd8cd3 (patch) | |
tree | 09931a0cac9c9dffd43d253dd48097d252132b3c /pkgtools/pkglint/files | |
parent | 91b7f1dfc018751472864bbe858bd8b11ab0f833 (diff) | |
download | pkgsrc-2a71890df1772557a5961cadd35be7df82cd8cd3.tar.gz |
Update pkglint to 3.81
- Rework undefined variable handling. Fixes issue introduces in 3.80
- Never run a pkg_info in pkgdistdir. Avoids a serious misfeature of
pkg_info whereby it looks for a package in the current directory
by default.
Diffstat (limited to 'pkgtools/pkglint/files')
-rwxr-xr-x | pkgtools/pkglint/files/lintpkgsrc.pl | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index cf67e9ed631..61d9ec806da 100755 --- a/pkgtools/pkglint/files/lintpkgsrc.pl +++ b/pkgtools/pkglint/files/lintpkgsrc.pl @@ -1,6 +1,6 @@ #!@PERL@ -# $NetBSD: lintpkgsrc.pl,v 1.90 2004/06/27 22:47:38 abs Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.91 2004/06/28 09:55:44 abs Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -41,6 +41,10 @@ if (! getopts('BDE:I:K:LM:OP:RSVdg:hilmopru', \%opt) || $opt{h} || { usage_and_exit(); } $| = 1; +# Horrible kludge to ensure we have a value for testing in conditionals, but +# gets removed in the final evaluation +my $magic_undefined = 'M_a_G_i_C_UNDEFINED'; + get_default_makefile_vars(); # $default_vars if ($opt{D} && @ARGV) @@ -81,10 +85,9 @@ if ($opt{D} && @ARGV) $opt{o}, $opt{m}); if ($opt{r}) { - safe_chdir("$pkgdistdir"); verbose("Unlinking 'bad' distfiles\n"); foreach my $distfile (@baddist) - { unlink($distfile); } + { unlink("$pkgdistdir/$distfile"); } } } @@ -1011,6 +1014,8 @@ sub parse_makefile_vars } } } + foreach my $key (keys %vars) + { $vars{$key} =~ s/$magic_undefined//; } \%vars; } @@ -1023,7 +1028,7 @@ sub parse_expand_vars if (defined(${$vars}{$1})) { $line = $`.${$vars}{$1}.$'; } else - { $line = $`.$'; } + { $line = $`.$magic_undefined.$'; } } $line; } @@ -1037,7 +1042,7 @@ sub parse_expand_vars_dumb if (defined(${$vars}{$1})) { $line = $`.${$vars}{$1}.$'; } else - { $line = $`.$'; } + { $line = $`.$magic_undefined.$'; } } $line; } @@ -1127,6 +1132,7 @@ sub safe_chdir { my($dir) = @_; + debug("chdir: $dir"); if (! chdir($dir)) { fail("Unable to chdir($dir): $!"); } } @@ -1278,16 +1284,16 @@ sub scan_pkgsrc_distfiles_vs_distinfo if (@distwarn) { verbose(@distwarn); } verbose("checksum mismatches\n"); - safe_chdir("$pkgdistdir"); + safe_chdir($pkgdistdir); foreach my $sum (keys %sumfiles) { if ($sum eq 'Size') { - foreach (@{$sumfiles{$sum}}) + foreach my $file (@{$sumfiles{$sum}}) { - if (! -f $_ || -S $_ != $distfiles{$_}{sum}) + if (! -f $file || -S $file != $distfiles{$_}{sum}) { - print $_, " (Size)\n"; + print $file, " (Size)\n"; $bad_distfiles{$_} = 1; } } @@ -1308,6 +1314,7 @@ sub scan_pkgsrc_distfiles_vs_distinfo } close(DIGEST); } + safe_chdir('/'); # Do not want to stay in $pkgdistdir } (sort keys %bad_distfiles); } |