Handbook:Parts/Working/Features/ru

Возможности Portage
Portage has several additional features that makes the Gentoo experience even better. Many of these features rely on certain software tools that improve performance, reliability, security, ...

Чтобы включить или отключить определенные функции Portage, отредактируйте и измените или установите переменную FEATURES, которая содержит некоторые обозначения возможностей, разделенные пробелом. В некоторых случаях необходимо установить дополнительные инструменты на которые опирается эта возможность.

Не все возможности, которые поддерживает Portage, перечислены здесь. Для полного обзора пожалуйста обратитесь к man-странице :

Чтобы найти, что на данный момент установлено в FEATURES, запустите и поищите переменную FEATURES самостоятельно или с помощью :

Использование distcc
is a program to distribute compilations across several, not necessarily identical, machines on a network. The distcc client sends all necessary information to the available distcc servers (running distccd) so they can compile pieces of source code for the client. The net result is a faster compilation time.

More information about distcc (and how to have it work with Gentoo) can be found in the Distcc article.

Установка distcc
Distcc ships with a graphical monitor to monitor tasks that the computer is sending away for compilation. This tool is automatically installed if  or   is set.

Включение поддержки distcc в Portage
Add distcc to the FEATURES variable inside. Next, edit the MAKEOPTS variable and increase the number of parallel build jobs that the system allows. A known guideline is to fill in  where   is the number of CPUs that run distccd (including the current host) plus one, but that is just a guideline.

Now run and enter the list of available distcc servers. For a simple example assume that the available DistCC servers are 192.168.1.102 (the current host), 192.168.1.103 and 192.168.1.104 (two "remote" hosts):

Не забудьте также запустить демон distccd:

О ccache
is a fast compiler cache. Whenever an application is compiled, it will cache intermediate results so that, whenever the same program is recompiled, the compilation time is greatly reduced. The first time ccache is run, it will be much slower than a normal compilation. Subsequent recompiles however should be faster. ccache is only helpful if the same application will be recompiled many times (or upgrades of the same application are happening frequently); thus it's mostly only useful for software developers.

For more information about ccache, please visit its homepage.

Установка ccache
Для установки ccache запустите следующую команду:

Включение поддержки ccache в Portage
Откройте и добавьте   в переменную FEATURES. Далее, добавьте новую переменную, которая называется CCACHE_SIZE и установите ее в :

To check if ccache functions, ask ccache to provide its statistics. Because Portage uses a different ccache home directory, it is necessary to temporarily set the CCACHE_DIR variable:

The location is Portage' default ccache home directory; it can be changed by setting the CCACHE_DIR variable in.

When running standalone, it would use the default location of, which is why the CCACHE_DIR variable needs to be set when asking for the (Portage) ccache statistics.

Using ccache outside Portage
To use ccache for non-Portage compilations, add to the beginning of the PATH variable (before ). This can be accomplished by editing in the user's home directory. Using is one way to define PATH variables.

Creating prebuilt packages
Portage supports the installation of prebuilt packages. Even though Gentoo does not provide prebuilt packages by itself Portage can be made fully aware of prebuilt packages.

To create a prebuilt package use the command if the package is already installed on the system, or emerge with the   or   options.

To have Portage create prebuilt packages of every single package that gets installed, add  to the FEATURES variable.

More extended support for creating prebuilt package sets can be obtained with catalyst. For more information on catalyst please read the Catalyst FAQ.

Installing prebuilt packages
Although Gentoo doesn't provide one, it is possible to create a central repository where prebuilt packages are stored. In order to use this repository, it is necessary to make Portage aware of it by having the PORTAGE_BINHOST variable point to it. For instance, if the prebuilt packages are on ftp://buildhost/gentoo:

To install a prebuilt package, add the  option to the emerge command alongside of the   option. The former tells emerge to download the prebuilt package from the previously defined server while the latter asks emerge to try to install the prebuilt package first before fetching the sources and compiling it.

Например, чтобы установить gnumeric из ранее скомпилированного пакета (prebuilt):

More information about emerge's prebuilt package options can be found in the emerge man page:

Distributing prebuilt packages to others
If prebuilt packages are to be distributed to others, then make sure that this is permitted. Check the distribution terms of the upstream package for this. For example, for a package released under the GNU GPL, sources must be made available along with the binaries.

Ebuilds may define a  restriction in their RESTRICT variable if built binaries are not distributable. Sometimes this restriction is conditional on one or more USE flags.

By default, Portage will not mask any packages because of restrictions. This can be changed globally by setting the ACCEPT_RESTRICT variable in. For example, to mask packages that have a  restriction, add the following line to :

It is also possible to override the ACCEPT_RESTRICT variable by passing the  option to the  command. For example,  will temporarily mask packages with a   restriction.

Also consider setting the ACCEPT_LICENSE variable when distributing packages. See the Licenses section for this.

Userfetch
When Portage is run as root,  will allow Portage to drop root privileges while fetching package sources. This is a small security improvement.

Проверенные снимки дерева Portage
Administrators can opt to update the local Gentoo ebuild tree with a cryptographically validated tree snapshot as released by the Gentoo infrastructure. This ensures that no rogue rsync mirror is adding unwanted code or packages to the tree the system is downloading.

The Gentoo release media OpenPGP keys are now available as a binary keyring. These can be installed via the package:

This will install the keyring to the location.

Убедитесь, что пакет установлен:

Use to verify that the keys in the keyring are the correct keys:

Verify the fingerprints of the key(s) against those listed on the official Gentoo release engineering project page.

Repeat the following command for each key you wish to trust. (Substitute the keyid '0x...' for the desired key you wish to trust.)

Should a GPG command-line menu appear, fully trust the key and quit the program by entering the following:

The system is now set-up to sync using only OpenPGP/gpg verified snapshots. Several command options are available to perform the sync.