Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc mk/help: fix help parser for variable names followed b...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0427b6a5c1ea
branches:  trunk
changeset: 436543:0427b6a5c1ea
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Aug 04 21:46:44 2020 +0000

description:
mk/help: fix help parser for variable names followed by comma

Seen in mk/fetch/fetch.mk for FETCH_USE_IPV4_ONLY.

diffstat:

 mk/help/help.awk                |  8 ++++----
 regress/infra-unittests/help.sh |  9 +++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diffs (57 lines):

diff -r a4e1ed8c4b82 -r 0427b6a5c1ea mk/help/help.awk
--- a/mk/help/help.awk  Tue Aug 04 21:35:01 2020 +0000
+++ b/mk/help/help.awk  Tue Aug 04 21:46:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: help.awk,v 1.41 2020/05/03 10:57:06 rillig Exp $
+# $NetBSD: help.awk,v 1.42 2020/08/04 21:46:44 rillig Exp $
 #
 
 # This program extracts the inline documentation from *.mk files.
@@ -192,7 +192,7 @@
                # want them anyway, list them in a "Keywords:" line.
                dprint_skip(w, "it is mixed case");
 
-       } else if (w !~ /^[A-Za-z][-0-9A-Z_a-z]*[0-9A-Za-z](:|\?=|=)?$/) {
+       } else if (w !~ /^[A-Za-z][-0-9A-Z_a-z]*[0-9A-Za-z]([,:]|\?=|=)?$/) {
                # Keywords must consist only of letters, digits, hyphens
                # and underscores; except for some trailing type specifier.
                dprint_skip(w, "it contains special characters");
@@ -212,12 +212,12 @@
                # Upper-case words ending with a colon are probably not
                # make targets, so ignore them. Common cases are tags
                # like FIXME and TODO.
-               dprint_skip(w, "it is uppercase and followed by a hyphen");
+               dprint_skip(w, "it is uppercase and followed by a colon");
 
        } else {
                sub(/^#[ \t]*/, "", w);
                sub(/(:|\?=|=)$/, "", w);
-               sub(/:$/, "", w);
+               sub(/[,:]$/, "", w);
                if (w != "") {
                        if (debug) dprint("Adding keyword \"" w "\"");
                        keywords[w] = yes;
diff -r a4e1ed8c4b82 -r 0427b6a5c1ea regress/infra-unittests/help.sh
--- a/regress/infra-unittests/help.sh   Tue Aug 04 21:35:01 2020 +0000
+++ b/regress/infra-unittests/help.sh   Tue Aug 04 21:46:44 2020 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: help.sh,v 1.6 2020/08/04 21:35:01 rillig Exp $
+# $NetBSD: help.sh,v 1.7 2020/08/04 21:46:44 rillig Exp $
 #
 # Test cases for "bmake help", mainly implemented in mk/help/help.awk.
 #
@@ -157,9 +157,10 @@
                'fetch.mk' >'out'
 
        assert_that 'out' --file-is-lines \
-               'No help found for fetch_use_ipv4_only, but it appears in:' \
-               '' \
-               'fetch.mk'
+               '===> fetch.mk (keywords: FETCH_USE_IPV4_ONLY):' \
+               '# FETCH_USE_IPV4_ONLY, if defined, will ...' \
+               '#      ...' \
+               '#      ...'
 
        test_case_end
 fi



Home | Main Index | Thread Index | Old Index