1 |
From: Kent Fredric <kentnl@g.o> |
2 |
|
3 |
@DEFAULT-ASSUMED allows eclasses to document any implied value |
4 |
that internal code will assume when the ENV var is undefined. |
5 |
|
6 |
@DEFAULT-ASSUMED should typically be used in conjunction with |
7 |
@DEFAULT-UNSET, but it can be used in conjunction with either |
8 |
@DEFAULT-VALUE or normal value extraction. |
9 |
|
10 |
For instance: |
11 |
|
12 |
@VARIABLE: DIST_TEST |
13 |
@DEFAULT-ASSUMED: "do parallel" |
14 |
|
15 |
This inserts an additional suffix to the generated man page heading |
16 |
line so it renders as follows: |
17 |
|
18 |
DIST_TEST (UNSET -> "do parallel") |
19 |
|
20 |
But indicates that the value itself is not explicitly set by the eclass |
21 |
and ebuilds should not assume it to have a value. |
22 |
|
23 |
For instance, upon seeing such an indication, ebuild authors should |
24 |
be able to tell that doing |
25 |
|
26 |
DIST_TEST+=" network" |
27 |
|
28 |
Would end up producing |
29 |
|
30 |
DIST_TEST=" network" |
31 |
|
32 |
Not |
33 |
|
34 |
DIST_TEST="do parallel network" |
35 |
|
36 |
This is primarily for usecases where the variable is not assigned |
37 |
anywhere in the top level file, but consuming functions imply a value: |
38 |
|
39 |
has "parallel" ${DIST_TEST:-do parallel} |
40 |
--- |
41 |
app-portage/eclass-manpages/files/eclass-to-manpage.awk | 13 ++++++++++++- |
42 |
1 file changed, 12 insertions(+), 1 deletion(-) |
43 |
|
44 |
diff --git a/app-portage/eclass-manpages/files/eclass-to-manpage.awk b/app-portage/eclass-manpages/files/eclass-to-manpage.awk |
45 |
index d6ed59efd9..772ee867d8 100644 |
46 |
--- a/app-portage/eclass-manpages/files/eclass-to-manpage.awk |
47 |
+++ b/app-portage/eclass-manpages/files/eclass-to-manpage.awk |
48 |
@@ -40,6 +40,7 @@ |
49 |
# [@DEFAULT_UNSET] |
50 |
# [@INTERNAL] |
51 |
# [@REQUIRED] |
52 |
+# @DEFAULT-ASSUMED: <interpreted value when not set> |
53 |
# @DEFAULT-VALUE: <initial value> |
54 |
# @DESCRIPTION: |
55 |
# <required; blurb about this variable> |
56 |
@@ -50,6 +51,7 @@ |
57 |
# [@DEFAULT_UNSET] |
58 |
# [@INTERNAL] |
59 |
# [@REQUIRED] |
60 |
+# @DEFAULT-ASSUMED: <interpreted value when not set> |
61 |
# @DEFAULT-VALUE: <initial value> |
62 |
# @DESCRIPTION: |
63 |
# <required; blurb about this variable> |
64 |
@@ -285,6 +287,7 @@ function _handle_variable() { |
65 |
default_unset = 0 |
66 |
internal = 0 |
67 |
required = 0 |
68 |
+ default_assumed = "" |
69 |
default_value = "" |
70 |
|
71 |
# make sure people haven't specified this before (copy & paste error) |
72 |
@@ -302,8 +305,12 @@ function _handle_variable() { |
73 |
internal = 1 |
74 |
else if ($2 == "@REQUIRED") |
75 |
required = 1 |
76 |
+ else if ($2 == "@DEFAULT-ASSUMED:") { |
77 |
+ sub(/^# @[A-Z-]*:[[:space:]]*/,"") |
78 |
+ default_assumed = $0 |
79 |
+ } |
80 |
else if ($2 == "@DEFAULT-VALUE:") { |
81 |
- sub(/^# @[A-Z_]*:[[:space:]]*/,"") |
82 |
+ sub(/^# @[A-Z-]*:[[:space:]]*/,"") |
83 |
default_value = $0 |
84 |
} |
85 |
else |
86 |
@@ -343,6 +350,10 @@ function _handle_variable() { |
87 |
if (required == 1) |
88 |
val = val " (REQUIRED)" |
89 |
|
90 |
+ if ( default_assumed != "" ) { |
91 |
+ val = val " (UNSET -> \\fI" default_assumed "\\fR)" |
92 |
+ } |
93 |
+ |
94 |
if (internal == 1) |
95 |
return "" |
96 |
|
97 |
-- |
98 |
2.12.2 |