Skip to contentSkip to conversation

bitbake-worker: expand network varFlag

PATCH In review Martin Jansa 2 participants 2 messages Nov 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bitbake-worker: expand network varFlag

* this allows to use conditional when setting the value

---
 bin/bitbake-worker | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bin/bitbake-worker +4 -1
index 7be39370..fa606667 100755
@@ -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 
Signature · 1 line
2.38.1
#1 lore raw
Quoted 18 lines · Martin Jansa

* this allows to use conditional when setting the value

---
 bin/bitbake-worker | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
bin/bitbake-worker +2 -1
index 7be39370..fa606667 100755
@@ -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:

bin/bitbake-worker def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha · line 277

Quoted 10 lines
bin/bitbake-worker +2 -0
                     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