From d36c53c6e2d3519d6d05999823c0bc6a625e2893 Mon Sep 17 00:00:00 2001 From: Steffen Winter Date: Tue, 17 Mar 2026 00:34:11 +0100 Subject: [PATCH] functions: dynamically query gentoo system paths Use portageq to retrieve system paths instead of hardcoding them in. This helps especially in Gentoo Prefix, where the installation is not in / but rather offset inside a subdirectory (usually a users home directory). This only affects the "slow" path. When eix is installed it will be used instead. It already accounts for Prefix installations. Closes #12552 --- .../__fish_print_portage_installed_pkgs.fish | 2 +- .../__fish_print_portage_repository_paths.fish | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/share/functions/__fish_print_portage_installed_pkgs.fish b/share/functions/__fish_print_portage_installed_pkgs.fish index 861ff9bdf..f24c82291 100644 --- a/share/functions/__fish_print_portage_installed_pkgs.fish +++ b/share/functions/__fish_print_portage_installed_pkgs.fish @@ -3,6 +3,6 @@ function __fish_print_portage_installed_pkgs --description 'Print all installed if type -f -q eix EIX_LIMIT=0 eix -I --only-names else - find /var/db/pkg -mindepth 2 -maxdepth 2 -type d -printf '%P\n' 2>/dev/null | string replace -r -- '-[0-9][0-9.]*.*$' '' + find (portageq envvar vdb_path) -mindepth 2 -maxdepth 2 -type d -printf '%P\n' 2>/dev/null | string replace -r -- '-[0-9][0-9.]*.*$' '' end end diff --git a/share/functions/__fish_print_portage_repository_paths.fish b/share/functions/__fish_print_portage_repository_paths.fish index 7eab886b2..5f8f614c8 100644 --- a/share/functions/__fish_print_portage_repository_paths.fish +++ b/share/functions/__fish_print_portage_repository_paths.fish @@ -1,17 +1,6 @@ # localization: skip(private) function __fish_print_portage_repository_paths --description 'Print the paths of all configured repositories' - set -l a /etc/portage/repos.conf - set -l b - set -l c /usr/share/portage/config/repos.conf - test -d $a - and set b (path filter -f -- $a/**) - test -f $a - and set b $a - test -n "$b" - and string match -q "[gentoo]" -- (cat $b 2>/dev/null) - and set c $b - or set -a c $b - path is -r -- $c - or return - cat $c 2>/dev/null | string match -g -r '^location = (.*$)' + set -l eroot (portageq envvar EROOT) + set -l repos (portageq get_repos $eroot | string split ' ') + portageq get_repo_path $eroot $repos end