From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BEA33139694 for ; Sun, 30 Apr 2017 21:39:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6207D21C164; Sun, 30 Apr 2017 21:38:08 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1EAA621C13C for ; Sun, 30 Apr 2017 21:38:08 +0000 (UTC) Received: from katipo2.fritz.box (unknown [IPv6:2406:e001:1:d01:de0e:a1ff:fea1:6ec4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kentnl) by smtp.gentoo.org (Postfix) with ESMTPSA id 33E0D34169C; Sun, 30 Apr 2017 21:38:05 +0000 (UTC) From: kentnl@gentoo.org To: gentoo-dev@lists.gentoo.org Cc: vapier@gentoo.org, tools-portage@gentoo.org, Kent Fredric Subject: [gentoo-dev] [PATCH] app-portage/eclass-manpages: Add support for @DEFAULT-ASSUMED Date: Mon, 1 May 2017 09:38:01 +1200 Message-Id: <20170430213801.21789-1-kentnl@gentoo.org> X-Mailer: git-send-email 2.12.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: a8de31b1-0a88-4109-8aef-3965befa629d X-Archives-Hash: 83340945abb6480817f4a74a232e620e From: Kent Fredric @DEFAULT-ASSUMED allows eclasses to document any implied value that internal code will assume when the ENV var is undefined. @DEFAULT-ASSUMED should typically be used in conjunction with @DEFAULT-UNSET, but it can be used in conjunction with either @DEFAULT-VALUE or normal value extraction. For instance: @VARIABLE: DIST_TEST @DEFAULT-ASSUMED: "do parallel" This inserts an additional suffix to the generated man page heading line so it renders as follows: DIST_TEST (UNSET -> "do parallel") But indicates that the value itself is not explicitly set by the eclass and ebuilds should not assume it to have a value. For instance, upon seeing such an indication, ebuild authors should be able to tell that doing DIST_TEST+=" network" Would end up producing DIST_TEST=" network" Not DIST_TEST="do parallel network" This is primarily for usecases where the variable is not assigned anywhere in the top level file, but consuming functions imply a value: has "parallel" ${DIST_TEST:-do parallel} --- app-portage/eclass-manpages/files/eclass-to-manpage.awk | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app-portage/eclass-manpages/files/eclass-to-manpage.awk b/app-portage/eclass-manpages/files/eclass-to-manpage.awk index d6ed59efd9..772ee867d8 100644 --- a/app-portage/eclass-manpages/files/eclass-to-manpage.awk +++ b/app-portage/eclass-manpages/files/eclass-to-manpage.awk @@ -40,6 +40,7 @@ # [@DEFAULT_UNSET] # [@INTERNAL] # [@REQUIRED] +# @DEFAULT-ASSUMED: # @DEFAULT-VALUE: # @DESCRIPTION: # @@ -50,6 +51,7 @@ # [@DEFAULT_UNSET] # [@INTERNAL] # [@REQUIRED] +# @DEFAULT-ASSUMED: # @DEFAULT-VALUE: # @DESCRIPTION: # @@ -285,6 +287,7 @@ function _handle_variable() { default_unset = 0 internal = 0 required = 0 + default_assumed = "" default_value = "" # make sure people haven't specified this before (copy & paste error) @@ -302,8 +305,12 @@ function _handle_variable() { internal = 1 else if ($2 == "@REQUIRED") required = 1 + else if ($2 == "@DEFAULT-ASSUMED:") { + sub(/^# @[A-Z-]*:[[:space:]]*/,"") + default_assumed = $0 + } else if ($2 == "@DEFAULT-VALUE:") { - sub(/^# @[A-Z_]*:[[:space:]]*/,"") + sub(/^# @[A-Z-]*:[[:space:]]*/,"") default_value = $0 } else @@ -343,6 +350,10 @@ function _handle_variable() { if (required == 1) val = val " (REQUIRED)" + if ( default_assumed != "" ) { + val = val " (UNSET -> \\fI" default_assumed "\\fR)" + } + if (internal == 1) return "" -- 2.12.2