diff options
author | rillig <rillig@pkgsrc.org> | 2007-11-07 11:09:07 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2007-11-07 11:09:07 +0000 |
commit | 3691bc5f8369c6593db9af393195499cc93e8335 (patch) | |
tree | fbc37f8ccb6ff56c58a57509ac7d14fc0730a675 /pkgtools | |
parent | 2e52d62f0baa5ba868ba52a00b720555f2d74141 (diff) | |
download | pkgsrc-3691bc5f8369c6593db9af393195499cc93e8335.tar.gz |
Warn about removal of unrelated directories in the PLIST.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 7cba69dadd9..5e4b954e18e 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.727 2007/11/06 14:22:03 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.728 2007/11/07 11:09:07 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -7298,7 +7298,7 @@ sub checkfile_patch($) { sub checkfile_PLIST($) { my ($fname) = @_; - my ($lines, $last_file_seen, $all_files); + my ($lines, $last_file_seen); $opt_debug_trace and log_debug($fname, NO_LINES, "checkfile_PLIST()"); @@ -7328,12 +7328,17 @@ sub checkfile_PLIST($) { } # Get the list of all files from the PLIST. - $all_files = {}; + my $all_files = {}; + my $all_dirs = {}; foreach my $line (@{$lines}) { my $text = $line->text; if ($text =~ qr"^[\w\$]") { $all_files->{$text} = $line; + my $dir = $text; + while ($dir =~ s,/[^/]+$,,) { + $all_dirs->{$dir} = $line; + } } } @@ -7373,6 +7378,14 @@ sub checkfile_PLIST($) { my $s = join(" or ", map { "\"USE_DIRS+= $_\"" } @ids); $line->log_warning("Please add $s to the package Makefile and remove this line."); } + if (!exists($all_dirs->{$arg})) { + $line->log_warning("The PLIST does not contain files for \"$arg\"."); + $line->explain_warning( +"A package should only remove those directories that it created. When", +"there are no files in the directory, it is unlikely that the package", +"created the directory."); + } + } elsif ($cmd eq "imake-man") { my (@args) = split(/\s+/, $arg); if (@args != 3) { |