diff options
author | rillig <rillig> | 2005-05-22 22:27:52 +0000 |
---|---|---|
committer | rillig <rillig> | 2005-05-22 22:27:52 +0000 |
commit | c35b2df1f651134c5b31a62366cab9b4a515673d (patch) | |
tree | 4d5973c8f864991432c8c0c4cd61bb858fdbcd3d /pkgtools | |
parent | fcc10bdc520a9e5d0ff12872a34f6fa3badc23ba (diff) | |
download | pkgsrc-c35b2df1f651134c5b31a62366cab9b4a515673d.tar.gz |
Extend the deprecated variables check to the included Makefiles, too.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 8a9e51be4ca..5b3eb7f3003 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.163 2005/05/22 21:08:33 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.164 2005/05/22 22:27:52 rillig Exp $ # # This version contains lots of changes necessary for NetBSD packages # done by Hubert Feyrer <hubertf@netbsd.org>, @@ -1176,10 +1176,11 @@ sub check_Makefile_variables($) { return true; } -sub checkfile_Makefile_deprecated($) { - my ($whole) = @_; +sub checklines_deprecated_variables($) { + my ($lines) = @_; my ($fname) = ("${conf_datadir}/deprecated.map"); my ($deprecated) = load_file($fname); + my %vars = (); if (!$deprecated) { log_error($fname, NO_LINE_NUMBER, "Cannot be loaded."); @@ -1190,14 +1191,21 @@ sub checkfile_Makefile_deprecated($) { if ($line->text =~ qr"^#" || $line->text =~ qr"^\s*$") { next; } elsif ($line->text =~ qr"^(\S+)\s+(.*)$") { - my ($varname, $howto_fix) = ($1, $2); - if ($whole =~ qr"\n\Q$varname\E\b") { - log_warning(NO_FILE, NO_LINE_NUMBER, "${varname} is deprecated. ${howto_fix}"); - } + $vars{$1} = $2; } else { $line->log_error("internal error: Unknown line format."); } } + + foreach my $line (@{$lines}) { + if ($line->text =~ qr"^([A-Z][A-Z0-9_]*)\s*[!+?]?=") { + my ($varname) = ($1); + if (exists($vars{$varname})) { + $line->log_warning("${varname} is deprecated. $vars{$varname}"); + } + } + } + return true; } @@ -1293,7 +1301,7 @@ sub checkfile_Makefile($) { "FILESDIR: $filesdir, PKGDIR: $pkgdir, ". "DISTINFO: $distinfo\n"); - checkfile_Makefile_deprecated($whole); + checklines_deprecated_variables($lines); # # whole file: INTERACTIVE_STAGE |