summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2005-09-02 01:03:20 +0000
committerrillig <rillig@pkgsrc.org>2005-09-02 01:03:20 +0000
commit5deb0fcc3eb2283481f0f316d93b19141afa44e1 (patch)
tree525ecf56e21a7eac98ebac4cab86c39b881467e1 /pkgtools
parent1c2f92a2b4a74f07517268c93ee0897f0e542fa9 (diff)
downloadpkgsrc-5deb0fcc3eb2283481f0f316d93b19141afa44e1.tar.gz
When checking for direct use of tools, the Makefile lines are
interpreted as "logical lines", that is, lines ending in a backslash are continued on the next line. This led to a false warning for PKG_FAIL_REASON, which is suppressed.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/files/pkglint.pl35
1 files changed, 27 insertions, 8 deletions
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 1e6049b0be9..ff8a1382efa 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.264 2005/09/01 23:24:35 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.265 2005/09/02 01:03:20 rillig Exp $
#
# This version contains lots of changes necessary for NetBSD packages
# done by:
@@ -371,7 +371,7 @@ my $regex_unresolved = qr"\$\{";
my $regex_url = qr"^(?:http://|ftp://|#)"; # allow empty URLs
my $regex_url_directory = qr"(?:http://|ftp://)\S+/";
my $regex_validchars = qr"[\011\040-\176]";
-my $regex_varassign = qr"^([A-Z_a-z0-9.]+)\s*(=|\?=|\+=|:=)\s*(.*)";
+my $regex_varassign = qr"^([-A-Z_a-z0-9.\${}]+)\s*(=|\?=|\+=|:=|!=)\s*(.*?)(\\?)$";
my $regex_yes = qr"^(?:YES|yes)$";
my $regex_yesno = qr"^(?:YES|yes|NO|no)$";
@@ -500,6 +500,24 @@ sub parse_command_line() {
}
}
+sub get_logical_line($$) {
+ my ($lines, $ref_lineno) = @_;
+ my ($value, $lineno);
+
+ $value = "";
+ for ($lineno = ${$ref_lineno}; $lineno <= $#{$lines}; $lineno++) {
+ my $text = $lines->[$lineno]->text;
+ if ($text =~ qr"^(.*)\\$") {
+ $value .= $1;
+ } else {
+ $value .= $text;
+ last;
+ }
+ }
+ ${$ref_lineno} = $lineno + 1;
+ return $value;
+}
+
sub load_make_vars_typemap() {
my ($lines, $vartypes);
@@ -653,7 +671,7 @@ sub checkline_valid_characters_in_variable($$) {
$rest = $line->text;
if ($rest =~ $regex_varassign) {
- ($varname, undef, $rest) = ($1, $2, $3);
+ ($varname, undef, $rest, undef) = ($1, $2, $3, $4);
} else {
return;
}
@@ -1225,7 +1243,7 @@ sub checklines_direct_tools($) {
EXTRACT_SUFX EXTRACT_USING
INTERACTIVE_STAGE
MANSOURCEPATH MASTER_SITES
- PKGNAME PKGSRC_USE_TOOLS
+ PKGNAME PKGSRC_USE_TOOLS PKG_FAIL_REASON
SUBST_MESSAGE\\..*
.*_TARGET
USE_TOOLS);
@@ -1252,8 +1270,9 @@ sub checklines_direct_tools($) {
log_subinfo($subr, NO_FILE, NO_LINE_NUMBER, "regex_ok_vars=${regex_ok_vars}");
log_subinfo($subr, NO_FILE, NO_LINE_NUMBER, "regex_rm_shellcmds=${regex_rm_shellcmds}");
- foreach my $line (@{$lines}) {
- my $text = $line->text;
+ for (my $lineno = 0; $lineno <= $#{$lines}; ) {
+ my $line = $lines->[$lineno];
+ my $text = get_logical_line($lines, \$lineno);
next unless ($text =~ $regex_tools);
my ($tool) = ($1);
@@ -1262,8 +1281,8 @@ sub checklines_direct_tools($) {
if ($text =~ qr"^#") {
# process variable assignments
- } elsif ($text =~ qr"^([\w.]+?)\s*[?+:!]?=\s*(.*)") {
- my ($varname, $value) = ($1, $2);
+ } elsif ($text =~ $regex_varassign) {
+ my ($varname, undef, $varvalue, $varcont) = ($1, $2, $3, $4);
if ($varname =~ $regex_ok_vars) {
$line->log_info("Legitimate direct use of \"${tool}\" in variable ${varname}.");