summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig>2006-08-28 12:41:49 +0000
committerrillig <rillig>2006-08-28 12:41:49 +0000
commit9fbf4625f5e6abf2157aac8cff25db0e9f9ab5b6 (patch)
treeaf6ed355d8a893ec16befbcf6c8844be1140ec6a
parenta2541107c1b68f5647a1d659dd2e49a802e5878d (diff)
downloadpkgsrc-9fbf4625f5e6abf2157aac8cff25db0e9f9ab5b6.tar.gz
Variable names may contain simply nested variables. This allows the
shell parser to correctly handle ${WRKSRC.${d}}, which appears for example in geography/epsg. Avoided an internal fatal error for files that contain RCS conflicts.
-rw-r--r--pkgtools/pkglint/files/pkglint.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index b6e0f1a225a..e5fd2eec106 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.669 2006/08/04 18:32:41 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.670 2006/08/28 12:41:49 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -1790,6 +1790,7 @@ use constant regex_mk_sysinclude=> qr"^\.\s*s?include\s+<([^>]+)>(?:\s*#.*)?$";
use constant regex_mk_shellvaruse => qr"(?:^|[^\$])\$\$\{?(\w+)\}?"; # XXX: not perfect
use constant regex_pkgname => qr"^((?:[\w.+]|-[^\d])+)-(\d(?:\w|\.\d)*)$";
use constant regex_mk_shellcmd => qr"^\t(.*)$";
+use constant regex_rcs_conflict => qr"^(<<<<<<<|=======|>>>>>>>)";
use constant regex_unresolved => qr"\$\{";
use constant regex_validchars => qr"[\011\040-\176]";
# Note: the following regular expression looks more complicated than
@@ -1823,7 +1824,7 @@ my $regex_shellword = qr"\s*(
| [^\(\)'\"\\\s;&\|<>\`\$] # non-special character
| \$\{[^\s\"'`]+ # HACK: nested make(1) variables
)+ | ;;? | &&? | \|\|? | \( | \) | >& | <<? | >>? | \#.*)"sx;
-my $regex_varname = qr"[-*+.0-9A-Z_a-z{}\[]+";
+my $regex_varname = qr"(?:[-*+.0-9A-Z_a-z{}\[]+|\$\{[\w_]+\})+";
my $regex_pkgbase = qr"(?:[+.0-9A-Z_a-z]|-[A-Z_a-z])+";
my $regex_pkgversion = qr"\d(?:\w|\.\d)*";
@@ -3304,6 +3305,9 @@ sub parseline_mk($) {
$line->set("sources", $sources);
defined($comment) and $line->set("comment", $comment);
+ } elsif ($text =~ regex_rcs_conflict) {
+ # This line is useless
+
} else {
assert(false, "Unknown line format: " . $line->to_string());
}