summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@pkgsrc.org>2006-05-22 07:41:03 +0000
committerrillig <rillig@pkgsrc.org>2006-05-22 07:41:03 +0000
commit732781c1b8bade4558752ef72f8ba0cf8b6879b2 (patch)
treecf27a25aa42b711d4f4c4d6003b9189a56cec37e
parent37b290339e7439551eb88308f5eb7bde14aa6dbd (diff)
downloadpkgsrc-732781c1b8bade4558752ef72f8ba0cf8b6879b2.tar.gz
- Pkglint distinguishes between variables FOO and FOO.* now when checking
data types and permissions. - Changed the way that permissions are determined a bit, so that unspecified permissions can be detected. - Renamed -Wacl to -Wperm. - When no applicable permissions are found, "?" is returned. - When checking for unused variables, parameterized variables don't have to be matched exactly but only by basename. - Added an explanation for the permissions warning.
-rw-r--r--pkgtools/pkglint/files/makevars.map286
-rw-r--r--pkgtools/pkglint/files/pkglint.pl198
2 files changed, 282 insertions, 202 deletions
diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map
index 780b313e22a..29938fb0a53 100644
--- a/pkgtools/pkglint/files/makevars.map
+++ b/pkgtools/pkglint/files/makevars.map
@@ -1,4 +1,4 @@
-# $NetBSD: makevars.map,v 1.92 2006/05/16 22:18:17 rillig Exp $
+# $NetBSD: makevars.map,v 1.93 2006/05/22 07:41:03 rillig Exp $
#
# This file contains the guessed type of some variables, according to
@@ -19,79 +19,79 @@
# The following variables are taken from mk/defaults/mk.conf, 1.118
-ALLOW_VULNERABLE_PACKAGES Yes []
-MANINSTALL List of { maninstall catinstall } []
-MANZ Yes []
-GZIP List of ShellWord []
-MKCRYPTO YesNo []
-OBJHOSTNAME Yes []
-OBJMACHINE Yes []
-PKG_SUFX Filename []
-PKGSRC_LOCKTYPE { none sleep once } []
-PKGSRC_SLEEPSECS Integer []
-USETBL Yes []
-ABI { 32 64 } []
-PKG_DEVELOPER Yes []
-USE_ABI_DEPENDS YesNo []
-PKG_REGISTER_SHELLS { YES NO } []
-PKGSRC_COMPILER List of { ccc ccache distcc f2c icc ido gcc mipspro mipspro-ucode sunpro xlc } []
-PKGSRC_MESSAGE_RECIPIENTS List of Mail_Address
-PKGSRC_SHOW_BUILD_DEFS YesNo []
-PKGSRC_SHOW_PATCH_ERRORMSG YesNo []
-PKGSRC_RUN_TEST YesNo []
-PREFER_PKGSRC List of PkgBase []
-PREFER_NATIVE List of PkgBase []
-PREFER_NATIVE_PTHREADS YesNo []
-LOCALBASE Pathname []
-CROSSBASE Pathname []
-VARBASE Pathname []
+ALLOW_VULNERABLE_PACKAGES Yes [*:]
+MANINSTALL List of { maninstall catinstall } [*:]
+MANZ Yes [*:]
+GZIP List of ShellWord [*:]
+MKCRYPTO YesNo [*:]
+OBJHOSTNAME Yes [*:]
+OBJMACHINE Yes [*:]
+PKG_SUFX Filename [*:]
+PKGSRC_LOCKTYPE { none sleep once } [*:]
+PKGSRC_SLEEPSECS Integer [*:]
+USETBL Yes [*:]
+ABI { 32 64 } [*:]
+PKG_DEVELOPER Yes [*:]
+USE_ABI_DEPENDS YesNo [*:]
+PKG_REGISTER_SHELLS { YES NO } [*:]
+PKGSRC_COMPILER List of { ccc ccache distcc f2c icc ido gcc mipspro mipspro-ucode sunpro xlc } [*:]
+PKGSRC_MESSAGE_RECIPIENTS List of Mail_Address [*:]
+PKGSRC_SHOW_BUILD_DEFS YesNo [*:]
+PKGSRC_SHOW_PATCH_ERRORMSG YesNo [*:]
+PKGSRC_RUN_TEST YesNo [*:]
+PREFER_PKGSRC List of PkgBase [*:]
+PREFER_NATIVE List of PkgBase [*:]
+PREFER_NATIVE_PTHREADS YesNo [*:]
+LOCALBASE Pathname [*:]
+CROSSBASE Pathname [*:]
+VARBASE Pathname [*:]
X11_TYPE { native XFree86 xorg }
-X11BASE Pathname []
-MOTIFBASE Pathname []
-PKGINFODIR Pathname []
-PKGMANDIR Pathname []
-USE_XPKGWEDGE YesNo []
-BSDSRCDIR Pathname []
-BSDXSRCDIR Pathname []
-DISTDIR Pathname []
-DIST_PATH Pathlist []
-DEFAULT_VIEW Unchecked []
-FETCH_CMD ShellCommand []
-FETCH_RESUME_ARGS List of ShellWord []
-FETCH_OUTPUT_ARGS List of ShellWord []
-LIBTOOLIZE_PLIST YesNo []
-PKG_INSTALLATION_PREFS List of { overwrite pkgviews } []
-PKG_RESUME_TRANSFERS YesNo []
-PKG_SYSCONFBASE Pathname []
-RCD_SCRIPTS_DIR Pathname []
-PACKAGES Pathname []
-PKGVULNDIR Pathname []
-PASSIVE_FETCH Yes []
-PATCH_FUZZ_FACTOR { -F0 -F1 -F2 -F3 } []
-ACCEPTABLE_LICENSES List of Identifier []
-SPECIFIC_PKGS Yes []
-SITE_SPECIFIC_PKGS List of PkgPath []
-HOST_SPECIFIC_PKGS List of PkgPath []
-GROUP_SPECIFIC_PKGS List of PkgPath []
-USER_SPECIFIC_PKGS List of PkgPath []
-EXTRACT_USING { gtar nbtar pax } []
-FAILOVER_FETCH Yes []
-MASTER_SORT List of Unchecked []
-MASTER_SORT_REGEX List of Unchecked []
-PATCH_DEBUG Yes []
-PKG_FC ShellCommand []
-IMAKE ShellCommand []
-IMAKEOPTS List of ShellWord []
-PRE_ROOT_CMD ShellCommand []
-SETGIDGAME YesNo []
-SU_CMD ShellCommand []
-SU_CMD_PATH_APPEND Pathlist []
-FATAL_OBJECT_FMT_SKEW YesNo []
-WARN_NO_OBJECT_FMT YesNo []
-SMART_MESSAGES Yes []
-BINPKG_SITES List of URL []
-BIN_INSTALL_FLAG List of ShellWord []
-LOCALPATCHES Pathname []
+X11BASE Pathname [*:]
+MOTIFBASE Pathname [*:]
+PKGINFODIR Pathname [*:]
+PKGMANDIR Pathname [*:]
+USE_XPKGWEDGE YesNo [*:]
+BSDSRCDIR Pathname [*:]
+BSDXSRCDIR Pathname [*:]
+DISTDIR Pathname [*:]
+DIST_PATH Pathlist [*:]
+DEFAULT_VIEW Unchecked [*:]
+FETCH_CMD ShellCommand [*:]
+FETCH_RESUME_ARGS List of ShellWord [*:]
+FETCH_OUTPUT_ARGS List of ShellWord [*:]
+LIBTOOLIZE_PLIST YesNo [*:]
+PKG_INSTALLATION_PREFS List of { overwrite pkgviews } [*:]
+PKG_RESUME_TRANSFERS YesNo [*:]
+PKG_SYSCONFBASE Pathname [*:]
+RCD_SCRIPTS_DIR Pathname [*:]
+PACKAGES Pathname [*:]
+PKGVULNDIR Pathname [*:]
+PASSIVE_FETCH Yes [*:]
+PATCH_FUZZ_FACTOR { -F0 -F1 -F2 -F3 } [*:]
+ACCEPTABLE_LICENSES List of Identifier [*:]
+SPECIFIC_PKGS Yes [*:]
+SITE_SPECIFIC_PKGS List of PkgPath [*:]
+HOST_SPECIFIC_PKGS List of PkgPath [*:]
+GROUP_SPECIFIC_PKGS List of PkgPath [*:]
+USER_SPECIFIC_PKGS List of PkgPath [*:]
+EXTRACT_USING { gtar nbtar pax } [*:]
+FAILOVER_FETCH Yes [*:]
+MASTER_SORT List of Unchecked [*:]
+MASTER_SORT_REGEX List of Unchecked [*:]
+PATCH_DEBUG Yes [*:]
+PKG_FC ShellCommand [*:]
+IMAKE ShellCommand [*:]
+IMAKEOPTS List of ShellWord [*:]
+PRE_ROOT_CMD ShellCommand [*:]
+SETGIDGAME YesNo [*:]
+SU_CMD ShellCommand [*:]
+SU_CMD_PATH_APPEND Pathlist [*:]
+FATAL_OBJECT_FMT_SKEW YesNo [*:]
+WARN_NO_OBJECT_FMT YesNo [*:]
+SMART_MESSAGES Yes [*:]
+BINPKG_SITES List of URL [*:]
+BIN_INSTALL_FLAG List of ShellWord [*:]
+LOCALPATCHES Pathname [*:]
# some other variables, sorted alphabetically
@@ -101,58 +101,63 @@ ALTERNATIVES_SRC List of Pathname
APACHE_MODULE Yes
AUTOCONF_REQD List of Version [*:a]
AUTOMAKE_OVERRIDE List of Pathmask
+AUTOMAKE_REQD List of Version [*:a]
BDB185_DEFAULT Unchecked []
BDBBASE Unchecked []
BDB_ACCEPTED List of { db1 db2 db3 db4 }
BDB_DEFAULT Unchecked []
BDB_LIBS Unchecked []
BDB_TYPE Unchecked []
-BROKEN Message
+BROKEN Message []
BROKEN_GETTEXT_DETECTION YesNo [m:s,c:s]
BROKEN_IN List of BrokenIn [m:s]
-BUILDLINK_ABI_DEPENDS List of Dependency [b:a,m:a]
-BUILDLINK_API_DEPENDS List of Dependency [b:a,m:a,builtin.mk:a]
-BUILDLINK_CONTENTS_FILTER List of ShellWord
+BUILDLINK_ABI_DEPENDS.* List of Dependency [b:a,m:a]
+BUILDLINK_API_DEPENDS.* List of Dependency [b:a,m:a,builtin.mk:a]
+BUILDLINK_CONTENTS_FILTER List of ShellWord []
# ^^ ShellCommand
-BUILDLINK_CFLAGS List of CFlag
-BUILDLINK_CPPFLAGS List of CFlag
+BUILDLINK_CFLAGS.* List of CFlag []
+BUILDLINK_CPPFLAGS.* List of CFlag []
BUILDLINK_DEPENDS InternalList of Dependency [b:a]
-BUILDLINK_DEPMETHOD BuildlinkDepmethod [b:d,m:as,c:a,*.mk:a]
+BUILDLINK_DEPMETHOD.* BuildlinkDepmethod [b:d,m:as,c:a,*.mk:a]
BUILDLINK_DEPTH BuildlinkDepth [b:s]
-BUILDLINK_FILES List of Pathmask [b:a, builtin.mk:a]
-BUILDLINK_FILES_CMD List of ShellWord
+BUILDLINK_FILES.* List of Pathmask [b:a, builtin.mk:a]
+BUILDLINK_FILES_CMD.* List of ShellWord []
# ^^ ShellCommand
-BUILDLINK_INCDIRS List of Pathname [b:ad] # b:d?
-BUILDLINK_JAVA_PREFIX Pathname
-BUILDLINK_LDADD List of LdFlag [builtin.mk:ads]
-BUILDLINK_LDFLAGS List of LdFlag
-BUILDLINK_LIBDIRS List of Pathname [b:a]
-BUILDLINK_LIBS List of LdFlag [b:a]
+BUILDLINK_INCDIRS.* List of Pathname [b:ad] # b:d?
+BUILDLINK_JAVA_PREFIX Pathname []
+BUILDLINK_LDADD.* List of LdFlag [builtin.mk:ads]
+BUILDLINK_LDFLAGS.* List of LdFlag []
+BUILDLINK_LIBDIRS.* List of Pathname [b:a]
+BUILDLINK_LIBS.* List of LdFlag [b:a]
BUILDLINK_PACKAGES BuildlinkPackages [b:as]
BUILDLINK_PASSTHRU_DIRS List of Pathname [m:a,c:a,b:a,h:a]
BUILDLINK_PASSTHRU_RPATHDIRS List of Pathname [m:a,c:a,b:a,h:a]
-BUILDLINK_PKGSRCDIR RelativePkgDir [b:d]
-BUILDLINK_PREFIX Pathname [builtin.mk:s]
-BUILDLINK_RPATHDIRS List of Pathname
-BUILDLINK_TARGETS List of Identifier
-BUILDLINK_TRANSFORM List of WrapperTransform [m:a,builtin.mk:a,h:a,b:a]
+BUILDLINK_PKGSRCDIR.* RelativePkgDir [b:d]
+BUILDLINK_PREFIX.* Pathname [builtin.mk:s]
+BUILDLINK_RPATHDIRS List of Pathname []
+BUILDLINK_TARGETS List of Identifier []
+BUILDLINK_TRANSFORM.* SedCommands [m:a,builtin.mk:a,h:a,b:a]
+BUILDLINK_TRANSFORM List of WrapperTransform [*:a]
BUILD_DEFS List of Varname [m:a,c:a,o:a]
BUILD_DEPENDS InternalList of DependencyWithPath [c:a,m:a,o:a,*.mk:a]
BUILD_DIRS List of WrksrcSubdirectory [m:as,c:as]
BUILD_ENV List of ShellWord [*:a]
-BUILD_TARGET List of Identifier [m:as,c:as]
+BUILD_MAKE_FLAGS List of ShellWord [*:a]
+BUILD_TARGET List of Identifier [m:as,c:as,o:as]
BUILD_USES_MSGFMT Yes
BUILTIN_PKG Identifier [builtin.mk:s]
BUILTIN_FIND_FILES_VAR List of Varname [builtin.mk:s]
-BUILTIN_FIND_FILES List of Pathname [builtin.mk:s]
-BUILTIN_FIND_GREP List of ShellWord [builtin.mk:s]
+BUILTIN_FIND_FILES.* List of Pathname [builtin.mk:s]
+BUILTIN_FIND_GREP.* List of ShellWord [builtin.mk:s]
BUILTIN_FIND_LIBS List of Pathname [builtin.mk:s]
+BUILTIN_IMAKE_CHECK List of Unchecked [builtin.mk:s]
+BUILTIN_IMAKE_CHECK.* YesNo []
BUILTIN_X11_TYPE Unchecked []
BUILTIN_X11_VERSION Unchecked []
CATEGORIES List of Category [m:as,c:as]
CC_VERSION Unchecked []
CC ShellCommand [m:]
-CFLAGS List of CFlag [m:a,c:a,o:a,h:a]
+CFLAGS* List of CFlag [m:a,c:a,o:a,h:a]
CHECK_BUILTIN YesNo [builtin.mk:d,m:s]
CHECK_FILES_SKIP List of Pathmask [m:a,c:a]
CHECK_INTERPRETER_SKIP List of Pathmask [m:a,c:a]
@@ -173,13 +178,13 @@ CONFLICTS List of Dependency [m:as,c:a]
CONF_FILES List of ShellWord [m:as,c:a]
CONF_FILES_MODE { 0644 0640 0600 0400 } [m:as,c:a]
CONF_FILES_PERMS List of ShellWord [m:as,c:a,o:a]
-CPPFLAGS List of CFlag [m:a,h:a,c:a,o:a]
+CPPFLAGS* List of CFlag [m:a,h:a,c:a,o:a]
CRYPTO Yes [m:s]
CXX ShellCommand [m:]
-CXXFLAGS List of CFlag [m:a,c:a,o:a,h:a]
+CXXFLAGS* List of CFlag [m:a,c:a,o:a,h:a]
DEINSTALL_FILE Pathname [m:s]
DEINSTALL_SRC List of Pathname [m:s,c:ds]
-DEINSTALL_TEMPLATE List of Pathname
+DEINSTALL_TEMPLATE List of Pathname [m:as,c:ads]
DEPENDS InternalList of DependencyWithPath [*:a]
DESCR_SRC List of Pathname [m:s,c:ds]
DEVOSSAUDIO Pathname
@@ -188,16 +193,19 @@ DISTFILES List of Filename [m:as,c:ads]
DISTINFO_FILE RelativePkgPath [m:s,c:ds]
DISTNAME Filename [m:s,c:ads, Makefile.*:ds]
DIST_SUBDIR Filename [m:s,c:ds,Makefile.*:ds]
+DJB_BUILD_ARGS List of ShellWord
DJB_BUILD_TARGETS List of Identifier
-DJB_CONFIG_CMDS List of ShellWord
+DJB_CONFIG_CMDS List of ShellWord [o:s]
# ^^ ShellCommand, terminated by a semicolon
+DJB_CONFIG_DIRS List of WrksrcSubdirectory
DJB_CONFIG_HOME Filename
+DJB_CONFIG_PREFIX Pathname
DJB_INSTALL_TARGETS List of Identifier
-DJB_MAKE_TARGETS List of Identifier
+DJB_MAKE_TARGETS YesNo
DJB_RESTRICTED YesNo [m:s]
DJB_SLASHPACKAGE YesNo
DLOPEN_REQUIRE_PTHREADS YesNo
-DL_AUTO_VARS Yes
+DL_AUTO_VARS Yes [m:s,c:s,o:s]
DL_LIBS List of LdFlag
EGDIR Pathname [m:s,c:s]
# ^^ This variable is not defined by the system, but has been established
@@ -236,7 +244,7 @@ FETCH_BEFORE_ARGS List of ShellWord [m:as]
FILESDIR RelativePkgPath [m:s,c:ds]
FILES_SUBST List of ShellWord [*:a]
FILES_SUBST_SED List of ShellWord
-FONTS_DIRS List of Pathname [m:as,c:a]
+FONTS_DIRS.* List of Pathname [m:as,c:a]
GCC_REQD List of Version [*:a]
GENERATE_PLIST List of ShellWord [m:a,c:a]
# ^^ List of Shellcommand, terminated with a semicolon
@@ -271,11 +279,11 @@ INSTALL_SCRIPT ShellCommand []
INSTALL_SCRIPTS_ENV List of ShellWord
INSTALL_SCRIPT_DIR ShellCommand []
INSTALL_SRC List of Pathname [m:s,c:ds]
-INSTALL_TARGET List of Identifier [m:as,c:as,b:,ruby*.mk:d]
-INSTALL_TEMPLATE List of Pathname
+INSTALL_TARGET List of Identifier [m:as,c:as,b:,ruby*.mk:d,o:as]
+INSTALL_TEMPLATE List of Pathname [m:as,c:ads]
INSTALL_UNSTRIPPED YesNo [m:s,c:s]
INTERACTIVE_STAGE List of { fetch extract configure build install } [m:s]
-IS_BUILTIN YesNoFromCommand [builtin.mk:s]
+IS_BUILTIN.* YesNo_Indirectly [builtin.mk:s]
JAVA_CLASSPATH ShellWord
JAVA_NAME Filename
JAVA_UNLIMIT List of { cmdsize datasize stacksize }
@@ -284,19 +292,19 @@ KRB5BASE Unchecked []
KRB5_ACCEPTED List of { heimdal mit-krb5 }
KRB5_DEFAULT Unchecked []
KRB5_TYPE Unchecked []
-LDFLAGS List of LdFlag [b:,builtin.mk:,*:a]
+LDFLAGS* List of LdFlag [b:,builtin.mk:,*:a]
LIBOSSAUDIO Pathname
-LIBS List of LdFlag [m:a,o:a,h:a,c:a]
+LIBS* List of LdFlag [m:a,o:a,h:a,c:a]
LIBTOOL_OVERRIDE List of Pathmask [m:as]
-LICENCE License
-LICENSE License [m:s,c:s]
+LICENCE License [m:s,c:s,o:s]
+LICENSE License [m:s,c:s,o:s]
LTCONFIG_OVERRIDE List of Pathmask [m:as,c:a]
MAINTAINER Mail_Address [m:s,c:ds]
MAKEFILE Pathname [m:s,c:s]
MAKEFLAGS List of ShellWord [m:a,c:a,b:a,h:a]
-MAKEVARS List of Varname [builtin.mk:a,b:a]
-MAKE_DIRS List of Pathname
-MAKE_DIRS_PERMS List of ShellWord
+MAKEVARS List of Varname [builtin.mk:a,b:a,h:a]
+MAKE_DIRS List of Pathname [m:as,c:a]
+MAKE_DIRS_PERMS List of ShellWord [m:as,c:a]
MAKE_ENV List of ShellWord [*:a]
MAKE_FLAGS List of ShellWord [*:a]
MANCOMPRESSED YesNo [m:s,c:ds]
@@ -362,7 +370,8 @@ PATCH_DIST_CAT ShellCommand
PATCH_DIST_STRIP ShellWord [o:s,c:a,m:as]
PATCH_SITES List of URL [m:s,o:s,c:s]
PATCH_STRIP ShellWord
-PERL5_PACKLIST Perl5Packlist [m:s,o:sa]
+PERL5_PACKLIST List of Perl5Packlist [m:s,o:sa]
+PERL5_PACKLIST_DIR Pathname []
PGSQL_VERSIONS_ACCEPTED List of { 73 74 80 }
PGSQL_VERSION_DEFAULT Unchecked []
PKGBASE Unchecked []
@@ -381,10 +390,10 @@ PKG_APACHE_DEFAULT Unchecked []
PKG_DEBUG_LEVEL Unchecked []
PKG_DEFAULT_OPTIONS Unchecked []
PKG_FAIL_REASON List of ShellWord [*:a]
-PKG_GECOS Unchecked [m:s]
-PKG_GID Unchecked [m:s]
+PKG_GECOS.* Unchecked [m:s]
+PKG_GID.* Unchecked [m:s]
PKG_GROUPS List of ShellWord [m:as]
-PKG_HOME Pathname [m:s]
+PKG_HOME.* Pathname [m:s]
PKG_HACKS List of Identifier [h:a]
PKG_INSTALLATION_TYPES List of { overwrite pkgviews } [m:s,c:s]
PKG_JAVA_HOME Unchecked []
@@ -392,19 +401,21 @@ PKG_JVM Unchecked []
PKG_JVMS_ACCEPTED List of { blackdown-jdk13 jdk jdk14 kaffe sun-jdk13 sun-jdk14 sun-jdk15 }
PKG_JVM_DEFAULT Unchecked []
PKG_LEGACY_OPTIONS List of Option
-PKG_LIBTOOL Pathname
-PKG_OPTIONS List of Option [o:,m:,c:,bsd.options.mk:s]
+PKG_LIBTOOL Pathname [m:s]
+PKG_OPTIONS List of Option [bsd.options.mk:s,*:]
+PKG_OPTIONS.* List of Option [*:]
PKG_OPTIONS_DEPRECATED_WARNINGS List of ShellWord
-PKG_OPTIONS_GROUP List of Option [o:s,m:s]
+PKG_OPTIONS_GROUP.* List of Option [o:s,m:s]
PKG_OPTIONS_LEGACY_OPTS List of Unchecked [m:a,c:a,o:a]
PKG_OPTIONS_LEGACY_VARS List of Unchecked [m:a,c:a,o:a]
PKG_OPTIONS_NONEMPTY_SETS List of Option
PKG_OPTIONS_OPTIONAL_GROUPS List of Identifier [o:as]
PKG_OPTIONS_REQUIRED_GROUPS List of Identifier [o:s,m:s]
-PKG_OPTIONS_SET List of Option
+PKG_OPTIONS_SET.* List of Option
PKG_OPTIONS_VAR PkgOptionsVar [o:s,m:s,c:s]
PKG_PRESERVE Yes [m:s]
PKG_SHELL Pathname [m:s,c:s]
+PKG_SHELL.* Pathname [m:s,c:s]
PKG_SHLIBTOOL Pathname
PKG_SKIP_REASON List of ShellWord
PKG_SUGGESTED_OPTIONS List of Option [o:as,m:as,c:s]
@@ -415,6 +426,7 @@ PKG_SYSCONFVAR Identifier
# ^^ FIXME: name/type mismatch.
PKG_UID Unchecked [m:s]
PKG_USERS List of ShellWord [m:as]
+PKG_USE_KERBEROS Yes [m:s,c:s]
PLIST_SRC List of RelativePkgPath [m:as,o:a,c:ads]
PLIST_SUBST List of ShellWord [*:a]
PLIST_TYPE { dynamic static }
@@ -423,28 +435,30 @@ PRINT_PLIST_AWK AwkCommand [*:a]
PTHREAD_AUTO_VARS YesNo [m:s]
PTHREAD_OPTS List of { native optional require } [m:as,c:a,b:a]
PTHREAD_TYPE Unchecked []
+PYTHON_PATCH_SCRIPTS List of Pathmask [m:as,*:a]
RCD_SCRIPTS List of Filename [m:s,c:as]
-RCD_SCRIPT_SRC List of Pathname [m:s]
-REPLACE String [m:s]
+RCD_SCRIPT_SRC.* List of Pathname [m:s]
+REPLACE.* String [m:s]
REPLACE_EMACS List of Pathmask
-REPLACE_FILES List of Pathmask [m:as,c:as]
+REPLACE_FILES.* List of Pathmask [m:as,c:as]
REPLACE_INTERPRETER List of Identifier [m:a,c:a]
-REPLACE_PERL List of Pathmask [m:as,c:a]
+REPLACE_PERL List of Pathmask [m:as,c:a,o:a]
REQD_DIRS List of Pathname [m:as]
+REQD_DIRS_PERMS List of ShellWord [m:as,c:a]
REQD_FILES List of Pathname [m:as]
REQD_FILES_MODE { 0644 0640 0600 0400 } [m:as]
RESTRICTED Message [m:s,c:ds]
-SCRIPTS_ENV List of ShellWord
+SCRIPTS_ENV List of ShellWord [m:a,c:a]
SHLIB_HANDLING { YES NO no }
SPECIAL_PERMS List of ShellWord [m:as]
SHLIBTOOL_OVERRIDE List of Pathmask [m:as,c:a]
-SITES List of URL [m:as,c:as,o:as]
+SITES.* List of URL [m:as,c:as,o:as]
SUBST_CLASSES List of Identifier [m:a,c:a,h:a,Makefile.*:a]
-SUBST_FILES List of Pathmask [m:as,c:as,h:as,o:as,Makefile.*:as]
-SUBST_FILTER_CMD ShellCommand [m:s,c:s,h:s,o:s,Makefile.*:as]
-SUBST_MESSAGE Message [m:s,c:s,h:s,o:s,Makefile.*:as]
-SUBST_SED SedCommands [m:as,c:as,h:as,o:as,Makefile.*:as]
-SUBST_STAGE Stage [m:s,c:s,h:s,o:s,Makefile.*:as]
+SUBST_FILES.* List of Pathmask [m:as,c:as,h:as,o:as,Makefile.*:as]
+SUBST_FILTER_CMD.* ShellCommand [m:s,c:s,h:s,o:s,Makefile.*:as]
+SUBST_MESSAGE.* Message [m:s,c:s,h:s,o:s,Makefile.*:as]
+SUBST_SED.* SedCommands [m:as,c:as,h:as,o:as,Makefile.*:as]
+SUBST_STAGE.* Stage [m:s,c:s,h:s,o:s,Makefile.*:as]
SVR4_PKGNAME SVR4PkgName [m:s]
TEST_DIRS List of WrksrcSubdirectory [m:as,c:as]
TEST_ENV List of ShellWord
@@ -460,7 +474,7 @@ TOOLS_NOOP List of Tool
TOOLS_PATH Pathname
UNLIMIT_RESOURCES List of { datasize stacksize memorysize } [m:as,c:a]
UNWRAP_FILES List of Pathmask [m:a,c:a]
-USE_BUILTIN YesNoFromCommand [builtin.mk:s]
+USE_BUILTIN.* YesNo_Indirectly [builtin.mk:s]
USE_CROSSBASE Yes [m:s]
USE_DIRS List of { \
XFree86-1.0 XFree86-1.1 \
@@ -472,8 +486,8 @@ USE_DIRS List of { \
xorg-1.0 \
} [m:a,c:a]
USE_GNU_CONFIGURE_HOST YesNo
-USE_GNU_ICONV Yes [m:s,c:s]
-USE_GNU_READLINE Yes [m:s]
+USE_GNU_ICONV Yes [m:s,c:s,o:s]
+USE_GNU_READLINE Yes [m:s,c:s,o:s]
USE_IMAKE Yes [m:s]
USE_JAVA { run yes } [m:s]
USE_JAVA2 { YES yes 1.4 1.5 } [m:s]
diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl
index 5b57adad1c6..7f4a361e2da 100644
--- a/pkgtools/pkglint/files/pkglint.pl
+++ b/pkgtools/pkglint/files/pkglint.pl
@@ -1,5 +1,5 @@
#! @PERL@
-# $NetBSD: pkglint.pl,v 1.586 2006/05/21 15:46:43 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.587 2006/05/22 07:41:03 rillig Exp $
#
# pkglint - static analyzer and checker for pkgsrc packages
@@ -23,10 +23,11 @@
# Freely redistributable. Absolutely no warranty.
#==========================================================================
-# Some comments on the overall structure: The @EXPORT clauses in the pack-
-# ages must be in a BEGIN block, because otherwise the names starting with
-# an uppercase letter are not recognized as subroutines but as file handles.
+# Note: The @EXPORT clauses in the packages must be in a BEGIN block,
+# because otherwise the names starting with an uppercase letter are not
+# recognized as subroutines but as file handles.
#==========================================================================
+
use strict;
use warnings;
@@ -44,6 +45,7 @@ BEGIN {
use vars qw(@ISA @EXPORT_OK);
@ISA = qw(Exporter);
@EXPORT_OK = qw(
+ assert
false true
min max
array_to_hash print_table
@@ -53,6 +55,25 @@ BEGIN {
use constant false => 0;
use constant true => 1;
+sub assert($) {
+ my ($cond) = @_;
+ my (@callers, $n);
+
+ if (!$cond) {
+ print STDERR ("FATAL: Assertion failed.\n");
+
+ for ($n = 0; my @info = caller($n); $n++) {
+ push(@callers, [$info[2], $info[3]]);
+ }
+
+ for (my $i = $#callers; $i >= 0; $i--) {
+ my $info = $callers[$i];
+ printf STDERR (" at line %4d in %s\n", $info->[0], $info->[1]);
+ }
+ exit(1);
+ }
+}
+
sub min($$) {
my ($a, $b) = @_;
@@ -1121,6 +1142,9 @@ BEGIN {
import PkgLint::Util qw(
false true
);
+ import PkgLint::Logging qw(
+ log_warning NO_LINES
+ );
use Exporter;
use vars qw(@ISA @EXPORT_OK);
@ISA = qw(Exporter);
@@ -1149,23 +1173,15 @@ sub kind_of_list($) { return shift(@_)->[KIND_OF_LIST]; }
sub basic_type($) { return shift(@_)->[BASIC_TYPE]; }
sub perms($$) {
- my ($self, $fname) = @_;
+ my ($self, $fname, $varcanon) = @_;
my ($perms);
- # If there is no ACL defined at all, everything is allowed.
- if (!defined($self->[ACLS])) {
- return "adpsu";
- }
-
- # By default, nothing is allowed.
- $perms = "";
foreach my $acl_entry (@{$self->[ACLS]}) {
if ($fname =~ $acl_entry->[0]) {
- $perms = $acl_entry->[1];
- last;
+ return $acl_entry->[1];
}
}
- return $perms;
+ return undef;
}
#== End of PkgLint::Type ==================================================
@@ -1211,7 +1227,7 @@ use pkgsrc::Dewey;
BEGIN {
import PkgLint::Util qw(
- array_to_hash false true
+ array_to_hash assert false true
);
import PkgLint::Logging qw(
NO_FILE NO_LINE_NUMBER NO_LINES
@@ -1265,10 +1281,10 @@ my (%checks) = (
);
my $opt_warn_absname = true;
-my $opt_warn_acl = false;
my $opt_warn_directcmd = true;
my $opt_warn_extra = false;
my $opt_warn_order = true;
+my $opt_warn_perm = false;
my $opt_warn_plist_depr = false;
my $opt_warn_plist_sort = false;
my $opt_warn_quoting = false;
@@ -1278,10 +1294,10 @@ my $opt_warn_types = true;
my $opt_warn_varorder = false;
my (%warnings) = (
"absname" => [\$opt_warn_absname, "warn about use of absolute file names"],
- "acl" => [\$opt_warn_acl, "enable ACLs for restricting variable definitions"],
"directcmd" => [\$opt_warn_directcmd, "warn about use of direct command names instead of Make variables"],
"extra" => [\$opt_warn_extra, "enable some extra warnings"],
"order" => [\$opt_warn_order, "warn if Makefile entries are unordered"],
+ "perm" => [\$opt_warn_perm, "warn about unforeseen variable definition and use"],
"plist-depr" => [\$opt_warn_plist_depr, "warn about deprecated paths in PLISTs"],
"plist-sort" => [\$opt_warn_plist_sort, "warn about unsorted entries in PLISTs"],
"quoting" => [\$opt_warn_quoting, "warn about quoting issues"],
@@ -2226,20 +2242,6 @@ sub backtrace() {
}
}
-sub determine_used_variables($) {
- my ($lines) = @_;
- my ($rest);
-
- foreach my $line (@{$lines}) {
- $rest = $line->text;
- while ($rest =~ s/(?:\$\{|defined\(|empty\()([0-9+.A-Z_a-z]+)[:})]//) {
- my ($varname) = ($1);
- $varuse->{$varname} = $line;
- $line->log_debug("Variable ${varname} is used.");
- }
- }
-}
-
sub tablen($) {
my ($s) = @_;
my ($len);
@@ -2266,6 +2268,18 @@ sub shell_split($) {
return (($text =~ qr"^\s*$") ? $words : false);
}
+sub varname_base($) {
+ my ($varname) = @_;
+
+ return ($varname =~ qr"^(.*?)\..*$") ? $1 : $varname;
+}
+
+sub varname_canon($) {
+ my ($varname) = @_;
+
+ return ($varname =~ qr"^(.*?)\..*$") ? "$1.*" : $varname;
+}
+
sub type_should_be_quoted($) {
my ($type) = @_;
@@ -2284,7 +2298,22 @@ sub type_should_be_quoted($) {
sub variable_needs_quoting($) {
my ($varname) = @_;
- return !($varname =~ qr"^(?:.*DIR|.*_GROUP|.*_HOME|(?:BIN|LIB|MAN|GAMES|SHARE)(?:GRP|OWN|MODE)|.*_USER|BUILDLINK_PREFIX\..*|DISTNAME|LOCALBASE|PKGNAME|PREFIX|WRKSRC)$");
+ return !($varname =~ qr"^(?:.*DIR|.*_GROUP|.*_HOME|(?:BIN|LIB|MAN|GAMES|SHARE)(?:GRP|OWN|MODE)|.*_USER|BUILDLINK_PREFIX\..*|DISTNAME|EXTRACT_SUFX|LOCALBASE|PKGNAME|PREFIX|VARBASE|WRKSRC)$");
+}
+
+sub determine_used_variables($) {
+ my ($lines) = @_;
+ my ($rest);
+
+ foreach my $line (@{$lines}) {
+ $rest = $line->text;
+ while ($rest =~ s/(?:\$\{|defined\(|empty\()([0-9+.A-Z_a-z]+)[:})]//) {
+ my ($varname) = ($1);
+ $varuse->{$varname} = $line;
+ $varuse->{varname_canon($varname)} = $line;
+ $line->log_debug("Variable ${varname} is used.");
+ }
+ }
}
my $check_pkglint_version_done = false;
@@ -2350,6 +2379,39 @@ sub expect_text($$$) {
}
}
+sub get_variable_type($$) {
+ my ($line, $varname) = @_;
+
+ if (exists(get_vartypes_map()->{$varname})) {
+ return get_vartypes_map()->{$varname};
+ }
+
+ my $varcanon = varname_canon($varname);
+ if (exists(get_vartypes_map()->{$varcanon})) {
+ return get_vartypes_map()->{$varcanon};
+ }
+
+ $opt_debug and $line->log_warning("No type definition found for ${varcanon}.");
+ return undef;
+}
+
+sub get_variable_perms($$) {
+ my ($line, $varname) = @_;
+
+ my $type = get_variable_type($line, $varname);
+ if (!defined($type)) {
+ $opt_debug and $line->log_warning("No type definition found for ${varname}.");
+ return "adpsu";
+ }
+
+ my $perms = $type->perms($line->fname, $varname);
+ if (!defined($perms)) {
+ $opt_debug and $line->log_warning("No permissions specified for ${varname}.");
+ return "?";
+ }
+ return $perms;
+}
+
#
# Loading package-specific data from files.
#
@@ -3154,32 +3216,34 @@ sub checkline_mk_shellcmd($$) {
sub checkline_mk_vardef($$$) {
my ($line, $varname, $op) = @_;
- my $varbase = ($varname =~ qr"(.+?)\..*") ? $1 : $varname;
- if (!$opt_warn_acl) {
- # Skip this check.
+ return unless $opt_warn_perm;
- } elsif (exists(get_vartypes_map()->{$varbase})) {
- my $perms = get_vartypes_map()->{$varbase}->perms($line->fname);
- my $needed = { "=" => "s", "!=" => "s", "?=" => "d", "+=" => "a", ":=" => "s" }->{$op};
+ my $perms = get_variable_perms($line, $varname);
+ my $needed = { "=" => "s", "!=" => "s", "?=" => "d", "+=" => "a", ":=" => "s" }->{$op};
- if (!defined($perms)) {
- $opt_debug and $line->log_warning("No ACL definition for ${varname}.");
- } elsif (index($perms, $needed) != -1) {
- # Fine.
- } else {
- $line->log_warning("ACL mismatch for ${varname}: [${needed}] requested, but only [${perms}] is allowed.");
- }
- } else {
- $opt_debug and $line->log_warning("No data type for ${varname}.");
+ if (index($perms, $needed) == -1) {
+ $line->log_warning("Permission [${needed}] requested for ${varname}, but only [${perms}] is allowed.");
+ $line->explain_warning(
+ "The available permissions are:",
+ "\ta\tappend something using +=",
+ "\td\tset a default value using ?=",
+ "\ts\tset a variable using :=, =, !=",
+ "\tp\tuse a variable during preprocessing",
+ "\tu\tuse a variable at runtime",
+ "",
+ "A \"?\" means that it is not yet clear which permissions",
+ "are allowed and which aren't.");
}
}
sub checkline_mk_varuse($$$) {
my ($line, $varname, $context) = @_;
- # TODO: ACL checks
- $line->log_info("varuse: ${varname}");
+ return unless $opt_warn_perm;
+
+ my $perms = get_variable_perms($line, $varname);
+ # TODO: Check something.
}
sub checkline_mk_vartype_basic($$$$$$$);
@@ -3767,9 +3831,9 @@ sub checkline_mk_vartype_basic($$$$$$$) {
$line->log_warning("${varname} should be set to YES, yes, NO, or no.");
}
- } elsif ($type eq "YesNoFromCommand") {
- if ($op ne "!=") {
- checkline_mk_vartype_basic($line, $varname, "YesNo", $op, $value, $comment, false);
+ } elsif ($type eq "YesNo_Indirectly") {
+ if ($value_novar ne "" && $value !~ qr"^(?:YES|yes|NO|no)(?:\s+#.*)?$") {
+ $line->log_warning("${varname} should be set to YES, yes, NO, or no.");
}
} else {
@@ -3779,21 +3843,23 @@ sub checkline_mk_vartype_basic($$$$$$$) {
sub checkline_mk_vartype($$$$$) {
my ($line, $varname, $op, $value, $comment) = @_;
- my ($vartypes, $guessed);
+ my ($guessed);
return unless $opt_warn_types;
- $vartypes = get_vartypes_map();
- my $varbase = ($varname =~ qr"(.+?)\..*") ? $1 : $varname;
- my $type = exists($vartypes->{$varname}) ? $vartypes->{$varname}
- : exists($vartypes->{$varbase}) ? $vartypes->{$varbase}
- : undef;
+ my $vartypes = get_vartypes_map();
+ my $varbase = varname_base($varname);
+ my $varcanon = varname_canon($varname);
- if ($op eq "+=") {
- if ($varbase !~ qr"^_" && $varbase !~ get_regex_plurals()) {
- $line->log_warning("As ${varname} is modified using \"+=\", its name should indicate plural.");
- }
+ my $type = exists($vartypes->{$varname}) ? $vartypes->{$varname}
+ : exists($vartypes->{$varcanon}) ? $vartypes->{$varcanon}
+ : undef;
+
+ if ($op eq "+=") {
+ if ($varbase !~ qr"^_" && $varbase !~ get_regex_plurals()) {
+ $line->log_warning("As ${varname} is modified using \"+=\", its name should indicate plural.");
}
+ }
$guessed = false;
if (!defined($type)) {
@@ -3881,10 +3947,10 @@ sub checkline_mk_varassign($$$$$) {
# If the variable is not used and is untyped, it may be a
# spelling mistake.
- if (defined($varuse) && !exists($varuse->{$varname})) {
+ if (defined($varuse) && !exists($varuse->{$varname}) && !exists($varuse->{varname_canon($varname)})) {
my $vt = get_vartypes_map();
- if (!exists($vt->{$varname}) && !exists($vt->{$varbase})) {
- $line->log_warning("[experimental] ${varname} is defined, but not used.");
+ if (!exists($vt->{$varname}) && !exists($vt->{varname_canon($varname)})) {
+ $line->log_warning("${varname} is defined, but not used. Spelling mistake?");
}
}