pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files When a list is appended to anot...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0c1685697c34
branches:  trunk
changeset: 503557:0c1685697c34
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Nov 23 06:05:52 2005 +0000

description:
When a list is appended to another list, like MAKE_ENV+=
CFLAGS=${CFLAGS}, check for the correct modifiers. The above is
obviously not correct, as CFLAGS may contain white-space.
CFLAGS=${CFLAGS:Q} is also a little wrong in that it may contain leading
and/or trailing white-space, which must be discarded, too, because the
broken GNU configure scripts cannot handle them correctly. This can be
done using ${CFLAGS:M*:Q}, which first splits CFLAGS into a list of
shell words, then selects all of them and finally combines the words
forming a nicely formatted string without leading and trailing
white-space where all entries are separated from each other by a single
space.

diffstat:

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

diffs (51 lines):

diff -r d784b21206e6 -r 0c1685697c34 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Nov 23 05:50:44 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Nov 23 06:05:52 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.377 2005/11/23 05:18:46 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.378 2005/11/23 06:05:52 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1537,7 +1537,6 @@
                PLIST_CAT
                PLIST_PRE
                PREPEND_PATH
-               _.*
        );
        my @plurals_missing_an_s = qw(
                .*_OVERRIDE
@@ -1805,9 +1804,16 @@
                }
 
        } elsif ($type eq "ShellWord") {
-               if ($value =~ qr"^[\w_]+=\"\$\{([\w_]+)\}\"$") {
-                       my ($vname) = ($1);
-                       $line->log_warning("Please use \${${vname}:Q} instead of \"\${${vname}}\".");
+               if ($value =~ qr"^[\w_]+=(([\"']?)\$\{([\w_]+)\}\2)$") {
+                       my ($vexpr, undef, $vname) = ($1, $2, $3);
+                       my $mod = ($vname =~ get_regex_plurals()) ? ":M*:Q" : ":Q";
+                       $line->log_warning("Please use \${${vname}${mod}} instead of ${vexpr}.");
+
+               } elsif ($value =~ qr"^[\w_]+=(\$\{([\w_]+):Q\})$") {
+                       my ($vexpr, $vname) = ($1, $2);
+                       if ($vname =~ get_regex_plurals()) {
+                               $line->log_warning("Please use \${${vname}:M*:Q} instead of ${vexpr}.");
+                       }
                }
 
        } elsif ($type eq "Stage") {
@@ -1926,9 +1932,7 @@
                        : undef;
 
                if ($op eq "+=") {
-                       my $regex_plurals = get_regex_plurals();
-
-                       if ($varbase !~ $regex_plurals) {
+                       if ($varbase !~ qr"^_" && $varbase !~ get_regex_plurals()) {
                                $line->log_warning("As ${varname} is modified using \"+=\", its name should indicate plural.");
                        }
                }



Home | Main Index | Thread Index | Old Index