Gentoo Development Guide

Slotting

Packages can support having multiple versions installed simultaneously. This is useful for libraries which may have changed interfaces between versions — for example, the gtk+ package can install both versions 2.24 and 3.6 in parallel. This feature is called slotting.

Most packages have no need for slotting. These packages specify SLOT="0" in the ebuilds. This is not the same as specifying an empty slot — an empty slot means "disable slotting entirely", and should not be used.

Portage permits at most one instance of a package installation per SLOT value. For example, say we have the following:

Then the user could have, say, foo-1.2 and foo-2.0 installed in parallel, but not foo-1.1 and foo-1.2. Note that it is entirely possible that the user may have foo-2.0 installed and no foo-1.x at all.

To DEPEND upon a package in a specific slot, refer to SLOT Dependencies.

Sub-Slots

Sometimes a package installs a library that changes interfaces between versions, but it's undesirable or inconvenient to allow some of these versions to be installed simultaneously. In EAPI=5 and higher, this situation can be handled by using sub-slots, which are delimited from the regular slot by a / character, as in SLOT="slot/subslot". Packages can request to be automatically rebuilt when the subslot of a runtime dependency changes.

For example, suppose package foo installs a library whose soname is different for different versions. It would be reasonable to use the soname version as the sub-slot name:

  • foo-1.1 installs libfoo.so.5SLOT="1/5"
  • foo-1.2 installs libfoo.so.6SLOT="1/6"
  • foo-2.0 installs libfoo-2.so.0SLOT="2/0"
  • foo-2.1 installs libfoo-2.so.1SLOT="2/1"

Other ebuilds that install binaries which link to libfoo-2 (or libfoo) can then request to be automatically rebuilt when the installed version of foo:2 or foo:1 changes sub-slots — for example, when the user upgrades from foo-2.0 to foo-2.1.

If an ebuild does not explicitly declare a sub-slot, the regular slot is used as the value of the sub-slot by default.

Note

Care must be taken when using sub-slots in a library ebuild for the first time. Adding sub-slots will trigger rebuilds for all the packages that already use sub-slot dependencies (e.g. Switching from SLOT="0" to SLOT="0/14" in media-libs/libpng and package foo depends on libpng:0=). Therefore, it's best if you start using sub-slots in the library when the existing library interface changes.

Slot Names

Current versions of portage accept slot and sub-slot names that begin with an alphanumeric character or '_', and contain alphanumerics and '_', '-', '.', and '+' characters.