diff options
author | Ross Burton <ross.burton@arm.com> | 2023-09-25 12:55:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-26 10:37:17 +0100 |
commit | 362c70a993ae954834a8deace68b3e4068282698 (patch) | |
tree | 32fbb49f1d3af22128482e2f029feced6e452c15 /bitbake/lib/bb/runqueue.py | |
parent | 0dbc45e52fea7e7733e863d6afc193f418d733ce (diff) | |
download | poky-362c70a993ae954834a8deace68b3e4068282698.tar.gz |
bitbake: bitbake/lib: spawn server/worker using the current Python interpreter
The user may have invoked ./bin/bitbake using a different Python
interpreter than whatever python3 is on $PATH (for example, explicitly
using a different version). However, as the server and workers are
spawned directly they'll use the hashbang and thus a different Python.
We also ensure that argv[0] is set to sys.executable instead of
'bitbake-server' or 'bitbake-worker', so that sys.executable is set to
the right value inside the child. Without this the server won't be
able to start any workers.
(Bitbake rev: b44d5d2a53d3082c8ce94e09c0cf833e33e25aec)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index c40a3be212..56147c50a8 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -1324,6 +1324,8 @@ class RunQueue: | |||
1324 | if self.cooker.configuration.profile: | 1324 | if self.cooker.configuration.profile: |
1325 | magic = "decafbadbad" | 1325 | magic = "decafbadbad" |
1326 | fakerootlogs = None | 1326 | fakerootlogs = None |
1327 | |||
1328 | workerscript = os.path.realpath(os.path.dirname(__file__) + "/../../bin/bitbake-worker") | ||
1327 | if fakeroot: | 1329 | if fakeroot: |
1328 | magic = magic + "beef" | 1330 | magic = magic + "beef" |
1329 | mcdata = self.cooker.databuilder.mcdata[mc] | 1331 | mcdata = self.cooker.databuilder.mcdata[mc] |
@@ -1332,10 +1334,10 @@ class RunQueue: | |||
1332 | env = os.environ.copy() | 1334 | env = os.environ.copy() |
1333 | for key, value in (var.split('=') for var in fakerootenv): | 1335 | for key, value in (var.split('=') for var in fakerootenv): |
1334 | env[key] = value | 1336 | env[key] = value |
1335 | worker = subprocess.Popen(fakerootcmd + ["bitbake-worker", magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE, env=env) | 1337 | worker = subprocess.Popen(fakerootcmd + [sys.executable, workerscript, magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE, env=env) |
1336 | fakerootlogs = self.rqdata.dataCaches[mc].fakerootlogs | 1338 | fakerootlogs = self.rqdata.dataCaches[mc].fakerootlogs |
1337 | else: | 1339 | else: |
1338 | worker = subprocess.Popen(["bitbake-worker", magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE) | 1340 | worker = subprocess.Popen([sys.executable, workerscript, magic], stdout=subprocess.PIPE, stdin=subprocess.PIPE) |
1339 | bb.utils.nonblockingfd(worker.stdout) | 1341 | bb.utils.nonblockingfd(worker.stdout) |
1340 | workerpipe = runQueuePipe(worker.stdout, None, self.cfgData, self, rqexec, fakerootlogs=fakerootlogs) | 1342 | workerpipe = runQueuePipe(worker.stdout, None, self.cfgData, self, rqexec, fakerootlogs=fakerootlogs) |
1341 | 1343 | ||