From Gentoo Wiki
< /etc/portage(Redirected from Package.env)
Jump to:navigation Jump to:search

/etc/portage/env and /etc/portage/package.env are used for modifying Portage's environmental variables, such as those specified in the /etc/portage/make.conf file, on a per-package basis.

  • The /etc/portage/env directory contains files that have the same syntax as make.conf. The filename will be used as the key to override settings.
  • The /etc/portage/package.env file describes which of these files will be used on a per-package basis.

Be aware certain variables in /etc/portage/make.conf are incremental variables. This means if the variable is already specified in /etc/portage/make.conf then Portage will read the values set in make.conf, and then read the values set in files beneath the /etc/portage/env directory.

In other words if FEATURES="ccache" in make.conf, and FEATURES="-ccache" in package/env/disable-ccache.conf, then Portage will see FEATURES as set to FEATURES="ccache -ccache" at emerge time for any packages which disable-ccache.conf is applied. This ultimately results in ccache being disabled for packages referencing disable-ccache.conf in the /etc/portage/package.env file.

Example 1: Enable debug information for a specific package

Suppose a user would like to build GIMP with debug information because the user wants a development version and would like to report any crashes to GIMP upstream.

Create a file in /etc/portage/env that contains the desired changes:

FILE /etc/portage/env/debug.conf

Next, add an entry to package.env followed by the name of the file created in the previous step:

FILE /etc/portage/package.env
media-gfx/gimp  debug.conf

Example 2: Build certain packages in a different location

Suppose the Portage build directory is in tmpfs, but some packages are too large, and run out of space. The PORTAGE_TMPDIR can be modified to exclude the packages that are too large.

Create a file in /etc/portage/env that modifies PORTAGE_TMPDIR variable and sets it to an on-disk directory:

FILE /etc/portage/env/notmpfs.conf

Add large packages to package.env:

app-emulation/qemu-kvm  notmpfs.conf
app-office/libreoffice  notmpfs.conf debug.conf
www-client/firefox      notmpfs.conf

Notice that it is possible to reference several files in /etc/portage/env for each package. (Tip originally blogged by Jeremy Olexa)

Example 3: Amending an ebuild function

A package specific file in the /etc/portage/env directory could help modifying an ebuild function without creating a new ebuild repository. In this example epatch_user is added to an old EAPI 5 ebuild.

FILE /etc/portage/env/media-gfx/fbida-2.12
src_prepare() { epatch_user || die; }


emerge --info does not show changes from package.env

According to bug #41006, it is important to note that running emerge --info does not show changes from the package.env file. This may be fixed in a future Portage release.

See also

External resources