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 an explanation for the wa...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5a8994b65da7
branches:  trunk
changeset: 513788:5a8994b65da7
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jun 03 07:27:25 2006 +0000

description:
Added an explanation for the warning that "Each sed command should
appear in an assignment of its own", since it had been misunderstood at
least once. Also, since the explanation is usually several lines long,
it does not hurt to add two extra empty lines to separate the
explanation from the actual warning.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 59e286993518 -r 5a8994b65da7 pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Sat Jun 03 07:10:25 2006 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Sat Jun 03 07:27:25 2006 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.600 2006/06/03 07:06:23 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.601 2006/06/03 07:27:25 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -279,7 +279,7 @@
        my $out = ($loglevel == LL_FATAL) ? *STDERR : *STDOUT;
 
        if ($explain_flag) {
-               foreach my $text (@texts) {
+               foreach my $text ("", @texts, "") {
                        print $out ("\t${text}\n");
                }
        }
@@ -3950,6 +3950,14 @@
                                                $ncommands++;
                                                if ($ncommands > 1) {
                                                        $line->log_warning("Each sed command should appear in an assignment of its own.");
+                                                       $line->explain_warning(
+                                                               "For example, instead of",
+                                                               "    SUBST_SED.foo+=        -e s,command1,, -e s,command2,,",
+                                                               "use",
+                                                               "    SUBST_SED.foo+=        -e s,command1,,",
+                                                               "    SUBST_SED.foo+=        -e s,command2,,",
+                                                               "",
+                                                               "This way, short sed commands cannot be hidden at the end of a line.");
                                                }
                                                checkline_mk_shellword($line, $word, true);
                                        } else {



Home | Main Index | Thread Index | Old Index