From: "Mike Frysinger (vapier)" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in app-portage/eclass-manpages/files: eclass-to-manpage.awk
Date: Sat, 21 Aug 2010 19:25:57 +0000 (UTC) [thread overview]
Message-ID: <20100821192557.96B5D2004E@flycatcher.gentoo.org> (raw)
vapier 10/08/21 19:25:57
Modified: eclass-to-manpage.awk
Log:
add @DEFAULT_UNSET, @REQUIRED, and @INTERNAL for variables
Revision Changes Path
1.16 app-portage/eclass-manpages/files/eclass-to-manpage.awk
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk?r1=1.15&r2=1.16
Index: eclass-to-manpage.awk
===================================================================
RCS file: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- eclass-to-manpage.awk 9 Dec 2009 10:15:57 -0000 1.15
+++ eclass-to-manpage.awk 21 Aug 2010 19:25:57 -0000 1.16
@@ -1,6 +1,6 @@
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk,v 1.15 2009/12/09 10:15:57 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/files/eclass-to-manpage.awk,v 1.16 2010/08/21 19:25:57 vapier Exp $
# This awk converts the comment documentation found in eclasses
# into man pages for easier/nicer reading.
@@ -30,12 +30,18 @@
# The format of function-specific variables:
# @VARIABLE: foo
+# [@DEFAULT_UNSET]
+# [@INTERNAL]
+# [@REQUIRED]
# @DESCRIPTION:
# <required; blurb about this variable>
# foo="<default value>"
# The format of eclass variables:
# @ECLASS-VARIABLE: foo
+# [@DEFAULT_UNSET]
+# [@INTERNAL]
+# [@REQUIRED]
# @DESCRIPTION:
# <required; blurb about this variable>
# foo="<default value>"
@@ -46,8 +52,14 @@
# code by using this marker at the start and end.
# @CODE
-function _stderr_msg(text, type) {
- print FILENAME ":" NR ":" type ": " text > "/dev/stderr"
+function _stderr_msg(text, type, file, cnt) {
+ if (_stderr_header_done != 1) {
+ cnt = split(FILENAME, file, /\//)
+ print "\n" file[cnt] ":" > "/dev/stderr"
+ _stderr_header_done = 1
+ }
+
+ print " " type ":" NR ": " text > "/dev/stderr"
}
function warn(text) {
_stderr_msg(text, "warning")
@@ -185,9 +197,23 @@
var_name = $3
desc = ""
val = ""
-
- # grab the docs
- getline
+ default_unset = 0
+ internal = 0
+ required = 0
+
+ # grab the optional attributes
+ opts = 1
+ while (opts) {
+ getline
+ if ($2 == "@DEFAULT_UNSET")
+ default_unset = 1
+ else if ($2 == "@INTERNAL")
+ internal = 1
+ else if ($2 == "@REQUIRED")
+ required = 1
+ else
+ opts = 0
+ }
if ($2 == "@DESCRIPTION:")
desc = eat_paragraph()
@@ -202,13 +228,22 @@
regex = "^[[:space:]]*:[[:space:]]*[$]{" var_name ":?=(.*)}"
val = gensub(regex, "\\1", "", $0)
if (val == $0) {
- warn(var_name ": unable to extract default variable content: " $0)
+ if (default_unset + required + internal == 0)
+ warn(var_name ": unable to extract default variable content: " $0)
val = ""
- } else if (val !~ /^["']/ && val ~ / /)
+ } else if (val !~ /^["']/ && val ~ / /) {
+ if (default_unset == 1)
+ warn(var_name ": marked as unset, but has value: " val)
val = "\"" val "\""
+ }
}
if (length(val))
val = " " op " \\fI" val "\\fR"
+ if (required == 1)
+ val = val " (REQUIRED)"
+
+ if (internal == 1)
+ return ""
# now accumulate the stuff
ret = \
@@ -222,12 +257,18 @@
return ret
}
function handle_variable() {
- print _handle_variable()
+ ret = _handle_variable()
+ if (ret == "")
+ return
+ print ret
}
function handle_eclass_variable() {
+ ret = _handle_variable()
+ if (ret == "")
+ return
if (eclass_variables != "")
eclass_variables = eclass_variables "\n"
- eclass_variables = eclass_variables _handle_variable()
+ eclass_variables = eclass_variables ret
}
#
next reply other threads:[~2010-08-21 19:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-21 19:25 Mike Frysinger (vapier) [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-01-10 17:42 [gentoo-commits] gentoo-x86 commit in app-portage/eclass-manpages/files: eclass-to-manpage.awk Mike Frysinger (vapier)
2012-07-18 14:27 Mike Frysinger (vapier)
2012-07-18 14:24 Mike Frysinger (vapier)
2011-11-24 0:05 Mike Frysinger (vapier)
2011-08-22 4:49 Mike Frysinger (vapier)
2011-08-22 4:01 Mike Frysinger (vapier)
2011-07-20 3:11 Mike Frysinger (vapier)
2011-07-20 2:59 Mike Frysinger (vapier)
2011-07-20 2:56 Mike Frysinger (vapier)
2011-02-10 7:26 Ulrich Mueller (ulm)
2010-09-12 6:45 Mike Frysinger (vapier)
2010-08-22 23:10 Mike Frysinger (vapier)
2009-12-09 10:15 Mike Frysinger (vapier)
2008-02-19 5:22 Mike Frysinger (vapier)
2008-02-19 5:20 Mike Frysinger (vapier)
2008-02-19 5:14 Mike Frysinger (vapier)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100821192557.96B5D2004E@flycatcher.gentoo.org \
--to=vapier@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox