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@gentoo.org>
This commit is contained in:
James Le Cuirot 2025-07-01 12:05:34 +01:00
parent fdd48738b3
commit 68f87a7fe8
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137

View File

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