summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-11-23 06:05:52 +0000
committerrillig <rillig@pkgsrc.org>2005-11-23 06:05:52 +0000
commit3efae126faee0ed3dfce3ff1dcb7cbfca0526620 (patch)
treeb89eeaf152745a7aa6b6440d2d7ea434a481a2a7 /pkgtools
parent8bd6524893782c21391aba2b650f5f624823717a (diff)
downloadpkgsrc-3efae126faee0ed3dfce3ff1dcb7cbfca0526620.tar.gz
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 (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 2a049f08770..e07b07c2240 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.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 @@ sub get_regex_plurals() {
PLIST_CAT
PLIST_PRE
PREPEND_PATH
- _.*
);
my @plurals_missing_an_s = qw(
.*_OVERRIDE
@@ -1805,9 +1804,16 @@ sub checkline_basic_vartype($$$$$) {
}
} 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 @@ sub checkline_Makefile_vartype($$) {
: 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.");
}
}