• [gentoo-dev] [PATCH 1/3] systemd.eclass: rework EPREFIX handling

    From Mike Gilbert@21:1/5 to All on Mon Oct 10 17:40:03 2022
    Instead of adding a private function to get the unprefixed version of
    every path, use a new "_systemd_unprefix" helper function.

    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    ---
    eclass/systemd.eclass | 69 ++++++++++++-------------------------------
    1 file changed, 19 insertions(+), 50 deletions(-)

    diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
    index 7731bede094..9e9a9b0cf20 100644
    --- a/eclass/systemd.eclass
    +++ b/eclass/systemd.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2011-2021 Gentoo Authors
    +# Copyright 2011-2022 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: systemd.eclass
    @@ -53,20 +53,21 @@ _systemd_get_dir() {

    if $(tc-getPKG_CONFIG) --exists systemd; then
    d=$($(tc-getPKG_CONFIG) --variable="${variable}" systemd) || die
    - d=${d#${EPREFIX}}
    else
    - d=${fallback}
    + d="${EPREFIX}${fallback}"
    fi

    echo "${d}"
    }

    -# @FUNCTION: _systemd_get_systemunitdir
    +# @FUNCTION: _systemd_unprefix
    +# @USAGE: <function-name>
    # @INTERNAL
    # @DESCRIPTION:
    -# Get unprefixed unitdir.
    -_systemd_get_systemunitdir() {
    - _systemd_get_dir systemdsystemunitdir /lib/systemd/system
    +# Calls the sp