pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Integrated the code from chec...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6deec175faf8
branches:  trunk
changeset: 504178:6deec175faf8
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Dec 06 15:47:14 2005 +0000

description:
- Integrated the code from checklines_mk_deprecated_variables() into
  checkline_mk_text() and checkline_mk_varassign(). This saves 20 lines
  and makes the warnings appear ordered by line number.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  51 +++++++++++---------------------------
 1 files changed, 15 insertions(+), 36 deletions(-)

diffs (96 lines):

diff -r ada7a55a314f -r 6deec175faf8 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Dec 06 15:41:06 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Dec 06 15:47:14 2005 +0000
@@ -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.423 2005/12/06 15:22:28 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.424 2005/12/06 15:47:14 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1540,6 +1540,7 @@
 
 sub checkline_mk_text($$) {
        my ($line, $text) = @_;
+       my ($rest);
 
        if ($text =~ qr"^[^#]*[^\$]\$(\w+)") {
                my ($varname) = ($1);
@@ -1555,6 +1556,15 @@
        if ($text =~ qr"\$\{WRKSRC\}/\.\./") {
                $line->log_error("Using \"\${WRKSRC}/..\" is conceptually wrong. Use a combination of WRKSRC, CONFIGURE_DIRS and BUILD_DIRS instead.");
        }
+
+       $rest = $text;
+       while ($rest =~ s/\$\{([-A-Z0-9a-z_]+)(?::[^\}]+)\}//) {
+               my ($varname) = ($1);
+
+               if (exists(get_deprecated_map()->{$varname})) {
+                       $line->log_warning("Use of ${varname} is deprecated. ".get_deprecated_map()->{$varname});
+               }
+       }
 }
 
 sub checkline_mk_shellcmd($$) {
@@ -1724,6 +1734,10 @@
                        $line->log_info("Use of PKGNAME in ${varname}.");
                }
        }
+
+       if (exists(get_deprecated_map()->{$varname})) {
+               $line->log_warning("Definition of ${varname} is deprecated. ".get_deprecated_map()->{$varname});
+       }
 }
 
 sub checkline_mk_vartype_basic($$$$$) {
@@ -2189,40 +2203,6 @@
        }
 }
 
-sub checklines_mk_deprecated_variables($) {
-       my ($lines) = @_;
-       my ($vars, $varnames, $regex_varuse);
-
-       $vars = get_deprecated_map();
-       $varnames = join("|", sort(keys(%{$vars})));
-       $regex_varuse = qr"\$\{(${varnames})[:}]";
-
-       foreach my $line (@{$lines}) {
-               my ($rest);
-
-               if ($line->text =~ regex_varassign) {
-                       my ($varname) = ($1);
-                       $rest = $3;
-                       if (exists($vars->{$varname})) {
-                               $line->log_warning("Definition of ${varname} is deprecated. $vars->{$varname}");
-                       }
-
-               } elsif ($line->text =~ regex_shellcmd) {
-                       ($rest) = ($1);
-               }
-
-               if (defined($rest)) {
-                       while ($rest =~ s/$regex_varuse//) {
-                               my ($varname) = ($1);
-
-                               if (exists($vars->{$varname})) {
-                                       $line->log_warning("Use of ${varname} is deprecated. $vars->{$varname}");
-                               }
-                       }
-               }
-       }
-}
-
 sub checklines_mk($) {
        my ($lines) = @_;
 
@@ -2242,7 +2222,6 @@
                }
        }
 
-       checklines_mk_deprecated_variables($lines);
        autofix($lines);
 }
 



Home | Main Index | Thread Index | Old Index