Query functions reference
The following functions, which are provided by ebuild.sh
, can be used to
query variables and similar state.
Function | Details |
---|---|
use flagname
|
Returns a true value if flagname is enabled, false otherwise.
The condition is inverted if prefixed with an exclamation mark,
!flagname .
It is guaranteed that use produces no output.
|
useq flagname
|
Deprecated synonym for use .
|
usev flagname [true output]
|
As use , but also echoes flagname upon success. In EAPI 8
and later, echoes the second argument instead, if it is specified.
|
usex flag [true output] [false output] [true suffix] [false suffix]
|
If flag 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.
|
use_enable flag str val
|
Echoes either --enable-str=val or --disable-str depending upon useq flag .
If str is not specified, uses flag instead. If val is not specified, omits
the assignment part.
|
use_with flag str val
|
As use_enable , but --with- or --without- .
|
in_iuse flag
|
Returns true if the ebuild can use flag in use queries,
false otherwise.
|
has word item...
|
Returns true if word is found in the list of subsequent
item arguments (example: if has ccache $FEATURES ; then ).
It is guaranteed that has produces no output.
|
hasq word item...
|
Deprecated synonym for has .
|
hasv word item...
|
As has , echoes word on success.
|
best_version [option] pkg
|
Echoes category, name and version of the highest version of pkg
that is currently installed.
Example: best_version app-editors/emacs:24 will output
app-editors/emacs-24.5-r3 .
(EAPI=7) An option may also be specified to query certain types of dependencies.
-b for BDEPEND
-d for DEPEND
-r (default) for RDEPEND
|
has_version [option] pkg[flag]
|
True if pkg (can include
Version specifiers and
Built with USE dependencies)
is installed. Example: has_version
"=app-editors/nano-2.5.3[nls,spell]" .
(EAPI=7) An option may also be specified to query certain types of dependencies.
-b for BDEPEND
-d for DEPEND
-r (default) for RDEPEND
|