Handbook:Parts/Working/Features/cs

Funkce Portage

Portage má také několik funkcí navíc, které zlepšují optimizaci Gentoo. Některé z těchto funkcí závisí na určitých softwarových nastrojích, které zlepšují výkon, spolehlivost, zabezpěčení, atd..

K aktivaci či deaktivaci určitých funkcí portage nebo-li "Portage Features" upravte a aktualizujte nebo změňte FEATURES proměnou, která obsahuje danou kličovanou funkci rozdělené mezerou. V určitých situacích je také důležité nainstalovat nástroje, na kterých daná funkce závysí.

Né všechny funkce, které Portage podporuje jsou zobrazeny zde. Pro úplný list funkcí se obraťte na man page.

Pro ověření jaké funkce nebo-li FEATURES jsou nastaveny v základu vývolejte. Je také možné použít.

Použití distcc
je program, který umožňuje kompilaci skrze několik nepřímo identických zařízení na síti. Klient distccu odesílá všechny potřebné informace k dostupného distcc serveru (na kterém běží distccd) za účelem kompilace několika částí zdrojového kodu pro dané klientské zařízení. Výsledkem je rychlejší kompilace.

Více informací o distcc a jeho funkce na Gentoo je dostupná na čláku Distcc.

Instalace distcc
Distcc obsahuje grafickou funkci monitor na monitor, kterou systém odesílá pro kompilaci. Tento nástroj je automaticky nainstalován pokud je nastaven nebo.

Aktivace distcc podpory na Portage
Přidejte  proměnnou do. Následně upravte MAKEOPTS proměnou a zvyště číslo o počet paralerních build jobs, které daný systém umožňuje. Většinou se používá, kde   je číslo procesorů na kterých běží distccd (včetně host) plus jeden,

Nyní vyvolejte a vložte dostupné distcc servery do listu. Pro jednoduchý příklad si představme, že dostupný DistCC server je 192.168.1.102 (současný host), 192.168.1.103 a 192.168.1.104 (dva remote host).

Don't forget to run the distccd daemon as well:

About 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.

Installing ccache
To install ccache run the following command:

Activating Portage ccache support
Open and add   to any values defined in the FEATURES variable. If FEATURES does not exist, then create it. Next, add a new variable called CCACHE_SIZE and set it to :

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.

For instance, to install gnumeric with prebuilt packages:

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
Portage is normally run as the root user. Setting  will allow Portage to drop root privileges while fetching package sources and run with user/group permissions of portage:portage. This is a small security improvement.

If  is set in FEATURES be sure to change the owner of all the files beneath  using the  command with root privileges:

Validated Gentoo repository snapshots
Administrators can opt to update the local Gentoo ebuild repository with a cryptographically validated snapshot as released by the Gentoo infrastructure. This ensures that no rogue rsync mirror is adding unwanted code or packages to the repositories the system will be 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.

Make sure that package is installed:

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.

Verify distfiles
To re-verify the integrity and (potentially) re-download previously removed/corrupted distfiles for all currently installed packages, run: