diff options
author | rillig <rillig> | 2005-12-02 08:26:52 +0000 |
---|---|---|
committer | rillig <rillig> | 2005-12-02 08:26:52 +0000 |
commit | 29e2250f8b356dc26a6ce662395f9637227830c7 (patch) | |
tree | f684c0139b4b524f9c173e0cfe92bb4b454c62c8 /pkgtools | |
parent | da407d20e61dfe26d8494c9d70c3a45b58ba9415 (diff) | |
download | pkgsrc-29e2250f8b356dc26a6ce662395f9637227830c7.tar.gz |
Unnecessary .undef directives in Makefiles can be fixed automatically if
all mentioned variables have been used in .for loops before.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 2d7d536d8b1..100806ede1b 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -11,7 +11,7 @@ # Freely redistributable. Absolutely no warranty. # # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp -# $NetBSD: pkglint.pl,v 1.408 2005/12/02 08:08:36 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.409 2005/12/02 08:26:52 rillig Exp $ # # This version contains lots of changes necessary for NetBSD packages # done by: @@ -2752,11 +2752,17 @@ sub checklines_package_Makefile($) { } } elsif ($directive eq "undef" && defined($args)) { + my $all_unnecessary = true; foreach my $var (split(qr"\s+", $args)) { if (exists($for_variables->{$var})) { $line->log_note("Using \".undef\" after a \".for\" loop is unnecessary."); + } else { + $all_unnecessary = false; } } + if ($all_unnecessary) { + $line->delete(); + } } } elsif ($text =~ regex_mk_dependency) { |