[bitbake-devel] [PATCH] bitbake-worker: Add DryRun event

Richard Purdie richard.purdie at linuxfoundation.org
Thu Oct 4 08:57:14 UTC 2018


On Mon, 2018-10-01 at 21:37 -0400, Mark Hatle wrote:
> There may be actions that a user wants to take, but the information
> is only available during task execution.  Using the DryRun event you
> can prevent the actual task execution, but get access to the
> associated data stores.
> 
> Signed-off-by: Mark Hatle <mark.hatle at windriver.com>
> ---
>  bin/bitbake-worker | 2 ++
>  lib/bb/event.py    | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/bin/bitbake-worker b/bin/bitbake-worker
> index e925054b..e27fe7ac 100755
> --- a/bin/bitbake-worker
> +++ b/bin/bitbake-worker
> @@ -268,6 +268,8 @@ def fork_off_task(cfg, data, databuilder,
> workerdata, fn, task, taskname, append
>                  os._exit(1)
>              try:
>                  if dry_run:
> +                    localdata = bb.build._task_data(fn, taskname,
> the_data)
> +                    bb.event.fire(bb.event.DryRun(), localdata)
>                      return 0
>                  return bb.build.exec_task(fn, taskname, the_data,
> cfg.profile)
>              except:
> diff --git a/lib/bb/event.py b/lib/bb/event.py
> index 5b1b094a..c03541a1 100644
> --- a/lib/bb/event.py
> +++ b/lib/bb/event.py
> @@ -832,3 +832,8 @@ class FindSigInfoResult(Event):
>      def __init__(self, result):
>          Event.__init__(self)
>          self.result = result
> +
> +class DryRun(Event):
> +    """
> +    Event to fire during a dry run
> +    """

I think we can add something like this but the DryRun event should
really be in build.py and subclass TaskBase, called something like
TaskDryRun?

I'm hoping that doesn't upset some of the other code that looks at
TaskBase events but its certainly logically where the dryrun event
belongs.

We may want to pass dry_run into exec_task as a parameter and put this
code at the top of exec_task to make things cleaner across the files?

Cheers,

Richard




More information about the bitbake-devel mailing list