Combine / cascading profiles on Gentoo

Posted on Fri 22 February 2019 in linux

Background

Setting up a no-multilib desktop (without ricing DE) environment.
Used to turn off some USE flags to achieve 64bit-only.
The profile way, however, should be more comprehensive (because both USE flags and packages are taken care of).

Howto

1. Create a custom repo named lucky

# run as root
mkdir -p /var/db/repos/lucky/{metadata,profiles}
cd /var/db/repos/lucky
echo -e 'masters = gentoo\nprofile-formats = portage-2\nuse-manifests = false' > metadata/layout.conf
echo 'lucky' > profiles/repo_name
  • in metadata/layout.conf:

    • gentoo is defined as the master of this repo, so that the eclasses there can be used
    • manifest is disabled simply because all ebuilds in this repo will be added manually by me LOL
  • profiles/repo_name specifies the repository name

2. Create the no-multilib/desktop profile

# still in /var/db/repos/lucky
take profiles/default/linux/amd64/17.1/no-multilib/desktop
echo ../../../../../../../../gentoo/profiles/default/linux/amd64/17.1/{desktop,no-multilib} | xargs -n1 > parent
  • absolute paths work fine, but relative paths are better here.

  • a lower line would take precedence over an upper line should conflict happen

3. Tell eselect about the profile

echo 'amd64 default/linux/amd64/17.1/no-multilib/desktop stable' > /var/db/repos/lucky/profiles/profiles.desc

<arch> <profile name> <stable | experimental> in profile.desc

4. Tell portage about the custom repo

echo -e '[lucky]\nlocation = /var/db/repos/lucky\nauto-sync = no' > /etc/portage/repos.conf/lucky.conf

More info

5. Check

# eselect profile list
[...]
[39] lucky: default/linux/amd64/17.1/no-multilib/desktop (stable)

Further maintenance (like, when 18.0 stable)

cd /var/db/repos/lucky/profiles/default/linux/amd64
cp -av 17.1/ 18.0/
sed -i 's/17.1/18.0/g' 18.0/no-multilib/desktop/parent ../../../profiles.desc

Just update all 17.1 stuff to 18.0

Ref

https://unix.stackexchange.com/a/448012
https://wiki.gentoo.org/wiki/Profile_(Portage)#Combining_profiles

gw