diff mbox series

[RFC,1/5] devtool upgrade: enable RECIPE_UPDATE_EXTRA_TASKS

Message ID 3244936f4100150c4cf829ffaafd3fcfc8242f35.1717361301.git.tim.orling@konsulko.com
State New
Headers show
Series [RFC,1/5] devtool upgrade: enable RECIPE_UPDATE_EXTRA_TASKS | expand

Commit Message

Tim Orling June 2, 2024, 9 p.m. UTC
From: Tim Orling <tim.orling@konsulko.com>

For some recipes, such as those that inherit cargo-update-recipe-crates,
we need to run additional tasks once the new sources have been unpacked.

Introduce a new variable RECIPE_UPDATE_EXTRA_TASKS which is a space-
delimited list of tasks to run after the new sources have been
unpacked in scripts/lib/devtool/upgrade.py ugrade() method.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 scripts/lib/devtool/upgrade.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Richard Purdie June 4, 2024, 6:42 a.m. UTC | #1
On Sun, 2024-06-02 at 14:00 -0700, Tim Orling via lists.openembedded.org wrote:
> From: Tim Orling <tim.orling@konsulko.com>
> 
> For some recipes, such as those that inherit cargo-update-recipe-crates,
> we need to run additional tasks once the new sources have been unpacked.
> 
> Introduce a new variable RECIPE_UPDATE_EXTRA_TASKS which is a space-
> delimited list of tasks to run after the new sources have been
> unpacked in scripts/lib/devtool/upgrade.py ugrade() method.
> 
> Signed-off-by: Tim Orling <tim.orling@konsulko.com>
> ---
>  scripts/lib/devtool/upgrade.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
> index a8130ed23f5..a378f910523 100644
> --- a/scripts/lib/devtool/upgrade.py
> +++ b/scripts/lib/devtool/upgrade.py
> @@ -534,6 +534,16 @@ def _generate_license_diff(old_licenses, new_licenses):
>              diff = diff + line
>      return diff
>  
> +def _run_recipe_update_extra_tasks(pn, rd, tinfoil):
> +    tasks = []
> +    for task in rd.getVar('RECIPE_UPDATE_EXTRA_TASKS:%s' % pn).split():
> +        try:
> +            logger.info('Running extra recipe update task: %s' % task)
> +            res = tinfoil.build_targets(pn, task, handle_events=True)
> +        except (bb.process.ExecutionError, Exception) as e:
> +            logger.fatal("Failed to run recipe task (%s): %s" % (task, e.msg))
> +    return res
> +
> 

https://valkyrie.yoctoproject.org/#/builders/35/builds/37/steps/14/logs/stdio

Needs a (d.getVar or "").split() and the return value isn't used and is
a bit questionable as it will break if there are no tasks.


>  def upgrade(args, config, basepath, workspace):
>      """Entry point for the devtool 'upgrade' subcommand"""
>  
> @@ -609,6 +619,8 @@ def upgrade(args, config, basepath, workspace):
>                          copied, config.workspace_path, rd)
>          standard._add_md5(config, pn, af)
>  
> +        _run_recipe_update_extra_tasks(pn, rd, tinfoil)
> +
>          update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn])
>  
>          logger.info('Upgraded source extracted to %s' % srctree)

Cheers,

Richard
diff mbox series

Patch

diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index a8130ed23f5..a378f910523 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -534,6 +534,16 @@  def _generate_license_diff(old_licenses, new_licenses):
             diff = diff + line
     return diff
 
+def _run_recipe_update_extra_tasks(pn, rd, tinfoil):
+    tasks = []
+    for task in rd.getVar('RECIPE_UPDATE_EXTRA_TASKS:%s' % pn).split():
+        try:
+            logger.info('Running extra recipe update task: %s' % task)
+            res = tinfoil.build_targets(pn, task, handle_events=True)
+        except (bb.process.ExecutionError, Exception) as e:
+            logger.fatal("Failed to run recipe task (%s): %s" % (task, e.msg))
+    return res
+
 def upgrade(args, config, basepath, workspace):
     """Entry point for the devtool 'upgrade' subcommand"""
 
@@ -609,6 +619,8 @@  def upgrade(args, config, basepath, workspace):
                         copied, config.workspace_path, rd)
         standard._add_md5(config, pn, af)
 
+        _run_recipe_update_extra_tasks(pn, rd, tinfoil)
+
         update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn])
 
         logger.info('Upgraded source extracted to %s' % srctree)