diff mbox series

bitbake-worker: expand network varFlag

Message ID 20221103090356.1655054-1-Martin.Jansa@gmail.com
State New
Headers show
Series bitbake-worker: expand network varFlag | expand

Commit Message

Martin Jansa Nov. 3, 2022, 9:03 a.m. UTC
* this allows to use conditional when setting the value

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 bin/bitbake-worker | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Richard Purdie Nov. 3, 2022, 9:09 p.m. UTC | #1
On Thu, 2022-11-03 at 10:03 +0100, Martin Jansa wrote:
> * this allows to use conditional when setting the value
> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  bin/bitbake-worker | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/bin/bitbake-worker b/bin/bitbake-worker
> index 7be39370..fa606667 100755
> --- a/bin/bitbake-worker
> +++ b/bin/bitbake-worker
> @@ -263,12 +263,15 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
>  
>                  bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
>  
> -                if not the_data.getVarFlag(taskname, 'network', False):
> +                task_network = the_data.getVarFlag(taskname, 'network')
> +                if not task_network:
>                      if bb.utils.is_local_uid(uid):
>                          logger.debug("Attempting to disable network for %s" % taskname)
>                          bb.utils.disable_network(uid, gid)
>                      else:
>                          logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
> +                else:
> +                    logger.debug("Skipping disable network for %s since network varFlag is set to %s." % (taskname, task_network))
>  
>                  # exported_vars() returns a generator which *cannot* be passed to os.environ.update() 
>                  # successfully. We also need to unset anything from the environment which shouldn't be there 

I was trying to avoid having to worry about having to handle values
like "0" enabling the network :(

Cheers,

Richard
diff mbox series

Patch

diff --git a/bin/bitbake-worker b/bin/bitbake-worker
index 7be39370..fa606667 100755
--- a/bin/bitbake-worker
+++ b/bin/bitbake-worker
@@ -263,12 +263,15 @@  def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
 
                 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
 
-                if not the_data.getVarFlag(taskname, 'network', False):
+                task_network = the_data.getVarFlag(taskname, 'network')
+                if not task_network:
                     if bb.utils.is_local_uid(uid):
                         logger.debug("Attempting to disable network for %s" % taskname)
                         bb.utils.disable_network(uid, gid)
                     else:
                         logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
+                else:
+                    logger.debug("Skipping disable network for %s since network varFlag is set to %s." % (taskname, task_network))
 
                 # exported_vars() returns a generator which *cannot* be passed to os.environ.update() 
                 # successfully. We also need to unset anything from the environment which shouldn't be there