pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint Updated pkglint to 4.31.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/11ace7bbfcc0
branches:  trunk
changeset: 501725:11ace7bbfcc0
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Oct 26 23:17:49 2005 +0000

description:
Updated pkglint to 4.31.

Changed the names of the datatypes (Yes_Or_Undefined => Yes, Boolean =>
YesNo, Integer => PkgRevision) in makevars.map. It is now an error if
PKGREVISION appears outside a package Makefile. Improved detection of
Makefile.common. Improved wording of the warning for relative
directories in the form ../package.

diffstat:

 pkgtools/pkglint/Makefile           |   4 +-
 pkgtools/pkglint/files/makevars.map |  75 +++++++++++++++++++-----------------
 pkgtools/pkglint/files/pkglint.pl   |  76 ++++++++++++++++++++----------------
 3 files changed, 84 insertions(+), 71 deletions(-)

diffs (259 lines):

diff -r 7630c01d741b -r 11ace7bbfcc0 pkgtools/pkglint/Makefile
--- a/pkgtools/pkglint/Makefile Wed Oct 26 21:38:51 2005 +0000
+++ b/pkgtools/pkglint/Makefile Wed Oct 26 23:17:49 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.269 2005/10/24 23:54:37 rillig Exp $
+# $NetBSD: Makefile,v 1.270 2005/10/26 23:17:49 rillig Exp $
 #
 
-DISTNAME=      pkglint-4.30
+DISTNAME=      pkglint-4.31
 CATEGORIES=    pkgtools devel
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 7630c01d741b -r 11ace7bbfcc0 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map       Wed Oct 26 21:38:51 2005 +0000
+++ b/pkgtools/pkglint/files/makevars.map       Wed Oct 26 23:17:49 2005 +0000
@@ -1,62 +1,67 @@
-# $NetBSD: makevars.map,v 1.19 2005/10/24 23:54:37 rillig Exp $
+# $NetBSD: makevars.map,v 1.20 2005/10/26 23:17:49 rillig Exp $
 #
 
-# This file tries to guess the type of some variables, according to their
-# current use in pkgsrc. The type Boolean is nicer than Yes_Or_Undefined,
-# but most variables are only checked with defined(...) and not with an
-# additional !empty(...:M[Yy][Ee][Ss]). So we have to check both.
+# This file contains the guessed type of some variables, according to
+# their current use in pkgsrc.
+#
+# The type YesNo is used for variables that are checked using
+#     .if defined(VAR) && !empty(VAR:M[Yy][Ee][Ss])
 #
-# Beware: For the type Yes_Or_Undefined, even the value NO means YES.
+# The type Yes is used for variables that are checked using
+#     .if defined(VAR)
+#
+# Type type List is used for variables that should only be initialized
+# to the empty list or have some values appended using the "+=" operator.
 #
 # The type One_Of(...) is just used for explanation. It cannot yet be
 # checked by pkglint.
 
 # some variables from mk/defaults/mk.conf, 1.27
 
-MANZ                   Yes_Or_Undefined
-MKCRYPTO               Boolean
-USETBL                 Yes_Or_Undefined
+MANZ                   Yes
+MKCRYPTO               YesNo
+USETBL                 Yes
 #ABI                   One_Of(32 64)
-IGNORE_RECOMMENDED     Boolean
-PKG_REGISTER_SHELLS    Boolean
-USE_XPKGWEDGE          Boolean
-LIBTOOLIZE_PLIST       Boolean
-EXTRACT_USING_PAX      Yes_Or_Undefined
-SETGIDGAME             Boolean
+IGNORE_RECOMMENDED     YesNo
+PKG_REGISTER_SHELLS    YesNo
+USE_XPKGWEDGE          YesNo
+LIBTOOLIZE_PLIST       YesNo
+EXTRACT_USING_PAX      Yes
+SETGIDGAME             YesNo
 
 #USE_CRYPTO            One_Of(YES NO)
-USE_CUPS               Yes_Or_Undefined
-USE_I586               Boolean
-USE_INET6              Boolean
-USE_INN                        Yes_Or_Undefined
+USE_CUPS               Yes
+USE_I586               YesNo
+USE_INET6              YesNo
+USE_INN                        Yes
 #USE_OPENLDAP          One_Of(YES NO)
