Package sets are sets of packages used by Portage. They define the packages that make up the base system and those that are installed based on user action.
Sets can be passed as an argument to emerge:
emerge -p @world
The list of available sets can be found by:
changed-deps deprecated-live-rebuild downgrade installed larrys-defined-set live-rebuild module-rebuild preserved-rebuild profile rebuilt-binaries security selected selected-packages selected-sets system unavailable unavailable-binaries world x11-module-rebuild
System defining sets
All Gentoo systems have six sets that define the packages that make up the system. The selected* sets define which sets the user wants while the system and profile sets define which package are required for the base system.
The selected-packages set is the list of packages in the world file (/var/lib/portage/world). It is the set of packages that have been explicitly installed by the user.
The selected-sets set is the set of user defined sets (see below) that have been explicitly emerged. The sets are listed in the /var/lib/portage/world_sets file. The set may be empty.
The selected set is the union of @selected-packages and @selected-sets.
The system set along with @profile define the base set of packages on a Gentoo system.
The profile set along with @system define the base set of packages on a Gentoo system. The differences between the two is described in the man pages of Portage but the distinction does not usually matter to the user. The packages that make up the sets are determined by the profile and architecture of the system.
The world set is the union of @selected, @system, and @profile.
User defined sets
larrys-defined-set is an example of a user defined set. Users can define sets in /etc/portage/sets which can then be rebuilt by emerge like any other set:
emerge --ask @larrys-defined-set
In addition to emerging the packages, the set itself will be added to @selected-sets and therefore also be part of @selected. This is fine if the packages in Larry's set are all end-user packages. However if some of the packages in Larry's set are only dependencies it can cause problems because the package will continue to be updated even if it is no longer required. It is equivalent to having dependencies in the world file. To emerge a user set without adding the package to the @selected-set run:
emerge --ask --oneshot @larrys-defined-set
To stop using a user defined set, deselect it:
emerge --deselect @larrys-defined-set
It is dangerous to use
--unmergewith sets. Doing so with certain packages listed in a set could render the machine inoperable.
Portage maintains other sets that are based on the state or type of package. Unlike the previous sets, these cannot define packages that should be installed. The members of the sets are determined by Portage and are not user editable. The sets are listed in /usr/share/portage/config/sets/portage.conf but should not be edited.
changed-deps is the set of packages that have changed dependencies.
deprecated-live-rebuild is the older way to get the set of live packages.
downgrade is the set of packages that have an installed version that is higher than the highest visible ebuild version.
installed is the set of all installed packages.
live-rebuild is the set of live (category/package-9999) packages.
module-rebuild is the set of out of kernel modules, packages that own files in /lib/modules.
preserved-rebuild is the set of packages that are using preserved libraries.
rebuilt-binaries is the set of binary package that can be replaced with packages that have been rebuilt.
security is the set of packages for which there is a new GLSA.
unavailable is the set of installed packages that do not have an ebuild.
unavailable is the set of installed packages that do not have a binary package.
x11-module-rebuild is the set of packages that own files inside /usr/lib/xorg/modules with the exception of the package that owns /usr/bin/Xorg.