diff options
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/makevars.map | 6 | ||||
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 26 |
2 files changed, 27 insertions, 5 deletions
diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map index ea207c34d20..2021856af90 100644 --- a/pkgtools/pkglint/files/makevars.map +++ b/pkgtools/pkglint/files/makevars.map @@ -1,4 +1,4 @@ -# $NetBSD: makevars.map,v 1.99 2006/06/02 21:33:22 rillig Exp $ +# $NetBSD: makevars.map,v 1.100 2006/06/02 21:54:00 rillig Exp $ # # This file contains the guessed type of some variables, according to @@ -400,7 +400,7 @@ PGSQL_VERSION_DEFAULT Unchecked [] PKGBASE Unchecked [] PKGCONFIG_OVERRIDE List of Pathmask [m:as,c:a] PKGDIR RelativePkgDir -PKGNAME PkgName [m:s,c:s,Makefile.*:ds] +PKGNAME PkgName [m:s,c:s,Makefile.*:ds,*:ds] PKGNAME_NOREV Unchecked [] PKGREPOSITORY Unchecked [] PKGREVISION PkgRevision [m:s] @@ -440,7 +440,7 @@ PKG_OPTIONS_NONEMPTY_SETS List of Option PKG_OPTIONS_OPTIONAL_GROUPS List of Identifier [o:as] PKG_OPTIONS_REQUIRED_GROUPS List of Identifier [o:s,m:s] PKG_OPTIONS_SET.* List of Option -PKG_OPTIONS_VAR PkgOptionsVar [o:s,m:s,c:s] +PKG_OPTIONS_VAR PkgOptionsVar [o:s,m:s,c:s, bsd.options.mk:p] PKG_PRESERVE Yes [m:s] PKG_SHELL Pathname [m:s,c:s] PKG_SHELL.* Pathname [m:s,c:s] diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 809aa8e19c1..25db92d082f 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.596 2006/06/02 21:32:33 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.597 2006/06/02 21:54:00 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -1181,7 +1181,7 @@ sub basic_type($) { return shift(@_)->[BASIC_TYPE]; } sub is_guessed($) { return shift(@_)->[IS_GUESSED]; } sub perms($$) { - my ($self, $fname, $varcanon) = @_; + my ($self, $fname) = @_; my ($perms); foreach my $acl_entry (@{$self->[ACLS]}) { @@ -1192,6 +1192,17 @@ sub perms($$) { return undef; } +sub perms_union($) { + my ($self) = @_; + my ($perms); + + $perms = ""; + foreach my $acl_entry(@{$self->[ACLS]}) { + $perms .= $acl_entry->[1]; + } + return $perms; +} + sub is_practically_a_list($) { my ($self) = @_; @@ -2935,6 +2946,17 @@ sub checkline_mk_varuse($$$$) { "that have references to shell variables or regular expressions are", "modified in a subtle way."); } + + my $lhs_type = $context->type; + my $rhs_type = get_variable_type($line, $varname); + if (defined($lhs_type) && defined($rhs_type) && $lhs_type->perms_union() =~ qr"p" && $rhs_type->perms($line->fname) !~ qr"p") { + $line->log_warning("${varname} should not be used in a load-time variable."); + $line->explain_warning( + "The variable on the left-hand side may be evaluated at load time, but", + "the variable on the right-hand side may not. Due to this assignment, it", + "might be used indirectly at load-time, when it is not guaranteed to be", + "properly defined."); + } } my $needs_quoting = variable_needs_quoting($line, $varname, $context); |