pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkglint/files The macro __NetBSD_Prereq__ sho...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6d0f99370bbc
branches:  trunk
changeset: 549531:6d0f99370bbc
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Nov 04 22:27:00 2008 +0000

description:
The macro __NetBSD_Prereq__ should not be used.
Extended the spell checker for variants of __NetBSD_Version__.

diffstat:

 pkgtools/pkglint/files/pkglint.pl |  21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diffs (44 lines):

diff -r c77ba48dd3b1 -r 6d0f99370bbc pkgtools/pkglint/files/pkglint.pl
--- a/pkgtools/pkglint/files/pkglint.pl Tue Nov 04 21:58:13 2008 +0000
+++ b/pkgtools/pkglint/files/pkglint.pl Tue Nov 04 22:27:00 2008 +0000
@@ -1,5 +1,5 @@
 #! @PERL@
-# $NetBSD: pkglint.pl,v 1.780 2008/11/04 21:45:13 rillig Exp $
+# $NetBSD: pkglint.pl,v 1.781 2008/11/04 22:27:00 rillig Exp $
 #
 
 # pkglint - static analyzer and checker for pkgsrc packages
@@ -3759,12 +3759,8 @@
                "__svr4__" => "__SVR4",
        };
 
-       use constant spellcheck_macros => {
-               "__NetBSD_Version" => "__NetBSD_Version__",
-       };
-
        $rest = $text;
-       while ($rest =~ s/defined\((__[\w_]+)\)//) {
+       while ($rest =~ s/defined\((__[\w_]+)\)// || $rest =~ s/\b(_\w+)\(//) {
                my ($macro) = ($1);
 
                if (exists(good_macros->{$macro})) {
@@ -3773,8 +3769,17 @@
                        $line->log_warning("The macro \"${macro}\" is not portable enough. Please use \"".bad_macros->{$macro}."\" instead.");
                        $line->explain_warning("See the pkgsrc guide, section \"CPP defines\" for details.");
 
-               } elsif (exists(spellcheck_macros->{$macro})) {
-                       $line->log_warning("Misspelled variant \"${macro}\" of \"".spellcheck_macros->{$macro}."\".");
+               } elsif ($macro eq "__NetBSD_Prereq__") {
+                       $line->log_warning("Please use __NetBSD_Version__ instead of __NetBSD_Prereq__.");
+                       $line->explain_warning(
+"The __NetBSD_Prereq__ macro is pretty new. It was born in NetBSD",
+"4.99.3, and maybe it won't survive for long. A better (and compatible)",
+"way is to compare __NetBSD_Version__ directly to the required version",
+"number.");
+
+               } elsif ($macro =~ m"^_+NetBSD_+Version_+$"i && $macro ne "__NetBSD_Version__") {
+                       $line->log_warning("Misspelled variant \"${macro}\" of \"__NetBSD_Version__\".");
+
                } else {
                        $opt_debug_unchecked and $line->log_debug("Unchecked macro \"${macro}\".");
                }



Home | Main Index | Thread Index | Old Index