summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2007-11-07 11:09:07 +0000
committerrillig <rillig@pkgsrc.org>2007-11-07 11:09:07 +0000
commit0e0e1a73df2a770d0a3c6b6db82c5b49b7816caf (patch)
treefbc37f8ccb6ff56c58a57509ac7d14fc0730a675 /pkgtools
parente5fa877447330e8b2d609dd6a81509b79e7e63d6 (diff)
downloadpkgsrc-0e0e1a73df2a770d0a3c6b6db82c5b49b7816caf.tar.gz
Warn about removal of unrelated directories in the PLIST.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl19
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) {