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
This commit is contained in:
Steffen Winter
2026-03-17 00:34:11 +01:00
committed by Johannes Altmanninger
parent b047450cd0
commit d36c53c6e2
2 changed files with 4 additions and 15 deletions

View File

@@ -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

View File

@@ -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