summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-12-09 10:15:57 +0000
committerMike Frysinger <vapier@gentoo.org>2009-12-09 10:15:57 +0000
commit84a528caaf07e9c71d4eced80e4a718304b29964 (patch)
tree0221264416df890269b01ceb3404e121b443e4e1 /app-portage
parentold (diff)
downloadgentoo-2-84a528caaf07e9c71d4eced80e4a718304b29964.tar.gz
gentoo-2-84a528caaf07e9c71d4eced80e4a718304b29964.tar.bz2
gentoo-2-84a528caaf07e9c71d4eced80e4a718304b29964.zip
Detect variables given default values via :${var:=val}.
(Portage version: 2.2_rc55/cvs/Linux x86_64, RepoMan options: --force)
Diffstat (limited to 'app-portage')
-rw-r--r--app-portage/eclass-manpages/ChangeLog8
-rw-r--r--app-portage/eclass-manpages/eclass-manpages-20091209.ebuild28
-rw-r--r--app-portage/eclass-manpages/files/eclass-to-manpage.awk27
3 files changed, 53 insertions, 10 deletions
diff --git a/app-portage/eclass-manpages/ChangeLog b/app-portage/eclass-manpages/ChangeLog
index 80be567c5fdd..48450b6d43ef 100644
--- a/app-portage/eclass-manpages/ChangeLog
+++ b/app-portage/eclass-manpages/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for app-portage/eclass-manpages
# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/ChangeLog,v 1.16 2009/10/07 19:58:09 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/ChangeLog,v 1.17 2009/12/09 10:15:56 vapier Exp $
+
+*eclass-manpages-20091209 (09 Dec 2009)
+
+ 09 Dec 2009; Mike Frysinger <vapier@gentoo.org>
+ +eclass-manpages-20091209.ebuild, files/eclass-to-manpage.awk:
+ Detect variables given default values via :${var:=val}.
*eclass-manpages-20091007 (07 Oct 2009)
diff --git a/app-portage/eclass-manpages/eclass-manpages-20091209.ebuild b/app-portage/eclass-manpages/eclass-manpages-20091209.ebuild
new file mode 100644
index 000000000000..ce90ec75620a
--- /dev/null
+++ b/app-portage/eclass-manpages/eclass-manpages-20091209.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-portage/eclass-manpages/eclass-manpages-20091209.ebuild,v 1.1 2009/12/09 10:15:56 vapier Exp $
+
+DESCRIPTION="collection of Gentoo eclass manpages"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc ~sparc-fbsd x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND=""
+RDEPEND="!app-portage/portage-manpages"
+
+S=${WORKDIR}
+
+src_compile() {
+ local e
+ for e in "${ECLASSDIR}"/*.eclass ; do
+ awk -f "${FILESDIR}"/eclass-to-manpage.awk ${e} > ${e##*/}.5 || rm -f ${e##*/}.5
+ done
+}
+
+src_install() {
+ doman *.5 || die
+}
diff --git a/app-portage/eclass-manpages/files/eclass-to-manpage.awk b/app-portage/eclass-manpages/files/eclass-to-manpage.awk
index fdaa34c69c5c..fd374484615b 100644
--- a/app-portage/eclass-manpages/files/eclass-to-manpage.awk
+++ b/app-portage/eclass-manpages/files/eclass-to-manpage.awk
@@ -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.14 2008/02/19 05:22:38 vapier Exp $
+# $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 $
# This awk converts the comment documentation found in eclasses
# into man pages for easier/nicer reading.
@@ -192,14 +192,23 @@ function _handle_variable() {
desc = eat_paragraph()
# extract the default variable value
- val = $0
- regex = "^.*" var_name "="
- sub(regex, "", val)
- if ($0 == val) {
- warn(var_name ": unable to extract default variable content: " $0)
- val = ""
- } else
- val = " = \\fI" val "\\fR"
+ # first try var="val"
+ op = "="
+ regex = "^.*" var_name "=(.*)$"
+ val = gensub(regex, "\\1", "", $0)
+ if (val == $0) {
+ # next try : ${var:=val}
+ op = "?="
+ regex = "^[[:space:]]*:[[:space:]]*[$]{" var_name ":?=(.*)}"
+ val = gensub(regex, "\\1", "", $0)
+ if (val == $0) {
+ warn(var_name ": unable to extract default variable content: " $0)
+ val = ""
+ } else if (val !~ /^["']/ && val ~ / /)
+ val = "\"" val "\""
+ }
+ if (length(val))
+ val = " " op " \\fI" val "\\fR"
# now accumulate the stuff
ret = \