This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Profile (Portage)
A Portage profile specifies default values for global and per-package USE flags, specifies default values for most variables found in make.conf, and defines a set of system packages. It masks unstable package versions and USE flags. The profiles are maintained by the Gentoo developers as part of the Gentoo repository (/usr/portage/profiles), but there are ways for users to override single pieces.
An exhaustive explanation is given in the Gentoo handbook.
Structure
All profiles are cascading/stackable profiles composed by several subprofiles. Each subprofile (corresponding to a directory under /usr/portage/profiles) can contain files to set some defaults. Lower level subprofiles (e.g default/linux/amd64) also can have a file called parent, which pulls in one or more other higher level subprofiles (here: default/linux, arch/amd64 and base). Defaults defined in a lower level subprofile overwrites all conflicting defaults in higher subprofiles.
Following is an example for the stacked profile default/linux/amd64/13.0/desktop/kde showing the dependencies:
/usr/portage/profiles/ |-- arch | |-- amd64 <--------------. | | `-- parent >-------- | ----------------------. | -- base <--------------- | ----------------------| |-- base <-------------------| | |-- default | | | `-- linux <--------------| | | `-- amd64 <--------- | ------------------. | | |-- parent >-----' | | | `-- 13.0 <-----------------------. | | | |-- parent >---------------- | --| | | `-- desktop <------------. | | | | |-- parent >-------- | --| | | | `-- kde | | | | | `-- parent >-----| | | | |-- features | | | | | `-- multilib <-----------. | | | | | `-- lib32 <--------- | --------- | - | - | --' | `-- parent >-----' | | | |-- releases <-----------. | | | | `-- 13.0 <---------- | ------------- | - | --' | `-- parent >-----' | | `-- targets | | `-- desktop <----------------------- | --' `--kde <----------- | -----------' `-- parent >-----'
The following table gives a quick overview of what subprofile contain what files:
root folder |
arch -amd64 |
arch -base |
base | default -linux |
default -linux -amd64 |
default -linux -amd64 -13.0 |
default -linux -amd64 -13.0 -desktop |
default -linux -amd64 -13.0 -desktop -kde |
features -multilib |
features -multilib -lib32 |
releases | releases -13.0 |
targets -desktop |
targets -desktop -kde | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eapi | Yes | No | No | No | No | No | Yes | Yes | Yes | No | No | No | Yes | No | No |
make.defaults | No | Yes | No | Yes | Yes | No | No | No | No | Yes | Yes | Yes | Yes | Yes | Yes |
packages | No | No | No | Yes | Yes | No | No | No | No | No | No | No | No | No | No |
package.build | No | No | No | No | Yes | No | No | No | No | No | No | No | No | No | No |
package.mask | Yes | No | No | Yes | No | No | No | No | No | No | No | No | Yes | No | No |
package.use | No | No | No | Yes | Yes | No | No | No | No | No | No | No | No | Yes | Yes |
package.use.force | No | Yes | No | Yes | No | No | No | No | No | No | No | No | No | No | No |
package.use.mask | No | Yes | No | Yes | Yes | No | No | No | No | No | No | No | No | No | No |
profile.bashrc | No | No | No | Yes | No | No | No | No | No | No | No | No | No | No | No |
use.force | No | Yes | No | Yes | No | No | No | No | No | Yes | No | No | No | No | Yes |
use.mask | No | Yes | Yes | Yes | No | No | No | No | No | Yes | No | No | No | No | No |
Combining profiles
If there isn't a profile in the Gentoo repository that meets your exact requirements, you can try combining multiple profiles into a single custom profile. An example of this would be combining a hardened profile with a desktop systemd profile, such as default/linux/amd64/17.0/desktop/plasma/systemd
and default/linux/amd64/17.0/hardened
. It is expected that you already have a custom repository set up.
The order in which the profiles are listed in the parent file can drastically affect which features will be enabled/disabled system-wide. If you have emerge resolution problems after switching to the custom profile, try changing the order of the lines in the parent file. It may be impossible to get some combinations to work correctly. Your mileage may vary!
- Create a profile name for your hybrid profile. For instance, the combination mentioned above could be named:
plasma-hardened
- Create the directory structure in your local repository:
root #
local_repo=/usr/local/portage # A common location for the local repository
root #
profile_name=plasma-hardened
root #
mkdir -p $local_repo/profiles/$profile_name
- Reference the profiles from the Portage tree and store them in your new profile's parent file:
root #
portage_dir=/usr/portage # A common location for the Portage tree
root #
for p in default/linux/amd64/17.0/desktop/plasma/systemd default/linux/amd64/17.0/hardened
> do
> realpath --relative-to=$local_repo/profiles/$profile_name $portage_dir/profiles/$p
> done > $local_repo/profiles/$profile_name/parent
- Insert the newly created profile in your repository's profiles.desc:
root #
arch=amd64 # Your architecture of choice
root #
type=dev # The profile's type: stable or dev
root #
echo "$arch $profile_name $type" >> $local_repo/profiles/profiles.desc
- Switch to the new profile using eselect:
root #
eselect profile list
...
[38] local:plasma-hardened
root #
eselect profile set 38
- Run a world rebuild, but first check to make sure that the desired changes are going into effect. If not, you may need to adjust the order of the lines in the parent file:
root #
emerge -DNua --complete-graph @world