pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/help mk/help: ignore topics in lines that are inden...
details: https://anonhg.NetBSD.org/pkgsrc/rev/302b0c6833b6
branches: trunk
changeset: 376701:302b0c6833b6
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Mar 06 23:49:37 2018 +0000
description:
mk/help: ignore topics in lines that are indented by at least 2 tabs
The variable names are typically mentioned in one of these styles:
# Package-settable variables:
#
# VARNAME
# Description
# Package-settable variables:
#
# VARNAME
# Description
Lines that are indented with two tabs contain text. And if one of these
lines starts with a variable name, it is just a coincidence. A practical
example of this happening is in mk/misc/developer.mk 1.24, where PKGNAME
starts a line of description.
diffstat:
mk/help/help.awk | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diffs (67 lines):
diff -r a3604cb5f333 -r 302b0c6833b6 mk/help/help.awk
--- a/mk/help/help.awk Tue Mar 06 20:07:11 2018 +0000
+++ b/mk/help/help.awk Tue Mar 06 23:49:37 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: help.awk,v 1.28 2017/10/31 16:24:42 rillig Exp $
+# $NetBSD: help.awk,v 1.29 2018/03/06 23:49:37 rillig Exp $
#
# This program extracts the inline documentation from *.mk files.
@@ -9,6 +9,7 @@
BEGIN {
no = 0; yes = 1; always = 1;
+ debug = ENVIRON["HELP_DEBUG"] != "";
topic = ENVIRON["TOPIC"];
uctopic = toupper(topic);
lctopic = tolower(topic);
@@ -36,6 +37,11 @@
function end_of_topic() {
if (comment_lines <= 2 || ignore_this_section) {
+ if (comment_lines <= 2) {
+ dprint("Ignoring section because of too small comment.");
+ } else {
+ dprint("Ignoring section because of a previous decision.");
+ }
cleanup();
return;
}
@@ -73,6 +79,12 @@
ignore_this_section = no;
}
+function dprint(msg) {
+ if (debug) {
+ print(FILENAME ":" FNR ": " msg);
+ }
+}
+
always {
ignore_this_line = (ignore_next_empty_line && $0 == "#") || $0 == "";
ignore_next_empty_line = no;
@@ -94,6 +106,7 @@
w = ($i == toupper($i)) ? tolower($i) : $i;
sub(/,$/, "", w);
keywords[w] = yes;
+ dprint("Adding keyword " w);
}
ignore_this_line = yes;
ignore_next_empty_line = yes;
@@ -104,6 +117,7 @@
}
$1 == "#" && $2 == "Copyright" {
+ dprint("Ignoring the section because it contains \"Copyright\".");
ignore_this_section = yes;
}
@@ -123,7 +137,7 @@
# be all-lowercase (make targets) or all-uppercase (variable names).
# Everything else is assumed to belong to the explaining text.
#
-NF >= 1 && !/^[\t.]/ && !/^#*$/ {
+NF >= 1 && !/^[\t.]/ && !/^#*$/ && !/^#\t\t/ {
w = ($1 ~ /^\#[A-Z]/) ? substr($1, 2) : ($1 == "#") ? $2 : $1;
# Reduce VAR.<param>, VAR.${param} and VAR.* to VAR.
Home |
Main Index |
Thread Index |
Old Index