pkgsrc-Changes archive

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

CVS commit: pkgsrc



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun May  3 08:49:16 UTC 2020

Modified Files:
        pkgsrc/mk/help: help.awk
        pkgsrc/regress/infra-unittests: help.sh

Log Message:
mk/help: only list help topics that have associated keywords


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 pkgsrc/mk/help/help.awk
cvs rdiff -u -r1.2 -r1.3 pkgsrc/regress/infra-unittests/help.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/help/help.awk
diff -u pkgsrc/mk/help/help.awk:1.35 pkgsrc/mk/help/help.awk:1.36
--- pkgsrc/mk/help/help.awk:1.35        Mon Mar 30 06:21:52 2020
+++ pkgsrc/mk/help/help.awk     Sun May  3 08:49:16 2020
@@ -1,4 +1,4 @@
-# $NetBSD: help.awk,v 1.35 2020/03/30 06:21:52 rillig Exp $
+# $NetBSD: help.awk,v 1.36 2020/05/03 08:49:16 rillig Exp $
 #
 
 # This program extracts the inline documentation from *.mk files.
@@ -35,7 +35,7 @@ BEGIN {
 # end of a file or by the end of all files. When there have been enough
 # comment lines, the topic is considered worth printing.
 #
-function end_of_topic() {
+function end_of_topic(   relevant, has_keywords) {
 
        if (comment_lines <= 2 || ignore_this_section) {
                if (array_is_empty(keywords)) {
@@ -52,7 +52,13 @@ function end_of_topic() {
        for (k in keywords)
                all_keywords[k]++;
 
-       relevant = (topic in keywords || lctopic in keywords || uctopic in keywords || topic == ":all");
+       relevant = no;
+       if (topic == ":all")
+               for (k in keywords)
+                       relevant = yes;
+       if (topic in keywords || lctopic in keywords || uctopic in keywords)
+               relevant = yes;
+
        if (relevant && !print_index) {
 
                if (found_anything)

Index: pkgsrc/regress/infra-unittests/help.sh
diff -u pkgsrc/regress/infra-unittests/help.sh:1.2 pkgsrc/regress/infra-unittests/help.sh:1.3
--- pkgsrc/regress/infra-unittests/help.sh:1.2  Sun May  3 08:42:22 2020
+++ pkgsrc/regress/infra-unittests/help.sh      Sun May  3 08:49:16 2020
@@ -1,5 +1,5 @@
 #! /bin/sh
-# $NetBSD: help.sh,v 1.2 2020/05/03 08:42:22 rillig Exp $
+# $NetBSD: help.sh,v 1.3 2020/05/03 08:49:16 rillig Exp $
 #
 # Test cases for "bmake help", mainly implemented in mk/help/help.awk.
 #
@@ -110,13 +110,8 @@ if test_case_begin "comments without key
        TOPIC=':all' awk -f "$pkgsrcdir/mk/help/help.awk" \
                'Makefile' >"out"
 
-       # FIXME: should be empty
        assert_that 'out' --file-is-lines \
-               '===> Makefile (keywords:):' \
-               '# Comment1' \
-               '# Comment2' \
-               '# Comment3' \
-               'SUBDIR+=       subdir2'
+               'No help found for :all.'
 
        test_case_end
 fi



Home | Main Index | Thread Index | Old Index