Multi-layer hierarchical profile layout with mix-ins

This article describes the new profile layout idea by Michał Górny (talk). It is based on Funtoo 1.0 profiles, however it tries to generalize the idea.

Hierarchical layers
The profile layout is based on a number of hierarchical layers followed by a mix-in layer. Each of the hierarchical layers defines a number of profile variants. For example, the profile tree could define the following layers (with variants listed):


 * 1) system layer (linux, bsd, …),
 * 2) arch layer (x86, ppc, …).

All profile variants are exclusive. That is, the user must always choose exactly one variant in each hierarchical layer.

The layers are ordered, and the selected profiles are applied in the order of layers. The profiles in following layers may interact with the layers preceding them in two manners:


 * via excludes/conflicts: for example, the bsd system may exclude the ppc arch. In this case, the choice of bsd system makes it disallowed to select ppc, and possibly hides the choice.
 * via profile subvariants. Subvariants are subprofiles that are used instead of the main profile when a particular profile was selected in preceding layer. For example, if x86 defines a linux subvariant, it is used when linux system is combined with x86 arch.

Mix-ins
All of the hierarchical layers are followed by a mix-in layer. The mix-in layer represents a inclusive tree of profiles. The user may enable any number of mix-ins, as long as they do not collide with the selected hierarchical profiles or other mix-ins.

Each mix-in may have three specific properties:


 * 1) collisions with hierarchical profiles. In this case, a particular choice of hierarchical profile makes it impossible to enable a particular mix-in. The relevant mix-ins may be hidden from the user's choice.
 * 2) Collisions with other mix-ins. In this case, a choice of colliding mix-in makes it impossible to select the mix-in in question without deselecting the other. The UI may provide an ability to automatically deselect colliding mix-ins.
 * 3) Dependencies on other mix-ins (inheritance). In this case, a choice of mix-in implies loading all required (parent) mix-ins. The UI should highlight the mix-ins that are loaded automatically.