From 68f87a7fe8498f8fd45fef8817e5de596d302cdf Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 1 Jul 2025 12:05:34 +0100 Subject: [PATCH] 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 --- eclass/sysroot.eclass | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/eclass/sysroot.eclass b/eclass/sysroot.eclass index 6d1b88232eeb8..f17d6bcec2b4b 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 +}