pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Restrict the autofix changes ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9888a8af1581
branches:  trunk
changeset: 503740:9888a8af1581
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Mon Nov 28 00:33:55 2005 +0000

description:
- Restrict the autofix changes to apply only if the whole ShellWord
  matches.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (41 lines):

diff -r d5a84cb69d6a -r 9888a8af1581 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sun Nov 27 23:48:01 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Mon Nov 28 00:33:55 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.390 2005/11/27 23:48:01 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.391 2005/11/28 00:33:55 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1961,17 +1961,19 @@
                }
 
        } elsif ($type eq "ShellWord") {
-               if ($value =~ qr"^[\w_]+=(([\"']?)\$\{([\w_]+)\}\2)$") {
-                       my ($vexpr, undef, $vname) = ($1, $2, $3);
+               if ($value =~ qr"^([\w_]+)=(([\"']?)\$\{([\w_]+)\}\2)$") {
+                       my ($key, $vexpr, undef, $vname) = ($1, $2, $3, $4);
                        my $mod = ($vname =~ regex_gnu_configure_volatile_vars) ? ":M*:Q" : ":Q";
-                       $line->log_warning("Please use \${${vname}${mod}} instead of ${vexpr}.");
-                       $line->replace($vexpr, "\${${vname}${mod}}");
-
-               } elsif ($value =~ qr"^[\w_]+=(\$\{([\w_]+):Q\})$") {
-                       my ($vexpr, $vname) = ($1, $2);
+                       my $fixed_vexpr = "\${${vname}${mod}}";
+                       $line->log_warning("Please use ${fixed_vexpr} instead of ${vexpr}.");
+                       $line->replace($value, "${key}=${fixed_vexpr}");
+
+               } elsif ($value =~ qr"^([\w_]+)=(\$\{([\w_]+):Q\})$") {
+                       my ($key, $vexpr, $vname) = ($1, $2, $3);
+                       my $fixed_vexpr = "\${${vname}:M*:Q}";
                        if ($vname =~ regex_gnu_configure_volatile_vars) {
-                               $line->log_warning("Please use \${${vname}:M*:Q} instead of ${vexpr}.");
-                               $line->replace($vexpr, "\${${vname}:M*:Q}");
+                               $line->log_warning("Please use ${fixed_vexpr} instead of ${vexpr}.");
+                               $line->replace($value, "${key}=${fixed_vexpr}");
                        }
 
                } elsif ($value ne "" && $value !~ qr"^${regex_shellword}$") {



Home | Main Index | Thread Index | Old Index