Talk:Profile (Portage)

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
Before creating a discussion or leaving a comment, please read about using talk pages. To create a new discussion, click here. Comments on an existing discussion should be signed using ~~~~:
A comment [[User:Larry|Larry]] 13:52, 13 May 2024 (UTC)
: A reply [[User:Sally|Sally]] 02:01, 26 June 2025 (UTC)
:: Your reply ~~~~

 Adding translation tags

Talk status
This discussion needs help.
Tip: To get this fixed sooner, use {{Proposal}}.

I want to translate this page in French, marking the changes will also allow other country to have their own translation as well. I am not the best to state if it's in good shape in English but after a first reading, seems fine to me. So I added these tags at first and last line.

Regards, Kévin GASPARD DE RENEFORT (talk) 08:44, 23 April 2024 (UTC)

Profile diagram

Talk status
This discussion is done as of 2018-12-23.

The ASCII-art representation of profile building/'stacking' is very hard to follow .. does anyone have any ideas for a better representation?! -- veremit (talk) 21:19, 4 May 2018 (UTC)

Colorization ? --Cronolio (talk) 07:08, 5 May 2018 (UTC)
The diagram gets complicated because it tries to simultaneously show filesystem layout and settings inheritance. I simplified it, feel free to improve it or reopen the discussion. — GuillermoDH (talk) 19:04, 23 December 2018 (UTC)

Combining multiple profiles from the Gentoo ebuild repository

Talk status
This discussion is done as of 2023-03-01.

The syntax given for a custom profile parent file, gentoo:path/in/profiles, is not accepted by (at least up to) sys-devel/portage-3.0.43-r1:

!!! Unable to parse profile: '/etc/make.profile'
!!! ParseError: Parent '/var/db/repos/jmbreuer/profiles/default/linux/x86/17.0/desktop/systemd/gentoo:default/linux/x86/17.0/desktop' not found: '/var/db/repos/jmbreuer/profiles/default/linux/x86/17.0/desktop/systemd/parent'

As a workaround, I've used /usr/portage/profiles/... for now, but that's obviously not portable with respect to $PORTDIR. What's the proper way to reference profiles in one repository from another one at this time?

--Jmbreuer (talk) 12:37, 1 March 2023 (UTC)

I'm not sure, but a place to ask could be #gentoo (webchat) - see support article. If you find out, feel free to edit the page with the correction ;). Thanks for the heads up. -- Ris (talk) 12:43, 1 March 2023 (UTC)
Thank you! While waiting for someone on #gentoo (webchat) to notice, I started to dig around in the code. Turns out I was missing the
FILE metadata/layout.conf
profile-formats = portage-2
statement in my custom repo... following all of the docs, it actually works. --Jmbreuer (talk) 13:13, 1 March 2023 (UTC)

Multiple undocumented features found

package.accept_keywords and package.unmask works on a per-profile basis

package.use -- Entries in a profile is not inherited downwards. I'm not sure if this is a bug or intended. In order to get inheritance to work you need to create a symlink system.

ENV_UNSET -- make.default variable is undocumented. De.techno (talk) 10:45, 7 November 2024 (UTC)

#!/bin/bash

  1. Define CPU architectures

ARCHITECTURES=("amd64" "arm64" "riscv64") # Corrected "rv64" to "riscv64" for consistency with Gentoo profiles

  1. Define init systems

INIT_SYSTEMS=("openrc" "systemd")

  1. Overlay configuration

OVERLAY_NAME="gentoo-local"

  1. Set the overlay base directory as requested

OVERLAY_BASE_DIR="/var/db/repos/" # Your custom overlays will live under /var/db/repos/gentoo-local OVERLAY_LOCATION="${OVERLAY_BASE_DIR}/${OVERLAY_NAME}"

  1. Gentoo's main repository base directory (new default)

GENTOO_REPO_BASE="/var/db/repos/gentoo"

  1. Ensure overlay directories exist

echo "Creating overlay directory structure at ${OVERLAY_LOCATION}..." mkdir -p "${OVERLAY_LOCATION}/metadata" mkdir -p "${OVERLAY_LOCATION}/profiles"

  1. Configure repos.conf for the new overlay

echo "Configuring /etc/portage/repos.conf/${OVERLAY_NAME}.conf..." printf "[%s]\nlocation = %s\nmasters = gentoo\npriority = 100\nauto-sync = no\n" \

   "${OVERLAY_NAME}" "${OVERLAY_LOCATION}" > "/etc/portage/repos.conf/${OVERLAY_NAME}.conf"
  1. Configure overlay metadata

