flaga USE
emerge — configuration — ebuild repository — dispatch-conf
world file — USE flags — ebuilds — profiles
upgrades — using testing packages — binary packages
tools — gentoolkit — eselect
Portage FAQ — cheat sheet — FAQ
all articles
USE flags are keywords that embody support and dependency-information for a certain concept. They are a core feature of Gentoo, and a good understanding of how to deal with them is needed for administering a Gentoo system.
USE flags serve to configure Portage to determine how each package will be configured on installation or update. USE flags can configure many aspects of a package, and the available USE flags and corresponding optional functionality depend on each individual piece of software.
USE flags can change an array of package behavior. They often set compile-time options, though these configure options are not systematically exposed through USE flags - it's up to the package maintainers to decide what options are useful to provide as USE flags. USE flags can specify which optional libraries or utilities will be linked with a package, often determining dependencies. Another example of what USE flags can change is which files are included in an installation, such as whether documentation is provided or not.
This ability to choose options only available when installing a package is one of the great advantages Gentoo leverages from being source based.
The whole distribution comes with reasonable USE flags by default, and these are further refined by selecting a profile to suit planned system usage. Packages each have their own set of available USE flags, depending on what can be configured for the package, and these are also set to reasonable defaults. The order in which USE flags are applied is specified by the USE_ORDER variable.
Basic concepts on how to work with USE flags can be found in the Handbook. See also /etc/portage/package.use about setting a flag for a package, and /etc/portage/make.conf for flags that to be set globally.
Deklarowanie flag USE
Technically, the Gentoo ebuild repository comes with a small set of default USE flags. Default USE flags are further defined by the selected profile. Each package comes with a set of available USE flags, and these can also have a default state, if this is justified in the context of the package. Each layer overrides the previous, to configure Portage to set up the installation of each package.
A USE flag can have three states: set, unset, or default. USE flags may be set or unset globally in the USE variable in make.conf, or for specific packages in /etc/portage/package.use.
The presence of a USE flag in one of these files will set that USE flag. Including a USE flag preceded by a minus sign ("-") will unset that USE flag. If a USE flag is not present in one of these places, the default will be used.
It is often preferable to set USE flags per package rather than system wide. Use flag defaults are usually set to a sane default - carefully consider what flags to set globally in make.conf.
Though a USE flag may in theory be temporarily set on the command line in an environment variable (for example USE="<flags>" emerge -av <package>), do not use this to install packages. Any USE flag set in this way will be lost when upgrading or re-emerging the package.
USEful commands
Aby zobaczyć, jakie flagi USE są aktualnie włączone:
user $
portageq envvar USE | xargs -n 1
To check if a certain USE flag is activated and which packages use it, run:
user $
euse -I <use_flag> # included with app-portage/gentoolkit
user $
quse <use_flag> # included with app-portage/portage-utils
user $
eix --installed-with-use <use_flag> # included with app-portage/eix
Replace <use_flag>
with the USE flag to be checked.
Opcje komendy emerge
The emerge command has some USE flag related options like:
--changed-use
(-U
)--complete-graph-if-new-use < y | n >
--newuse
(-N
)
Szczegółowe informacje znajdują się w man 1 emerge.
"Local" vs "global" USE flags
The technical difference between "local" and "global" flags is simply a difference of where their descriptions are saved in the ebuild repository. "Global" USE flags are described in use.desc files (example) for a whole profile, whereas "local" USE flags are described in metadata.xml files (example), for a single package. When deciding where to define them, developers determine if a USE flag has a general function common to several packages, or a specific function for a single package.
For the end user, whether a USE flag is "global" or "local" has little importance. "Global" flags may sometimes be more suited to being set in the USE variable in make.conf, but there is absolutely no hard rule. In any case, as much as possible, no USE flags should be set in make.conf unless necessary, and /etc/portage/package.use should be preferred to set USE flags on a per-package basis. Following this advice should ease system administration in the long run.
Narzędzia
Some tools are available for analyzing and managing USE flags:
- euse
- quse - for details see man 1 quse
- equery hasuse (USE flag)
- equery uses (package name)
- ufed
- app-portage/euses
- eix - See
--use
,--installed-with-use
and--installed-without-use
options
Zobacz również
- /etc/portage/package.use — provides a more fine grained per-package control of USE flags than the USE variable in /etc/portage/make.conf
- Complete Handbook/Finishing off
- Gentoo Handbook documentation on USE flags
- Gentoo Java USE flags
- Toolkit USE Flags — summarizes main points from discussions about toolkit (GTK, Qt) USE flags (gtk2, gtk3, qt4, qt5, etc.).
Źródła zewnętrzne
- https://packages.gentoo.org/useflags - USE flags on Gentoo Packages Database.
- cat /var/db/repos/gentoo/profiles/use.desc - The common USE flag description list can be seen locally on systems with Portage installed.
- https://devmanual.gentoo.org/general-concepts/use-flags/ - USE flags conceptually explained in the Gentoo Developer Handbook.