From b55a12b5bb3aed6bcdc1df7c05c690c5ed2e61f0 Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 14 Jul 2012 20:32:37 +0000 Subject: Update to 4.117: Recognize another possible permission. Reported by Bug Hunting. --- pkgtools/pkglint/files/pkglint.1 | 8 +++++--- pkgtools/pkglint/files/pkglint.pl | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'pkgtools/pkglint/files') diff --git a/pkgtools/pkglint/files/pkglint.1 b/pkgtools/pkglint/files/pkglint.1 index 54a12c8fbdf..d38799dd1a1 100644 --- a/pkgtools/pkglint/files/pkglint.1 +++ b/pkgtools/pkglint/files/pkglint.1 @@ -1,13 +1,13 @@ -.\" $NetBSD: pkglint.1,v 1.45 2012/07/09 22:11:00 wiz Exp $ +.\" $NetBSD: pkglint.1,v 1.46 2012/07/14 20:32:37 wiz Exp $ .\" From FreeBSD: portlint.1,v 1.8 1997/11/25 14:53:14 itojun Exp .\" .\" Copyright (c) 1997 by Jun-ichiro Itoh . .\" All Rights Reserved. Absolutely no warranty. .\" .\" Roland Illig , 2004, 2005. -w.\" Thomas Klausner , 2012. +.\" Thomas Klausner , 2012. .\" -.Dd July 9, 2012 +.Dd July 14, 2012 .Dt PKGLINT 1 .Sh NAME .Nm pkglint @@ -171,6 +171,8 @@ use a variable during preprocessing use a variable at runtime .It set set a variable using :=, =, != +.It unknown +permissions for this variable currently not known .El A .Sq \&? diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 01f3832f8c3..9777d6378b9 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.pl,v 1.840 2012/07/10 10:53:05 wiz Exp $ +# $NetBSD: pkglint.pl,v 1.841 2012/07/14 20:32:37 wiz Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -4742,6 +4742,16 @@ sub checkline_mk_shellcmd($$) { checkline_mk_shelltext($line, $shellcmd); } +sub expand_permission($) { + my ($perm) = @_; + my %fullperm = ( "a" => "append", "d" => "default", "p" => "preprocess", "s" => "set", "t" => "runtime", "?" => "unknown" ); + return $fullperm{$perm}; +# for my $element (split(/,/, $perm)) { +# my ($location, $permission) = split(/:/, $element); +# return "-- $location == $permission -- "; +# } +} + sub checkline_mk_vardef($$$) { my ($line, $varname, $op) = @_; @@ -4762,9 +4772,8 @@ sub checkline_mk_vardef($$$) { my $perms = get_variable_perms($line, $varname); my $needed = { "=" => "s", "!=" => "s", "?=" => "d", "+=" => "a", ":=" => "s" }->{$op}; - my %full = ( "a" => "append", "d" => "default", "p" => "preprocess", "s" => "set", "t" => "runtime" ); if (index($perms, $needed) == -1) { - $line->log_warning("Permission [$full{$needed}] requested for ${varname}, but only [$full{$perms}] is allowed."); + $line->log_warning("Permission [" . expand_permission($needed) . "] requested for ${varname}, but only [" . expand_permission($perms) . "] is allowed."); $line->explain_warning( "The available permissions are:", "\tappend\t\tappend something using +=", -- cgit v1.2.3