pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files - Added about 50 variable types...
details: https://anonhg.NetBSD.org/pkgsrc/rev/cb707286327c
branches: trunk
changeset: 506214:cb707286327c
user: rillig <rillig%pkgsrc.org@localhost>
date: Thu Jan 12 22:28:06 2006 +0000
description:
- Added about 50 variable types to makevars.map.
- Added some variable types.
- For unknown variables, the type is guessed from the variable name.
- Added more checks for relative pathnames.
- Improved the shell parser once more.
diffstat:
pkgtools/pkglint/files/makevars.map | 57 +++++++++++++++++-
pkgtools/pkglint/files/pkglint.pl | 111 +++++++++++++++++++++++++++++------
2 files changed, 146 insertions(+), 22 deletions(-)
diffs (truncated from 402 to 300 lines):
diff -r c60f110c987b -r cb707286327c pkgtools/pkglint/files/makevars.map
--- a/pkgtools/pkglint/files/makevars.map Thu Jan 12 22:17:41 2006 +0000
+++ b/pkgtools/pkglint/files/makevars.map Thu Jan 12 22:28:06 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.54 2006/01/12 13:59:42 rillig Exp $
+# $NetBSD: makevars.map,v 1.55 2006/01/12 22:28:06 rillig Exp $
#
# This file contains the guessed type of some variables, according to
@@ -43,15 +43,30 @@
BDB_DEFAULT Userdefined
BDB_LIBS Readonly
BDB_TYPE Readonly
+BROKEN_GETTEXT_DETECTION Yes
+BROKEN_IN List of { pkgsrc-2005Q4 }
BUILDLINK_DEPENDS List!+ of Dependency
+BUILDLINK_DEPMETHOD BuildlinkDepmethod
+BUILDLINK_DEPTH BuildlinkDepth
+BUILDLINK_FILES List+ of Pathmask
+BUILDLINK_INCDIRS List of Pathname
+BUILDLINK_LIBDIRS List of Pathname
+BUILDLINK_PACKAGES BuildlinkPackages
BUILDLINK_PKGSRCDIR RelativePkgDir
BUILDLINK_RECOMMENDED List!+ of Dependency
+BUILDLINK_RPATHDIRS List of Pathname
+BUILDLINK_TARGETS List+ of Identifier
BUILDLINK_TRANSFORM List+
BUILD_DEFS List+ of Varname
BUILD_DEPENDS List!+ of DependencyWithPath
BUILD_DIRS List of WrksrcSubdirectory
BUILD_ENV List+ of ShellWord
+BUILD_TARGET List of Identifier
BUILD_USES_MSGFMT Yes
+BUILTIN_PKG Identifier
+BUILTIN_FIND_FILES_VAR Varname
+BUILTIN_FIND_FILES List of Pathname
+BUILTIN_FIND_GREP List
BUILTIN_X11_TYPE Readonly
BUILTIN_X11_VERSION Readonly
CATEGORIES List of Category
@@ -62,13 +77,18 @@
CONFIGURE_ARGS List+ of ShellWord
CONFIGURE_DIRS List of WrksrcSubdirectory
CONFIGURE_ENV List+ of ShellWord
+CONFIGURE_SCRIPT Pathname
CONFLICTS List of Dependency
+CONF_FILES List of ShellWord
+CONF_FILES_PERMS List of ShellWord
CPPFLAGS List+ of CFlag
CXX Readonly
CXXFLAGS List+ of CFlag
DEPENDS List!+ of DependencyWithPath
DISTFILES List of Filename
+DISTINFO_FILE RelativePkgPath
DISTNAME Filename
+DIST_SUBDIR Filename
EMACS_BIN Readonly
EMACS_ETCPREFIX Readonly
EMACS_FLAVOR Readonly
@@ -86,23 +106,33 @@
FAM_ACCEPTED List of { fam gamin }
FAM_DEFAULT Userdefined
FAM_TYPE Readonly
+FILESDIR RelativePkgPath
FILES_SUBST List+ of ShellWord
GCC_REQD List+
GNU_CONFIGURE Yes
+HAS_CONFIGURE Yes
HOMEPAGE URL
INCOMPAT_CURSES List of PlatformTriple
+INFO_FILES List of Pathmask
+INSTALLATION_DIRS List of Pathname
INSTALL_DIRS List of WrksrcSubdirectory
INSTALL_SCRIPTS_ENV List+ of ShellWord
+INSTALL_TARGET List of Identifier
INSTALL_UNSTRIPPED YesNo
+IS_BUILTIN YesNoFromCommand
KRB5BASE Readonly
KRB5_ACCEPTED List of { heimdal mit-krb5 }
KRB5_DEFAULT Userdefined
KRB5_TYPE Readonly
LDFLAGS List+
LIBS List+
+LICENSE Identifier
+LTCONFIG_OVERRIDE List+ of Pathmask
MAINTAINER Mail_Address
+MAKEFILE Pathname
MAKEFLAGS List+ of ShellWord
MAKEVARS List+ of Varname
+MAKE_DIRS_PERMS List of ShellWord
MAKE_ENV List+ of ShellWord
MAKE_FLAGS List+ of ShellWord
MANZ Yes
@@ -112,22 +142,31 @@
MYSQL_VERSION_DEFAULT Userdefined
NOT_FOR_COMPILER List of { ccc gcc icc ido mipspro mipspro-ucode sunpro xlc }
NOT_FOR_PLATFORM List of PlatformTriple
+NO_BIN_ON_CDROM Message
+NO_BIN_ON_FTP Message
NO_BUILD Yes
NO_CHECKSUM Yes
NO_CONFIGURE Yes
NO_MTREE Yes
NO_PKGTOOLS_REQD_CHECK Yes
NO_PKG_REGISTER Yes
+NO_SRC_ON_CDROM Message
+NO_SRC_ON_FTP Message
ONLY_FOR_COMPILER List of { ccc gcc icc ido mipspro mipspro-ucode sunpro xlc }
ONLY_FOR_PLATFORM List of PlatformTriple
+OWN_DIRS_PERMS List of ShellWord
PAMBASE Readonly
PAM_ACCEPTED List of { linux-pam openpam solaris-pam }
PAM_DEFAULT Userdefined
PAM_TYPE Readonly
+PATCHDIR RelativePkgPath
+PATCHFILES List of Filename
+PATCH_SITES List of URL
PERL5_PACKLIST Perl5Packlist
PGSQL_VERSIONS_ACCEPTED List of { 73 74 80 }
PGSQL_VERSION_DEFAULT Userdefined
PKGBASE Readonly
+PKGCONFIG_OVERRIDE List of Pathmask
PKGNAME PkgName
PKGNAME_NOREV Readonly
PKGREPOSITORY Userdefined
@@ -144,6 +183,7 @@
PKG_DEFAULT_OPTIONS Userdefined
PKG_FAIL_REASON List+ of ShellWord
PKG_GROUPS List of ShellWord
+PKG_HACKS List+ of Identifier
PKG_INSTALLATION_TYPES List of { overwrite pkgviews }
PKG_JAVA_HOME Readonly
PKG_JVM Readonly
@@ -166,31 +206,42 @@
PKG_SUGGESTED_OPTIONS List of Option
PKG_SUPPORTED_OPTIONS List of Option
PKG_USERS List of ShellWord
-PLIST_SRC List of Pathname
+PLIST_SRC List of RelativePkgPath
PLIST_SUBST List+ of ShellWord
PLIST_TYPE { dynamic static }
+PRINT_PLIST_AWK AwkCommand
PTHREAD_AUTO_VARS YesNo
PTHREAD_OPTS List+ of { native optional require }
PTHREAD_TYPE Readonly
-REPLACE_EMACS List+ of Pathname
+REPLACE_EMACS List+ of Pathmask
+REPLACE_PERL List+ of Pathmask
+RESTRICTED Message
SCRIPTS_ENV List+ of ShellWord
+SPECIAL_PERMS List of ShellWord
+SHLIBTOOL_OVERRIDE List+ of Pathmask
SUBST_CLASSES List+
SUBST_FILES List of Pathmask
SUBST_MESSAGE SubstMessage
SUBST_SED List of ShellWord
# ^^ This may be changed to a List+ later.
SUBST_STAGE Stage
+SVR4_PKGNAME SVR4PkgName
TEST_ENV List+ of ShellWord
+TEST_TARGET List of Identifier
TOOLS_ALIASES List+ of Filename
TOOLS_BROKEN List+ of Tool
TOOLS_CREATE List+ of Tool
TOOLS_GNU_MISSING List+ of Tool
TOOLS_NOOP List+ of Tool
TOOLS_PATH Pathname
+UNLIMIT_RESOURCES List of { datasize stacksize memorysize }
+USE_BUILTIN YesNoFromCommand
+USE_IMAKE Yes
USE_JAVA { run yes }
USE_JAVA2 { YES yes 1.4 1.5 }
USE_LANGUAGES List of { c c++ fortran java objc }
USE_LIBTOOL Yes
+USE_MAKEINFO Yes
USE_PKGINSTALL Yes
USE_PKGLOCALEDIR YesNo
USE_PKGSRC_GCC Userdefined
diff -r c60f110c987b -r cb707286327c pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Thu Jan 12 22:17:41 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Thu Jan 12 22:28:06 2006 +0000
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.469 2006/01/12 13:51:54 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.470 2006/01/12 22:28:06 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -1824,6 +1824,10 @@
$line->log_info("Unresolved path: \"${path}\".");
} elsif (!-e "${current_dir}/${path}") {
$line->log_error("\"${path}\" does not exist.");
+ } elsif ($path =~ qr"^\.\./\.\./([^/]+)/([^/]+)(.*)") {
+ my ($cat, $pkg, $rest) = ($1, $2, $3);
+ } elsif ($path =~ qr"^\.\.") {
+ $line->log_warning("Invalid relative path \"${path}\".");
}
}
@@ -2015,7 +2019,7 @@
$state = SWST_DQUOT;
} elsif ($rest =~ s/^\`//) {
$state = SWST_BACKT;
- } elsif ($rest =~ s/^\\[ !"#'\(\)*;^{}]//) {
+ } elsif ($rest =~ s/^\\[ !"#'\(\)*;\\^{}]//) {
} elsif ($rest =~ s/^\$\$([0-9A-Z_a-z]+)//
|| $rest =~ s/^\$\$\{([0-9A-Z_a-z]+)\}//) {
my ($shvarname) = ($1);
@@ -2052,7 +2056,7 @@
$line->log_debug("[checkline_mk_shellword] Found double-quoted variable ${varname}.");
} elsif ($rest =~ s/^\$\$//) {
$line->log_warning("Unquoted \$ or strange shell variable found.");
- } elsif ($rest =~ s/^\\([\(\)*.0-9n])//) {
+ } elsif ($rest =~ s/^\\([\(\)*\-.0-9n])//) {
my ($char) = ($1);
$line->log_warning("Please use \"\\\\${char}\" instead of \"\\${char}\".");
$line->explain(
@@ -2262,16 +2266,37 @@
checkline_mk_shelltext($line, $shellcmd);
}
-sub checkline_mk_vartype_basic($$$$$);
-sub checkline_mk_vartype_basic($$$$$) {
- my ($line, $varname, $type, $value, $comment) = @_;
+sub checkline_mk_vartype_basic($$$$$$);
+sub checkline_mk_vartype_basic($$$$$$) {
+ my ($line, $varname, $type, $op, $value, $comment) = @_;
my ($value_novar);
$value_novar = $value;
while ($value_novar =~ s/\$\{[^{}]*\}//g) {
}
- if ($type eq "Category") {
+ if ($type eq "AwkCommand") {
+ $opt_warn_debug and $line->log_warning("Unchecked AWK command: ${value}");
+
+ } elsif ($type eq "BuildlinkDepmethod") {
+ if ($value ne $value_novar) {
+ # No checks yet.
+ } elsif ($value ne "build" && $value ne "full") {
+ $line->log_warning("Invalid dependency method \"${value}\". Valid methods are \"build\" or \"full\".");
+ }
+
+ } elsif ($type eq "BuildlinkDepth") {
+ if ($value ne "\${BUILDLINK_DEPTH}+"
+ && $value ne "\${BUILDLINK_DEPTH:S/+\$//}") {
+ $line->log_warning("Invalid value for ${varname}.");
+ }
+
+ } elsif ($type eq "BuildlinkPackages") {
+ if ($value !~ qr"^(?:\$\{BUILDLINK_PACKAGES:N[-0-9A-Z_a-z]+\}|[-0-9A-Z_a-z]+)$") {
+ $line->log_warning("Invalid value for ${varname}.");
+ }
+
+ } elsif ($type eq "Category") {
my $allowed_categories = join("|", qw(
archivers audio
benchmarks biology
@@ -2412,6 +2437,13 @@
$line->log_warning("\"${value}\" is not a valid filename mask.");
}
+ } elsif ($type eq "Identifier") {
+ if ($value ne $value_novar) {
+ #$line->log_warning("Identifiers should be given directly.");
+ } elsif ($value !~ qr"^[+\-.0-9A-Z_a-z]+$") {
+ $line->log_warning("Invalid identifier \"${value}\".");
+ }
+
} elsif ($type eq "Mail_Address") {
if ($value =~ qr"^([-\w\d_.]+)\@([-\w\d.]+)$") {
my (undef, $domain) = ($1, $2);
@@ -2423,6 +2455,11 @@
$line->log_warning("\"${value}\" is not a valid mail address.");
}
+ } elsif ($type eq "Message") {
+ if ($value =~ qr"^[\"'].*[\"']$") {
+ $line->log_warning("${varname} should not be quoted.");
+ }
+
} elsif ($type eq "Option") {
if ($value ne $value_novar) {
$line->log_info("Skipped check for unresolved \"${value}\" as Option name.");
@@ -2469,7 +2506,7 @@
}
} elsif ($type eq "PkgOptionsVar") {
- checkline_mk_vartype_basic($line, $varname, "Varname", $value, $comment);
+ checkline_mk_vartype_basic($line, $varname, "Varname", $op, $value, $comment);
if ($value =~ qr"\$\{PKGBASE[:\}]") {
$line->log_error("PKGBASE must not be used in PKG_OPTIONS_VAR.");
$line->explain(
@@ -2513,6 +2550,19 @@
} elsif ($type eq "RelativePkgDir") {
checkline_relative_pkgdir($line, $value);
+ } elsif ($type eq "RelativePkgPath") {
+ checkline_relative_path($line, $value);
Home |
Main Index |
Thread Index |
Old Index