pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Some more typed variables.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b32f04d6e934
branches:  trunk
changeset: 508129:b32f04d6e934
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Feb 15 16:10:49 2006 +0000

description:
- Some more typed variables.
- Variables that are not of type "List of something" should be quoted when
  used in shell programs.
- In mail addresses, a "+" is allowed.

diffstat:

 pkgtools/pkglint/files/makevars.map |   8 +++++++-
 pkgtools/pkglint/files/pkglint.pl   |  18 +++++++++++++-----
 2 files changed, 20 insertions(+), 6 deletions(-)

diffs (106 lines):

diff -r 239f0e05fd31 -r b32f04d6e934 pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map       Wed Feb 15 15:08:35 2006 +0000
+++ b/pkgtools/pkglint/files/makevars.map       Wed Feb 15 16:10:49 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.61 2006/02/15 11:41:01 rillig Exp $
+# $NetBSD: makevars.map,v 1.62 2006/02/15 16:10:49 rillig Exp $
 #
 
 # This file contains the guessed type of some variables, according to
@@ -65,6 +65,7 @@
 BUILDLINK_LIBS         List of LdFlag
 BUILDLINK_PACKAGES     BuildlinkPackages
 BUILDLINK_PASSTHRU_DIRS        List+ of Pathname
+BUILDLINK_PASSTHRU_RPATHDIRS   List+ of Pathname
 BUILDLINK_PKGSRCDIR    RelativePkgDir
 BUILDLINK_PREFIX       Pathname
 BUILDLINK_RECOMMENDED  List!+ of Dependency
@@ -124,6 +125,7 @@
 # ^^ ShellCommand, terminated by a semicolon
 DJB_RESTRICTED         YesNo
 DJB_MAKE_TARGETS       List of Identifier
+DJB_SLASHPACKAGE       YesNo
 DL_AUTO_VARS           Yes
 DL_LIBS                        List+ of LdFlag
 EMACS_BIN              Readonly
@@ -137,6 +139,7 @@
 EMACS_VERSIONS_ACCEPTED        List of { emacs21 emacs21nox emacs20 xemacs215 xemacs214 }
 EMACS_VERSION_REQD     List+
 # ^^ of Version
+EVAL_PREFIX            List! of ShellWord
 EXTRACT_CMD            List of ShellWord
 EXTRACT_ELEMENTS       List of Pathmask
 EXTRACT_ONLY           List of Pathname
@@ -157,6 +160,7 @@
 FETCH_BEFORE_ARGS      List of ShellWord
 FILESDIR               RelativePkgPath
 FILES_SUBST            List+ of ShellWord
+FILES_SUBST_SED                List+ of ShellWord
 FONTS_DIRS             List+ of Pathname
 GCC_REQD               List+
 GENERATE_PLIST         List+ of ShellWord
@@ -174,6 +178,7 @@
 INSTALLATION_DIRS      List of Pathname
 INSTALL_DIRS           List of WrksrcSubdirectory
 INSTALL_EXTRA_TMPL     List+ of Pathname
+INSTALL_FILE           Pathname
 INSTALL_MAKE_FLAGS     List+ of ShellWord
 INSTALL_SCRIPTS_ENV    List+ of ShellWord
 INSTALL_TARGET         List of Identifier
@@ -187,6 +192,7 @@
 LDFLAGS                        List+ of LdFlag
 LIBS                   List+ of LdFlag
 LIBTOOL_OVERRIDE       List+ of Pathmask
+LICENCE                        Identifier
 LICENSE                        Identifier
 LTCONFIG_OVERRIDE      List+ of Pathmask
 MAINTAINER             Mail_Address
diff -r 239f0e05fd31 -r b32f04d6e934 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Wed Feb 15 15:08:35 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Wed Feb 15 16:10:49 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.517 2006/02/15 11:41:01 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.518 2006/02/15 16:10:49 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -2178,7 +2178,7 @@
        checkline_relative_path($line, $path);
        $path = resolve_relative_path($path, false);
 
-       if ($path !~ qr"^\.\./\.\./[^/]+/[^/]+$") {
+       if ($path !~ qr"^(?:\./)?\.\./\.\./[^/]+/[^/]+$") {
                $line->log_warning("\"${path}\" is not a valid relative package directory.");
                $line->explain(
                        "A relative pathname always starts with \"../../\", followed",
@@ -2297,10 +2297,18 @@
        my ($line, $shellword, $check_quoting) = @_;
        my ($rest, $state);
 
-       if ($shellword =~ qr"^\$\{(${regex_varname})(:.+)?\}$") {
+       if ($opt_warn_quoting && $shellword =~ qr"^\$\{(${regex_varname})(:.+)?\}$") {
                my ($varname, $mod) = ($1, $2);
 
-               $opt_debug and $line->log_warning("Not sure whether the variable ${varname} needs quoting.");
+               if (exists(get_vartypes_map()->{$varname}) && !(defined($mod) && $mod =~ qr":Q$")) {
+                       my $vartype = get_vartypes_map()->{$varname};
+
+                       if ($vartype !~ qr"^List") {
+                               $line->log_warning("Please use \${${varname}:Q} instead of \${${varname}}.");
+                       }
+               } else {
+                       $opt_debug and $line->log_warning("Not sure whether the variable ${varname} needs quoting.");
+               }
                return;
        }
 
@@ -2882,7 +2890,7 @@
                }
 
        } elsif ($type eq "Mail_Address") {
-               if ($value =~ qr"^([-\w\d_.]+)\@([-\w\d.]+)$") {
+               if ($value =~ qr"^([+\-.0-9A-Z_a-z]+)\@([-\w\d.]+)$") {
                        my (undef, $domain) = ($1, $2);
                        if ($domain =~ qr"^NetBSD.org"i && $domain ne "NetBSD.org") {
                                $line->log_warning("Please write NetBSD.org instead of ${domain}.");



Home | Main Index | Thread Index | Old Index