pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc Updated pkglint to 4.32.1.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8f54e6921231
branches:  trunk
changeset: 502051:8f54e6921231
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Nov 01 21:39:31 2005 +0000

description:
Updated pkglint to 4.32.1.

Added type check for USE_TOOLS. Fixed false warning about direct use of
tools in comments.

diffstat:

 doc/CHANGES                         |   3 +-
 pkgtools/pkglint/Makefile           |   4 +-
 pkgtools/pkglint/files/makevars.map |   3 +-
 pkgtools/pkglint/files/pkglint.pl   |  44 +++++++++++++++++++++++++++++++++++-
 4 files changed, 48 insertions(+), 6 deletions(-)

diffs (120 lines):

diff -r 4ea7a83672bd -r 8f54e6921231 doc/CHANGES
--- a/doc/CHANGES       Tue Nov 01 21:30:12 2005 +0000
+++ b/doc/CHANGES       Tue Nov 01 21:39:31 2005 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.11746 2005/11/01 21:20:15 wiz Exp $
+$NetBSD: CHANGES,v 1.11747 2005/11/01 21:39:58 rillig Exp $
 
 Changes to the packages collection and infrastructure in 2005:
 
@@ -4948,3 +4948,4 @@
        Updated mail/fetchmailconf to 6.2.5nb3 [adrianp 2005-11-01]
        Updated net/ethereal to 0.10.13nb1 [frueauf 2005-11-01]
        Updated x11/lablgtk2 to 2.6.0 [wiz 2005-11-01]
+       Updated pkgtools/pkglint to 4.32.1 [rillig 2005-11-01]
diff -r 4ea7a83672bd -r 8f54e6921231 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Tue Nov 01 21:30:12 2005 +0000
+++ b/pkgtools/pkglint/Makefile Tue Nov 01 21:39:31 2005 +0000
@@ -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 -r 4ea7a83672bd -r 8f54e6921231 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map       Tue Nov 01 21:30:12 2005 +0000
+++ b/pkgtools/pkglint/files/makevars.map       Tue Nov 01 21:39:31 2005 +0000
@@ -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 @@
 CONFIGURE_ARGS         List
 PLIST_SUBST            List
 MASTER_SITES           List of URL
+USE_TOOLS              List of Tool
 
 PKGVERSION             Readonly
 PKGBASE                        Readonly
diff -r 4ea7a83672bd -r 8f54e6921231 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Nov 01 21:30:12 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Nov 01 21:39:31 2005 +0000
@@ -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 @@
        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 @@
                        $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 @@
 
                        if ($varname =~ $regex_ok_vars) {
                                $line->log_info("Legitimate direct use of \"${tool}\" in variable ${varname}.");
+                       } elsif ($varvalue =~ $regex_tools_with_context) {
+                               $line->log_warning("Possible direct use of \"${tool}\" in variable ${varname}. Please use \$\{$toolvar{$tool}\} instead.");
                        } else {
-                               $line->log_warning("Possible direct use of \"${tool}\" in variable ${varname}. Please use \$\{$toolvar{$tool}\} instead.");
+                               # the tool name has appeared in the comment
                        }
 
                # process shell commands



Home | Main Index | Thread Index | Old Index