diff mbox series

[06/12] recipetool: allow recipe create handlers to specify bitbake tasks to run

Message ID 20250620151429.3210879-6-ross.burton@arm.com
State New
Headers show
Series [01/12] tinfoil: add wait_for decorator and build_file_sync() helper | expand

Commit Message

Ross Burton June 20, 2025, 3:14 p.m. UTC
When creating a recipe there can be cases where there is a class that
does some of the recipe creation (such as cargo-update-recipe-crates).

To avoid duplication of code, look for run_task assignments in the
extravalues dictionary returned by the handler, and if it is set then
call that task after writing the recipe.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/lib/recipetool/create.py | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index b2101f39325..f0584d84701 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -765,6 +765,7 @@  def create_recipe(args):
     extrafiles = extravalues.pop('extrafiles', {})
     extra_pn = extravalues.pop('PN', None)
     extra_pv = extravalues.pop('PV', None)
+    run_task = extravalues.pop('run_task', None)
 
     if extra_pv and not realpv:
         realpv = extra_pv
@@ -919,6 +920,10 @@  def create_recipe(args):
         log_info_cond('Recipe %s has been created; further editing may be required to make it fully functional' % outfile, args.devtool)
         tinfoil.modified_files()
 
+    if run_task:
+        logger.info("Running task %s" % run_task)
+        tinfoil.build_file_sync(outfile, run_task)
+
     if tempsrc:
         if args.keep_temp:
             logger.info('Preserving temporary directory %s' % tempsrc)