commit:     68f87a7fe8498f8fd45fef8817e5de596d302cdf
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul  1 11:05:34 2025 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Wed Jul  9 11:21:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=68f87a7f

sysroot.eclass: Add sysroot_run_prefixed convenience function

This is for simple cases where you just need to run a command
immediately rather than pass a wrapper to a build tool.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 eclass/sysroot.eclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass
index 6d1b88232eeb..f17d6bcec2b4 100644
--- a/eclass/sysroot.eclass
+++ b/eclass/sysroot.eclass
@@ -106,3 +106,16 @@ sysroot_make_run_prefixed() {
 
        echo "${SCRIPT}"
 }
+
+# @FUNCTION: sysroot_run_prefixed
+# @DESCRIPTION:
+# Create a wrapper script with sysroot_make_run_prefixed if necessary, and use
+# it to execute the given command, otherwise just execute the command directly.
+sysroot_run_prefixed() {
+       local script
+       if script=$(sysroot_make_run_prefixed); then
+               "${script}" "${@}"
+       else
+               "${@}"
+       fi
+}

Reply via email to