USE-флаг

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page USE flag and the translation is 49% complete.
Outdated translations are marked like this.
Resources

USE-флаги — ключевые слова, которыми выражается поддержка и информация о зависимостях для определенного концепта. Это ключевая функция Gentoo, и хорошее понимание того, как ими пользоваться, необходимо для администрирования системы Gentoo.

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.

Базовая информация о том, как пользоваться USE-флагами, может быть найдена в Handbook.

Объявление 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.

См. также
For more information see the Using USE flags section of the amd64 Handbook.
Заметка
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.

Полезные команды

Список активированных USE-флагов:

user $portageq envvar USE | xargs -n 1

Проверить, активирован ли USE-флаг, и какие пакеты его используют:

user $euse -I <use_flag>
user $quse <use_flag>
user $eix --installed-with-use <use_flag>

Замените <use_flag> на USE-флаг, который хотите проверить.

Параметры команды emerge

Команда emerge имеет несколько параметров касательно USE-флагов:

  • --changed-use (-U)
  • --complete-graph-if-new-use < y | n >
  • --newuse (-N)

За подробностями обратитесь к 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.

Инструменты

Есть несколько инструментов для анализа и управления USE-флагами:

Смотрите также

Внешние ресурсы