diff options
author | rillig <rillig@pkgsrc.org> | 2005-11-01 21:39:31 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2005-11-01 21:39:31 +0000 |
commit | 8773747faeacf8f079a7038979d77a251575fe19 (patch) | |
tree | 794bac97f7733843258010992b3bb61071c7701d /pkgtools | |
parent | fd0ee38c61c5293bc6c9028259e48db726670a4c (diff) | |
download | pkgsrc-8773747faeacf8f079a7038979d77a251575fe19.tar.gz |
Updated pkglint to 4.32.1.
Added type check for USE_TOOLS. Fixed false warning about direct use of
tools in comments.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkglint/files/makevars.map | 3 | ||||
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 44 |
3 files changed, 46 insertions, 5 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index e59b5bd806c..4e96a28a28d 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.273 2005/11/01 01:08:38 rillig Exp $ +# $NetBSD: Makefile,v 1.274 2005/11/01 21:39:31 rillig Exp $ # -DISTNAME= pkglint-4.32 +DISTNAME= pkglint-4.32.1 CATEGORIES= pkgtools devel MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map index 80605339e7e..49021b3640d 100644 --- a/pkgtools/pkglint/files/makevars.map +++ b/pkgtools/pkglint/files/makevars.map @@ -1,4 +1,4 @@ -# $NetBSD: makevars.map,v 1.20 2005/10/26 23:17:49 rillig Exp $ +# $NetBSD: makevars.map,v 1.21 2005/11/01 21:39:31 rillig Exp $ # # This file contains the guessed type of some variables, according to @@ -75,6 +75,7 @@ MAKE_FLAGS List CONFIGURE_ARGS List PLIST_SUBST List MASTER_SITES List of URL +USE_TOOLS List of Tool PKGVERSION Readonly PKGBASE Readonly diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 93868a72ea6..1a0010f064c 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.313 2005/11/01 01:08:38 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.314 2005/11/01 21:39:31 rillig Exp $ # # This version contains lots of changes necessary for NetBSD packages # done by: @@ -1396,6 +1396,33 @@ sub get_regex_plurals() { return $get_regex_plurals_value; } +my $get_tool_names_value = undef; +sub get_tool_names() { + + if (defined($get_tool_names_value)) { + return $get_tool_names_value; + } + + my $fname = "${conf_pkgsrcdir}/mk/tools/defaults.mk"; + my $lines = load_lines($fname, true); + my $tools = {}; + if (!$lines) { + log_error($fname, NO_LINE_NUMBER, "[internal] Cannot be read."); + } else { + foreach my $line (@{$lines}) { + if ($line->text =~ $regex_varassign) { + my ($varname, undef, $value, undef) = ($1, $2, $3, $4); + if ($varname =~ qr"^_TOOLS_VARNAME.(.*)$") { + my ($toolname) = ($1); + $tools->{$toolname} = $value; + } + } + } + } + $get_tool_names_value = $tools; + return $get_tool_names_value; +} + sub checktext_basic_vartype($$$$$) { my ($line, $varname, $type, $value, $comment) = @_; @@ -1423,6 +1450,17 @@ sub checktext_basic_vartype($$$$$) { $line->log_error("${varname} must not be set outside the package Makefile."); } + } elsif ($type eq "Tool") { + if ($value =~ qr"^(.*)(?::(.*))$") { + my ($toolname, $tooldep) = ($1, $2); + if (!exists(get_tool_names()->{$toolname})) { + $line->log_error("Unknown tool \"${toolname}\"."); + } + if (defined($tooldep) && $tooldep !~ qr"^(?:build|pkgsrc|run)$") { + $line->log_error("Unknown tool dependency \"${tooldep}\"."); + } + } + } elsif ($type eq "Readonly") { $line->log_error("\"${varname}\" must not be modified by the package or the user."); @@ -1634,8 +1672,10 @@ sub checklines_direct_tools($) { if ($varname =~ $regex_ok_vars) { $line->log_info("Legitimate direct use of \"${tool}\" in variable ${varname}."); - } else { + } elsif ($varvalue =~ $regex_tools_with_context) { $line->log_warning("Possible direct use of \"${tool}\" in variable ${varname}. Please use \$\{$toolvar{$tool}\} instead."); + } else { + # the tool name has appeared in the comment } # process shell commands |