Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc mk/help: only list help topics that have associated ke...
details: https://anonhg.NetBSD.org/pkgsrc/rev/fc932f85be94
branches: trunk
changeset: 430671:fc932f85be94
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun May 03 08:49:16 2020 +0000
description:
mk/help: only list help topics that have associated keywords
diffstat:
mk/help/help.awk | 12 +++++++++---
regress/infra-unittests/help.sh | 9 ++-------
2 files changed, 11 insertions(+), 10 deletions(-)
diffs (58 lines):
diff -r e234402812a7 -r fc932f85be94 mk/help/help.awk
--- a/mk/help/help.awk Sun May 03 08:42:22 2020 +0000
+++ b/mk/help/help.awk Sun May 03 08:49:16 2020 +0000
@@ -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 @@
# 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 @@
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)
diff -r e234402812a7 -r fc932f85be94 regress/infra-unittests/help.sh
--- a/regress/infra-unittests/help.sh Sun May 03 08:42:22 2020 +0000
+++ b/regress/infra-unittests/help.sh Sun May 03 08:49:16 2020 +0000
@@ -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 @@
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