-USE_OSS                        Yes_Or_Undefined
+USE_OSS                        Yes
 #USE_SASL              One_Of(YES NO)
 #USE_SASL2             One_Of(YES NO)
 #USE_SJ3               One_Of(YES NO)
 #USE_SOCKS             One_Of(4 5)
 #USE_WNN4              One_Of(YES NO)
-USE_XFACE              Boolean
+USE_XFACE              YesNo
 
 # some variables found in package Makefiles
 
-PKGREVISION            Integer
-GNU_CONFIGURE          Yes_Or_Undefined
+PKGREVISION            PkgRevision
+GNU_CONFIGURE          Yes
 HOMEPAGE               URL
 MAINTAINER             Mail_Address
-NO_CHECKSUM            Yes_Or_Undefined
-NO_CONFIGURE           Yes_Or_Undefined
-NO_BUILD               Yes_Or_Undefined
+NO_CHECKSUM            Yes
+NO_CONFIGURE           Yes
+NO_BUILD               Yes
 #USE_PERL5             One_Of(build run)
-USE_X11                        Yes_Or_Undefined
-MANZ                   Yes_Or_Undefined
-USE_LIBTOOL            Yes_Or_Undefined
-USE_PKGLOCALEDIR       Boolean
-NO_MTREE               Yes_Or_Undefined
-PKG_PRESERVE           Yes_Or_Undefined
-NO_PKGTOOLS_REQD_CHECK Yes_Or_Undefined
-NO_PKG_REGISTER                Yes_Or_Undefined
-BUILD_USES_MSGFMT      Yes_Or_Undefined
+USE_X11                        Yes
+MANZ                   Yes
+USE_LIBTOOL            Yes
+USE_PKGLOCALEDIR       YesNo
+NO_MTREE               Yes
+PKG_PRESERVE           Yes
+NO_PKGTOOLS_REQD_CHECK Yes
+NO_PKG_REGISTER                Yes
+BUILD_USES_MSGFMT      Yes
 
 DEPENDS                        List of Dependency
 BUILD_DEPENDS          List of Dependency
diff -r 7630c01d741b -r 11ace7bbfcc0 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Oct 26 21:38:51 2005 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Oct 26 23:17:49 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.306 2005/10/24 23:54:37 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.307 2005/10/26 23:17:49 rillig Exp $
 #
 # This version contains lots of changes necessary for NetBSD packages
 # done by:
@@ -1142,27 +1142,36 @@
                my $text = $line->text;
 
                push(@{$all_lines}, $line);
+
                # try to get any included file
