.\" $NetBSD: pkglint.1,v 1.38 2006/02/28 15:25:44 rillig Exp $ .\" From FreeBSD: portlint.1,v 1.8 1997/11/25 14:53:14 itojun Exp .\" .\" Copyright (c) 1997 by Jun-ichiro Itoh . .\" All Rights Reserved. Absolutely no warranty. .\" .\" Roland Illig , 2004, 2005. .\" Roland Illig , 2005, 2006. .\" .Dd February 28, 2006 .Dt PKGLINT 1 .Sh NAME .Nm pkglint .Nd static analyzer for pkgsrc packages .Sh SYNOPSIS .Nm pkglint .Op Fl options .Op Ar dir ... .Sh DESCRIPTION .Nm attempts to detect features of the named pkgsrc packages that are likely to be bugs, or that are simply deprecated. The pkgsrc system is changing rapidly towards even more portability. The job of .Nm is to define the rules that make up .Dq good packages and to allow automatic conformance tests. Packages following these rules are assumed to make future changes to the pkgsrc infrastructure easier. .Pp .\" ======================================================================= .Ss Options .Bl -tag -width 18n .It Fl C{[no-]check,...} Enable or disable specific checks. For a list of checks, see below. .It Fl F Ns | Ns Fl -autofix Repair trivial things automatically. .It Fl I Show the .Pa Makefile that is constructed by including all the files that are slurped in via .Ql .include directives. This flag is mainly for debugging. .It Fl R Ns | Ns Fl -rcsidstring Allow other RCS Id strings than NetBSD. Multiple strings may be concatenated with .Ql | . .It Fl V Ns | Ns Fl -version Print the current .Nm version number and exit. .It Fl W{[no-]warn,...} Enable or disable specific warnings. For a list of warnings, see below. .It Fl d Ns | Ns Fl -debug Enable warnings for parsing errors and other things that haven't been completed yet. This option is separated from the .Ql -W options because the diagnostics are too hard to understand without detailed knowledge of pkglint's source code. .It Fl e Ns | Ns Fl -explain Print further explanations for diagnostics. Sometimes the reasons for diagnostics are not obvious and need further explanation. .It Fl g Ns | Ns Fl -gcc-output-format Use a format for the diagnostics that is understood by most programs, especially editors, so they can provide a point-and-goto interface. .It Fl h Ns | Ns Fl -help Show the summary of command line options, then exit. .It Fl i Ns | Ns Fl -import Check if a package is ready to be imported into pkgsrc. This is especially useful for packages from the pkgsrc-wip project. .It Fl q Ns | Ns Fl -quiet Don't print the errors and warnings summary before terminating. .It Fl r Check subdirectories, too. The subdirectories are those that are mentioned in a .Ql SUBDIR+= line. .It Fl s Ns | Ns Fl -source For all diagnostics having file and line number information, show the source code along with the diagnostics. .It Fl v Ns | Ns Fl -verbose Be verbose. Show the progress report for items that are being checked. If given more than once, debugging messages are also shown. .El .Pp .\" ======================================================================= .Ss Checks .Bl -tag -width 18n .It Cm all Enable all checks. .It Cm none Disable all checks. .It Cm [no-]ALTERNATIVES Check the alternatives file. .It Cm [no-]INSTALL Check the INSTALL and DEINSTALL scripts. .It Cm [no-]Makefile Check the package Makefile, including all included files. .It Cm [no-]MESSAGE Check MESSAGE files. .It Cm [no-]PLIST Check PLIST files. .It Cm [no-]bl3 Check buildlink3 Makefiles. .It Cm [no-]distinfo Check the distinfo file. .It Cm [no-]extra Check remaining files in the package directory. .It Cm [no-]mk Check Makefile fragments besides buildlink3. .It Cm [no-]patches Check the pkgsrc specific patch files. .El .Pp .\" ======================================================================= .Ss Warnings .Bl -tag -width 18n .It Cm all Enable all warnings. .It Cm none Disable all warnings. .It Cm [no-]absname Warn if a file contains an absolute pathname. .It Cm [no-]directcmd Warn if a system command name is used instead of a variable (e.g. sed instead of ${SED}). .It Cm [no-]extra Emit some additional warnings that are not enabled by default, for whatever reason. .It Cm [no-]order Warn if Makefile variables are not in the preferred order. .It Cm [no-]plist-depr Warn if deprecated pathnames are used in .Pa PLIST files. This warning is disabled by default. .It Cm [no-]plist-sort Warn if items of a PLIST file are not sorted alphabetically. This warning is disabled by default. .It Cm [no-]quoting Warn for possibly invalid quoting of make variables in shell programs and shell variables themselves. .It Cm [no-]space Emit notes for inconsistent use of white-space. .It Cm [no-]style Warn for stylistic issues that don't affect the build process. .It Cm [no-]types Warn for some .Pa Makefile variables if their assigned values do not match their type. .It Cm [no-]varorder Warn if the variables in a package .Pa Makefile Ns s are not ordered in the way it is described the pkgsrc guide. .El .Pp .\" ======================================================================= .Sy Other arguments .Bl -tag -width 18n -offset indent .It Ar dir ... The pkgsrc directories to be checked. If omitted, the current directory is checked. .El .Sh FILES .Bl -tag -width pkgsrc/mk/* -compact .It Pa pkgsrc/mk/* Files from the pkgsrc infrastructure. .El .Sh EXAMPLES .Bl -tag -width Fl .It Ic pkglint \-Cnone,patches \&. Checks the patches of the package in the current directory. .It Ic pkglint \-Wall /usr/pkgsrc/devel Checks the category Makefile and reports any warnings it can find. .It Ic pkglint -r \-R 'NetBSD|Id' /usr/pkgsrc Check the whole pkgsrc tree while allowing .Ql NetBSD or .Ql Id as the RCS Id. .El .Sh DIAGNOSTICS Diagnostics are written to the standard output. .Bl -tag -width "WARN: foobaa" .It ERROR: ... Errors should be fixed before a package is committed to pkgsrc. .It WARN: ... Warnings generally should be fixed, but they are not as critical as errors. .It OK: ... Informational messages are only written in verbose mode .Pq Fl v . Their main use is to aid debugging. .El .Sh AUTHORS .An Roland Illig Aq rillig@NetBSD.org .Sh BUGS Many more checks could be added. .Pp If you don't understand the messages, feel free to ask on the .Aq tech-pkg@NetBSD.org mailing list.