commit:     f8cbb84a4f47ea5d61788025b88206b35a21b015
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  9 08:18:40 2025 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 17 19:00:38 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f8cbb84a

EAPI 9 has edo

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 bin/eapi.sh            |  1 +
 bin/phase-helpers.sh   | 20 ++++++++++++++++++++
 bin/save-ebuild-env.sh |  1 +
 3 files changed, 22 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 97eb19d036..7babdf62e0 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -35,6 +35,7 @@ ___eapi_has_dosed()              [[ ${1-${EAPI-0}} == [0-3] ]]
 ___eapi_has_dostrip()            [[ ${1-${EAPI-0}} != [0-6] ]]
 ___eapi_has_eapply()             [[ ${1-${EAPI-0}} != [0-5] ]]
 ___eapi_has_eapply_user()        [[ ${1-${EAPI-0}} != [0-5] ]]
+___eapi_has_edo()                [[ ${1-${EAPI-0}} != [0-8] ]]
 ___eapi_has_einstall()           [[ ${1-${EAPI-0}} == [0-5] ]]
 ___eapi_has_einstalldocs()       [[ ${1-${EAPI-0}} != [0-5] ]]
 ___eapi_has_get_libdir()         [[ ${1-${EAPI-0}} != [0-5] ]]

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index e97ebc7169..68009fcc0e 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -1179,3 +1179,23 @@ if ___eapi_has_pipestatus; then
                return "${ret}"
        }
 fi
+
+if ___eapi_has_edo; then
+       edo() {
+               # list of special characters taken from sh_contains_shell_metas
+               # in shquote.c (bash-5.2)
+               local a out regex='[] '\''"\|&;()<>!{}*[?^$`]|^[#~]|[=:]~'
+
+               [[ $# -ge 1 ]] || die "edo: at least one argument needed"
+
+               for a; do
+                       # quote if (and only if) necessary
+                       [[ ${a} =~ ${regex} || ! ${a} =~ ^[[:print:]]+$ ]] && 
a=${a@Q}
+                       out+=" ${a}"
+               done
+
+               einfon
+               printf '%s\n' "${out:1}" >&2
+               "$@" || __helpers_die "edo: failed to run command: ${1}"
+       }
+fi

diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 1cddf6370a..f2249c041d 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -131,6 +131,7 @@ __save_ebuild_env() (
        ___eapi_has_usex && REPLY+=( usex )
        ___eapi_has_pipestatus && REPLY+=( pipestatus )
        ___eapi_has_ver_replacing && REPLY+=( ver_replacing )
+       ___eapi_has_edo && REPLY+=( edo )
 
        # Destroy the collected functions.
        unset -f "${REPLY[@]}"

Reply via email to