summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-02-18 14:48:58 +0000
committerrillig <rillig@pkgsrc.org>2006-02-18 14:48:58 +0000
commit9acc9f87651c62c1aae80ad305c16025f08020d3 (patch)
treef05fb358fb8c6fc10448ad413b3bef8b9f3c3806 /pkgtools
parentee597609957169ee3609461c61e10d2af2f8e1b8 (diff)
downloadpkgsrc-9acc9f87651c62c1aae80ad305c16025f08020d3.tar.gz
- The checkline_mk_vartype_basic routine needs to know whether the value
it is checking is used in list context or in scalar context -- just like in Perl. - The :Q operator should only be used in list context or in shell commands.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl24
1 files changed, 14 insertions, 10 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 6b8e322b2f4..75ca4d2e2bc 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.525 2006/02/18 14:18:44 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.526 2006/02/18 14:48:58 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -2703,13 +2703,17 @@ sub checkline_mk_shellcmd($$) {
checkline_mk_shelltext($line, $shellcmd);
}
-sub checkline_mk_vartype_basic($$$$$$);
-sub checkline_mk_vartype_basic($$$$$$) {
- my ($line, $varname, $type, $op, $value, $comment) = @_;
+sub checkline_mk_vartype_basic($$$$$$$);
+sub checkline_mk_vartype_basic($$$$$$$) {
+ my ($line, $varname, $type, $op, $value, $comment, $list_context) = @_;
my ($value_novar);
$value_novar = $value;
- while ($value_novar =~ s/\$\{[^{}]*\}//g) {
+ while ($value_novar =~ s/\$\{([^{}]*)\}//g) {
+ my ($varuse) = ($1);
+ if (!$list_context && $varuse =~ qr":Q$") {
+ $line->log_warning("The :Q operator should only be used in lists and shell commands.");
+ }
}
if ($type eq "AwkCommand") {
@@ -2960,7 +2964,7 @@ sub checkline_mk_vartype_basic($$$$$$) {
my (@paths) = split(qr":", $value_novar);
foreach my $p (@paths) {
- checkline_mk_vartype_basic($line, $varname, "Pathname", $op, $p, $comment);
+ checkline_mk_vartype_basic($line, $varname, "Pathname", $op, $p, $comment, false);
}
} elsif ($type eq "Pathmask") {
@@ -2984,7 +2988,7 @@ sub checkline_mk_vartype_basic($$$$$$) {
}
} elsif ($type eq "PkgOptionsVar") {
- checkline_mk_vartype_basic($line, $varname, "Varname", $op, $value, $comment);
+ checkline_mk_vartype_basic($line, $varname, "Varname", $op, $value, $comment, false);
if ($value =~ qr"\$\{PKGBASE[:\}]") {
$line->log_error("PKGBASE must not be used in PKG_OPTIONS_VAR.");
$line->explain(
@@ -3157,7 +3161,7 @@ sub checkline_mk_vartype_basic($$$$$$) {
} elsif ($type eq "YesNoFromCommand") {
if ($op ne "!=") {
- checkline_mk_vartype_basic($line, $varname, "YesNo", $op, $value, $comment);
+ checkline_mk_vartype_basic($line, $varname, "YesNo", $op, $value, $comment, false);
}
} elsif ($type =~ qr"^\{\s*(.*?)\s*\}$") {
@@ -3253,7 +3257,7 @@ sub checkline_mk_vartype($$$$$) {
foreach my $word (@words) {
if (defined($element_type)) {
- checkline_mk_vartype_basic($line, $varname, $element_type, $op, $word, $comment);
+ checkline_mk_vartype_basic($line, $varname, $element_type, $op, $word, $comment, true);
}
}
@@ -3262,7 +3266,7 @@ sub checkline_mk_vartype($$$$$) {
}
} else {
- checkline_mk_vartype_basic($line, $varname, $type, $op, $value, $comment);
+ checkline_mk_vartype_basic($line, $varname, $type, $op, $value, $comment, false);
}
}