-               if ($text =~ qr"^\.\s*include\s+\"([^\$]+)\"$") {
+               my $is_include_line = false;
+               if ($text =~ qr"^\.\s*include\s+\"(.*)\"$") {
                        $includefile = $1;
-                       if (exists($seen_Makefile_include->{$includefile})) {
-                               $contents .= "### pkglint ### skipped $includefile\n";
-                               next;
-                       }
-                       if (!$opt_check_bl3 && $includefile =~ qr"/buildlink3.mk$") {
-                               $contents .= "### pkglint ### skipped $includefile\n";
-                               next;
+                       $includefile =~ s/\$\{.CURDIR\}/./;
+                       if ($includefile =~ $regex_unresolved) {
+                               $includefile =~ s,\$\{PHPPKGSRCDIR\},../../lang/php5,g;
+                               $includefile =~ s,\$\{SUSE_DIR_PREFIX\},suse91,g;
+                               $includefile =~ s,\$\{PYPKGSRCDIR\},../../lang/python23,g;
+                               if ($file !~ qr"/mk/" && $includefile =~ $regex_unresolved) {
+                                       $line->log_warning("Skipping include file \"${includefile}\". This may result in false warnings.");
+                               }
+
+                       } elsif (exists($seen_Makefile_include->{$includefile})) {
+                               # Don't include any file twice
+
+                       } else {
+                               $is_include_line = true;
+                               $seen_Makefile_include->{$includefile} = true;
                        }
-
-                       $seen_Makefile_include->{$includefile} = true;
+               }
+
+               if ($is_include_line) {
                        if ($includefile =~ qr"^\.\./[^./][^/]*/[^/]+") {
-                               $line->log_warning("Relative directories should look like \"../../cat/pkg\", not \"../pkg\".");
+                               $line->log_warning("Relative directories should look like \"../../category/package\", not \"../package\".");
                        }
-                       if ($includefile =~ qr"^(?:\.\./(?:\.\./[^/]+/)?[^/]+/)?([^/]+)$") {
-                               my ($basename) = ($1);
-                               if ($basename ne "buildlink3.mk") {
-                                       $seen_Makefile_common = true;
-                               }
+                       if ($includefile =~ qr"(?:^|/)Makefile.common$"
+                           || ($includefile =~ qr"^(?:\.\./(?:\.\./[^/]+/)?[^/]+/)?([^/]+)$" && $1 ne "buildlink3.mk")) {
+                               $seen_Makefile_common = true;
                        }
                        if ($includefile =~ /\/mk\/texinfo\.mk/) {
                                $line->log_error("Do not include $includefile.");
@@ -1185,10 +1194,6 @@
                                        $contents .= readmakefile($dir, "$dirname/$includefile", $all_lines, $seen_Makefile_include);
                                }
                        }
-
-               } elsif ($text =~ qr"^\.\s*include\s+(.*)") {
-                       $line->log_info("Skipping include file $1");
-
                } else {
                        $contents .= $text . "\n";
                }
@@ -1271,12 +1276,7 @@
 sub checktext_basic_vartype($$$$$) {
        my ($line, $varname, $type, $value, $comment) = @_;
 
-       if ($type eq "Boolean") {
-               if ($value !~ qr"^(?:YES|yes|NO|no)(?:\s+#.*)?$") {
-                       $line->log_warning("${varname} should be set to YES, yes, NO, or no.");
-               }
-
-       } elsif ($type eq "Dependency") {
+       if ($type eq "Dependency") {
                if ($value =~ $regex_unresolved) {
                        # don't even try to check anything
                } elsif ($value =~ qr":\.\./\.\./") {
@@ -1287,14 +1287,17 @@
                        $line->log_warning("Unknown dependency format.");
                }
 
-       } elsif ($type eq "Integer") {
+       } elsif ($type eq "Mail_Address") {
+               if ($value !~ $regex_mail_address) {
+                       $line->log_warning("\"${value}\" is not a valid mail address.");
+               }
+
+       } elsif ($type eq "PkgRevision") {
                if ($value !~ qr"^\d+$") {
                        $line->log_warning("\"${value}\" is not a valid Integer.");
                }
-
-       } elsif ($type eq "Mail_Address") {
-               if ($value !~ $regex_mail_address) {
-                       $line->log_warning("\"${value}\" is not a valid mail address.");
+               if ($line->file !~ qr"(?:^|/)Makefile$") {
+                       $line->log_error("${varname} must not be set outside the package Makefile.");
                }
 
        } elsif ($type eq "Readonly") {
@@ -1322,11 +1325,16 @@
                        $line->log_warning("\"${value}\" is not a valid URL.");
                }
 
-       } elsif ($type eq "Yes_Or_Undefined") {
+       } elsif ($type eq "Yes") {
                if ($value !~ qr"^(?:YES|yes)(?:\s+#.*)?$") {
                        $line->log_warning("${varname} should be set to YES or yes.");
                }
 
+       } elsif ($type eq "YesNo") {
+               if ($value !~ qr"^(?:YES|yes|NO|no)(?:\s+#.*)?$") {
+                       $line->log_warning("${varname} should be set to YES, yes, NO, or no.");
+               }
+
        } else {
                $line->log_error("[internal] Type ${type} unknown.");
        }
@@ -2637,7 +2645,7 @@
                }
        }
 
-       if (grep { $_ !~ qr"/CVS$" } <$dir/scripts/*>) {
+       if (!is_emptydir("$dir/scripts")) {
                log_warning("$dir/scripts", NO_LINE_NUMBER, "This directory and its contents are deprecated! Please call the script(s) explicitly from the corresponding target(s) in the pkg's 
Makefile.");
        }
 }



Home | Main Index | Thread Index | Old Index