diff options
author | rillig <rillig@pkgsrc.org> | 2006-01-07 20:00:00 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2006-01-07 20:00:00 +0000 |
commit | 2190872eacd97e43000f90cd19878393de7f390b (patch) | |
tree | e8fc1f1451d66c738022e40b4fd05ec55b922819 | |
parent | 6b8e6561e58f0d01e003cfc4ab617620cb662146 (diff) | |
download | pkgsrc-2190872eacd97e43000f90cd19878393de7f390b.tar.gz |
- Added SUBST_MESSAGE to the list of checked variables. The plan is to
remove the quoting from the definitions in the Makefiles.
- When checking with -Wall, print warnings about possibly misquoted
variables in the various states of the shell word parser.
-rw-r--r-- | pkgtools/pkglint/files/makevars.map | 3 | ||||
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 20 |
2 files changed, 20 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/makevars.map b/pkgtools/pkglint/files/makevars.map index e8ec3ac27e5..2e38f6fed28 100644 --- a/pkgtools/pkglint/files/makevars.map +++ b/pkgtools/pkglint/files/makevars.map @@ -1,4 +1,4 @@ -# $NetBSD: makevars.map,v 1.52 2006/01/02 01:18:24 rillig Exp $ +# $NetBSD: makevars.map,v 1.53 2006/01/07 20:00:00 rillig Exp $ # # This file contains the guessed type of some variables, according to @@ -175,6 +175,7 @@ REPLACE_EMACS List+ of Pathname SCRIPTS_ENV List+ of ShellWord 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 diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index df78ab72e90..425fb64e9aa 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -1,5 +1,5 @@ #! @PERL@ -w -# $NetBSD: pkglint.pl,v 1.453 2006/01/06 21:06:06 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.454 2006/01/07 20:00:00 rillig Exp $ # # pkglint - static analyzer and checker for pkgsrc packages @@ -1735,6 +1735,12 @@ sub checkline_mk_shellword($$$) { "SWST_DQUOT_BACKT", "SWST_BACKT", "SWST_BACKT_DQUOT", "SWST_BACKT_SQUOT" ]; + use constant user_statename => [ + "unquoted string", "single quoted string", + "double quoted string", "backticks inside double quoted string", + "backticks", "double quoted string inside backticks", + "single quoted string inside backticks" + ]; $rest = ($shellword =~ qr"^#") ? "" : $shellword; $state = SWST_PLAIN; @@ -1748,7 +1754,7 @@ sub checkline_mk_shellword($$$) { # TODO: Make lists of variables that may appear # in other quoting states than SWST_PLAIN. if ($opt_warn_extra && $state != SWST_PLAIN) { - $line->log_debug("Possibly misquoted make variable \"${varname}\" in " . statename->[$state] . "."); + $line->log_warning("Possibly misquoted make variable ${varname} in " . user_statename->[$state] . "."); } } elsif ($state == SWST_PLAIN) { @@ -2225,6 +2231,16 @@ sub checkline_mk_vartype_basic($$$$$) { $line->log_warning("Invalid stage name. Use one of {pre,do,post}-{extract,patch,configure,build,install}."); } + } elsif ($type eq "SubstMessage") { + +# TODO: Enable this code when there is a :Q operator on the statement +# that prints the ${SUBST_MESSAGE} in subst.mk. +if (false) { + if ($value =~ qr"^\".*\"$") { + $line->log_warning("${varname} should not be quoted."); + } +} + } elsif ($type eq "Tool") { if ($value =~ qr"^([-\w]+|\[)(?::(\w+))?$") { my ($toolname, $tooldep) = ($1, $2); |