bitbake-worker: Check BB_TASK_NETWORK before disable network for task
cover bitbake-worker: Check BB_TASK_NETWORK before disable network for task
The following changes since commit 4f24d5daa63feba1849f9c6295597b97c3a42035:
build-appliance-image: Update to master head revision (2022-01-19 23:04:08 +0000)
are available in the Git repository at:
git://github.com/robertlinux/yocto rbt/network
https://github.com/robertlinux/yocto/tree/rbt/network
Robert Yang (1):
bitbake-worker: Check BB_TASK_NETWORK before disable network for task
bitbake/bin/bitbake-worker | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.31.1
PATCH 1/1 bitbake-worker: Check BB_TASK_NETWORK before disable network for task
The NIS user can't work when task's network is disabled, so check BB_TASK_NETWORK before disable it, the conf files can set BB_TASK_NETWORK.
--- bitbake/bin/bitbake-worker | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/bin/bitbake-worker +2 -1
@@ -261,7 +261,8 @@ 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): + bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False) + if not (bb_task_network or the_data.getVarFlag(taskname, 'network', False)): logger.debug("Attempting to disable network") bb.utils.disable_network(uid, gid)
Signature · 1 line
2.31.1
Quoted 24 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Yang
Sent: den 20 januari 2022 08:27
To: [email protected]
Cc: [email protected]
Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: CheckBB_TASK_NETWORKbefore disable network for taskThe NIS user can't work when task's network is disabled, so check
BB_TASK_NETWORKbefore disable it, the conf files can setBB_TASK_NETWORK.Signed-off-by Robert Yang <[email protected]>--- bitbake/bin/bitbake-worker | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)bitbake/bin/bitbake-worker +0
-0@@ -261,7 +261,8 @@ 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_", "")))
bitbake/bin/bitbake-worker def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha · line 264
Quoted 2 lines
bitbake/bin/bitbake-worker +1
-1- if not the_data.getVarFlag(taskname, 'network', False): + bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)
Why use False to getVar() above?
Quoted 1 line
+ if not (
bb_task_networkorthe_data.getVarFlag(taskname, 'network', False)):
I can't speak for others, but I find "not (foo or bar)" a lot harder to parse than "not foo and not bar".
Quoted 5 lines
logger.debug("Attempting to disable network")bb.utils.disable_network(uid, gid)--
2.31.1
//Peter
Hi Peter,
Quoted 22 lines · Peter Kjellerstedt
Quoted 22 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Robert Yang
Sent: den 20 januari 2022 08:27
To: [email protected]
Cc: [email protected]
Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: CheckBB_TASK_NETWORKbefore disable network for taskThe NIS user can't work when task's network is disabled, so check
BB_TASK_NETWORKbefore disable it, the conf files can setBB_TASK_NETWORK.Signed-off-by Robert Yang <[email protected]>--- bitbake/bin/bitbake-worker | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)bitbake/bin/bitbake-worker +0
-0@@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder, workerdata,fn, task, taskname, taskha
Quoted 6 lines
bitbake/bin/bitbake-worker def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha · line 264
Quoted 4 lines
bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))bitbake/bin/bitbake-worker +1
-1- if not the_data.getVarFlag(taskname, 'network', False): + bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)Why use False to
getVar()above?
The False is for bb.utils.to_boolean(), not getVar(), the getVar has only one argument:
the_data.getVar('BB_TASK_NETWORK')
Quoted 5 lines
Quoted 2 lines
+ if not (
bb_task_networkorthe_data.getVarFlag(taskname, 'network', False)):I can't speak for others, but I find "not (foo or bar)" a lot harder to parse than "not foo and not bar".
Technically, the "not (foo or bar)" is slightly faster than "not foo and not bar" since the latter one requires more logical evaluates.
// Robert
Quoted 9 lines
Quoted 6 lines
logger.debug("Attempting to disable network")bb.utils.disable_network(uid, gid)--
2.31.1//Peter
Quoted 44 lines
-----Original Message-----
From: Robert Yang <[email protected]>
Sent: den 21 januari 2022 04:15
To: Peter Kjellerstedt <[email protected]>; bitbake- [email protected]
Cc: [email protected]
Subject: Re: [bitbake-devel] [PATCH 1/1] bitbake-worker: CheckBB_TASK_NETWORKbefore disable network for taskHi Peter,
Quoted 2 lines · Peter Kjellerstedt
Quoted 2 lines
-----Original Message-----
From: [email protected] <bitbake-[email protected]> On Behalf Of Robert Yang
Quoted 4 lines
Quoted 4 lines
Sent: den 20 januari 2022 08:27
To: [email protected]
Cc: [email protected]
Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check
BB_TASK_NETWORKbefore disable network for taskQuoted 3 lines
Quoted 3 lines
The NIS user can't work when task's network is disabled, so check
BB_TASK_NETWORKbefore disable it, the conf files can set
BB_TASK_NETWORK.Quoted 11 lines
bitbake/bin/bitbake-worker def fork_off_task(cfg, data, databuilder,
Quoted 11 lines
Signed-off-by Robert Yang <[email protected]>--- bitbake/bin/bitbake-worker | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)bitbake/bin/bitbake-worker +0
-0@@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder,workerdata,
Quoted 3 lines
Quoted 3 lines
fn, task, taskname, taskha
bb.utils.set_process_name("%s:%s" %(
the_data.getVar("PN"),taskname.replace("do_", "")))Quoted 2 lines
Quoted 2 lines
- if not the_data.getVarFlag(taskname, 'network',
False):
Quoted 1 line
Quoted 1 line
+
bb_task_network=
Quoted 8 lines
bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)Quoted 2 lines
Why use False to
getVar()above?The False is for
bb.utils.to_boolean(), notgetVar(), the getVar has only one argument:
the_data.getVar('BB_TASK_NETWORK')
Duh, of course. I guess I need new glasses...
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
+ if not (
bb_task_networkor
the_data.getVarFlag(taskname, 'network', False)):Quoted 3 lines
I can't speak for others, but I find "not (foo or bar)" a lot harder to parse than "not foo and not bar".
Technically, the "not (foo or bar)" is slightly faster than "not foo and not bar" since the latter one requires more logical evaluates.
Somehow, I think you will find it hard to actually measure that time difference... ;) I tried, and in my testing the time to execute either statement was 0.07-0.12 μs, i.e., it was impossible to declare either as faster than the other.
Quoted 10 lines
// Robert
Quoted 8 lines
Quoted 6 lines
logger.debug("Attempting to disable network")bb.utils.disable_network(uid, gid)--
2.31.1//Peter
//Peter