echo "Configuring overlay metadata for ${OVERLAY_NAME}..." echo "masters = gentoo" > "${OVERLAY_LOCATION}/metadata/layout.conf"

  1. Add profile-formats to layout.conf (without comment in file)

echo "profile-formats = portage-2" >> "${OVERLAY_LOCATION}/metadata/layout.conf" echo "${OVERLAY_NAME}" > "${OVERLAY_LOCATION}/profiles/repo_name"

echo "Setting up custom profiles for each architecture and init system..."

  1. Loop through architectures and init systems to create profiles

for ARCH in "${ARCHITECTURES[@]}"; do

   # Correct RISC-V specific architecture string if needed for stage3 naming conventions
   # This might be 'rv64_lp64d' for RISC-V, but for profiles, 'riscv64' is typical.
   # Adjust if your stage3 names imply a different profile name.
   if "$ARCH" == "riscv64" ; then
       PROFILE_ARCH_DIR="riscv64" # Or "rv64_lp64d" if you specifically want to align with that
   else
       PROFILE_ARCH_DIR="$ARCH"
   fi
   for INIT in "${INIT_SYSTEMS[@]}"; do
       PROFILE_DIR="${OVERLAY_LOCATION}/profiles/hardened/linux/${PROFILE_ARCH_DIR}/${INIT}-llvm-desktop"
       
       echo "  - Creating profile: ${OVERLAY_NAME}:hardened/linux/${PROFILE_ARCH_DIR}/${INIT}-llvm-desktop"
       
       mkdir -p "${PROFILE_DIR}"
       # EAPI for the custom profile
       echo "6" > "${PROFILE_DIR}/eapi"
       # Define parent profiles
       # NOW REFERENCING THE NEW GENTOO_REPO_BASE for official Gentoo profiles
       PARENT_PROFILES=(
           "${GENTOO_REPO_BASE}/profiles/hardened/linux/${PROFILE_ARCH_DIR}"
           "${GENTOO_REPO_BASE}/profiles/targets/desktop"
           "${GENTOO_REPO_BASE}/profiles/features/split-usr"

"${GENTOO_REPO_BASE}/profiles/features/hardend"

           # Verify this LLVM profile path again, it's often under default/linux/$ARCH
           "${GENTOO_REPO_BASE}/profiles/gentoo/23.0/llvm" # This is a comm20n pattern for 23.0 profiles
       )
       if "$INIT" == "systemd" ; then
           PARENT_PROFILES+=("${GENTOO_REPO_BASE}/profiles/targets/systemd")
       elif "$INIT" == "openrc" ; then
           PARENT_PROFILES+=("${GENTOO_REPO_BASE}/profiles/targets/openrc")
           PARENT_PROFILES+=("${GENTOO_REPO_BASE}/profiles/features/openrc") # Add explicit openrc feature if desired
       fi
       # Write parent profiles to the 'parent' file
       printf "%s\n" "${PARENT_PROFILES[@]}" > "${PROFILE_DIR}/parent"
       # Add profile description to profiles.desc
       # Format: <arch> <path/to/profile> <status> [alias]
       printf "%s\t%s\t%s\t%s\n" \
           "${PROFILE_ARCH_DIR}" \
           "hardened/linux/${PROFILE_ARCH_DIR}/${INIT}-llvm-desktop" \
           "exp" \
           "llvm-${INIT}-desktop" \
           >> "${OVERLAY_LOCATION}/profiles/profiles.desc"
           # Using 'exp' for experimental, 'stable' is generally for well-tested official profiles.
           # Adding an alias for easier selection, e.g., 'llvm-systemd-desktop'.
   done

done

echo "Script finished. You can now try to select your profile, e.g.:" echo " emerge --sync" echo " eselect profile list" echo " eselect profile set ${OVERLAY_NAME}:hardened/linux/amd64/systemd-llvm-desktop" echo "Or use the alias: eselect profile set ${OVERLAY_NAME}:llvm-systemd-desktop"

echo "" echo "Remember to adjust your /etc/portage/make.conf for ACCEPT_KEYWORDS, etc." echo 'Example: ACCEPT_KEYWORDS="~* **"' echo 'Example: FEATURES="split-usr hardened"'

I made a script draft template feel free to edit for now it needs testing fixes. ie llvm desktop , with systemd or openrc split-user , and hardened for multiple arches. Necrose99 (talk)