summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-21 17:38:30 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-12 21:10:24 +0000
commit607f7b28443ec2c1f95f7c8eb7193b1159d29fc0 (patch)
treee8e2f39a12e9bdc07c4c6e16c7e1d832d2262f72 /bitbake
parent60d25f278c9cc4d6288166aba4b5c8927d32f84c (diff)
downloadpoky-607f7b28443ec2c1f95f7c8eb7193b1159d29fc0.tar.gz
bitbake: bitbake-worker: Add/support network task flag
This patch changes behaviour. After this change any task which does not have the network flag set will have networking disabled on systems that support that (kernel version dependent). Add a "network" task specific flag which then triggers networking to be enabled for this task, it is otherwise disabled. This needs to happen before we enter the fakeroot environment of the task due to the need for the real uid/gid which we save in the parent process. (Bitbake rev: 0746b6a2a32fec4c18bf1a52b1454ca4c04bf543) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/bitbake-worker8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index bf96207edc..3aaf3c2444 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -152,6 +152,10 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
152 fakeenv = {} 152 fakeenv = {}
153 umask = None 153 umask = None
154 154
155 uid = os.getuid()
156 gid = os.getgid()
157
158
155 taskdep = workerdata["taskdeps"][fn] 159 taskdep = workerdata["taskdeps"][fn]
156 if 'umask' in taskdep and taskname in taskdep['umask']: 160 if 'umask' in taskdep and taskname in taskdep['umask']:
157 umask = taskdep['umask'][taskname] 161 umask = taskdep['umask'][taskname]
@@ -257,6 +261,10 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
257 261
258 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", ""))) 262 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
259 263
264 if not the_data.getVarFlag(taskname, 'network', False):
265 logger.debug("Attempting to disable network")
266 bb.utils.disable_network(uid, gid)
267
260 # exported_vars() returns a generator which *cannot* be passed to os.environ.update() 268 # exported_vars() returns a generator which *cannot* be passed to os.environ.update()
261 # successfully. We also need to unset anything from the environment which shouldn't be there 269 # successfully. We also need to unset anything from the environment which shouldn't be there
262 exports = bb.data.exported_vars(the_data) 270 exports = bb.data.exported_vars(the_data)