aboutsummaryrefslogtreecommitdiff
blob: ec7e0694f3935a73ed25ff600359f136fd562d9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?xml version="1.0" encoding="UTF-8"?>
<guide self="function-reference/query-functions/">
<chapter>
<title>Query functions reference</title>
<body>

<p>
The following functions, which are provided by <c>ebuild.sh</c>, can be used to
query variables and similar state.
</p>

<table>
  <tr>
    <th>
      Function
    </th>
    <th>
      Details
    </th>
  </tr>
  <tr>
    <ti>
      <c>use flagname</c>
    </ti>
    <ti>
      Returns a true value if and only if <c>flagname</c> is enabled.
      The condition is inverted if prefixed with an exclamation mark,
      <c>!flagname</c>.
      It is guaranteed that <c>use</c> produces no output.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>useq flagname</c>
    </ti>
    <ti>
      Deprecated synonym for <c>use</c>.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>usev flagname [true output]</c>
    </ti>
    <ti>
      As <c>use</c>, but also echoes <c>flagname</c> upon success. In EAPI 8
      and later, echoes the second argument instead, if it is specified.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>usex flag [true output] [false output] [true suffix] [false suffix]</c>
    </ti>
    <ti>
      If <c>flag</c> is enabled, echo [true output][true suffix], otherwise
      echo [false output][false suffix]. If unspecified, true and false outputs
      are equal to "yes" and "no" respectively. The suffixes default to empty
      strings.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>use_enable flag str val</c> 
    </ti>
    <ti>
      Echoes either <c>--enable-str=val</c> or <c>--disable-str</c> depending upon <c>useq flag</c>.
      If <c>str</c> is not specified, uses <c>flag</c> instead. If <c>val</c> is not specified, omits
      the assignment part.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>use_with flag str val</c>
    </ti>
    <ti>
      As <c>use_enable</c>, but <c>--with-</c> or <c>--without-</c>.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>in_iuse flag</c>
    </ti>
    <ti>
      Returns true if the ebuild can use <c>flag</c> in <c>use</c> queries,
      false otherwise.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>has word item...</c>
    </ti>
    <ti>
      Returns true if <c>word</c> is found in the list of subsequent
      <c>item</c> arguments (example: <c>if has ccache $FEATURES ; then</c>).
      It is guaranteed that <c>has</c> produces no output.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>hasq word item...</c>
    </ti>
    <ti>
      Deprecated synonym for <c>has</c>.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>hasv word item...</c>
    </ti>
    <ti>
      As <c>has</c>, echoes <c>word</c> on success.
    </ti>
  </tr>
  <tr>
    <ti>
      <c>best_version [option] pkg</c>
    </ti>
    <ti>
      Echoes category, name and version of the highest version of <c>pkg</c>
      that is currently installed.
      Example: <c>best_version app-editors/emacs:24</c> will output
      <c>app-editors/emacs-24.5-r3</c>.
      (EAPI=7) An option may also be specified to query certain types of dependencies.
      <c>-b</c> for <c>BDEPEND</c>
      <c>-d</c> for <c>DEPEND</c>
      <c>-r</c> (default) for <c>RDEPEND</c>
    </ti>
  </tr>
  <tr>
    <ti>
      <c>has_version [option] pkg[flag]</c>
    </ti>
    <ti>
      True if <c>pkg</c> (can include
      <uri link="::general-concepts/dependencies/#version specifiers"/> and
      <uri link="::general-concepts/dependencies/#built with use dependencies"/>)
      is installed. Example: <c>has_version
      "=app-editors/nano-2.5.3[nls,spell]"</c>.
      (EAPI=7) An option may also be specified to query certain types of dependencies.
      <c>-b</c> for <c>BDEPEND</c>
      <c>-d</c> for <c>DEPEND</c>
      <c>-r</c> (default) for <c>RDEPEND</c>
    </ti>
  </tr>
</table>

</body>
</chapter>
</guide>