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 | |
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>
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 6 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 2 |
2 files changed, 5 insertions, 3 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 | ||
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 5654f60f9e..d495ac6245 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -620,7 +620,7 @@ class BitBakeServer(object): | |||
620 | os.set_inheritable(self.bitbake_lock.fileno(), True) | 620 | os.set_inheritable(self.bitbake_lock.fileno(), True) |
621 | os.set_inheritable(self.readypipein, True) | 621 | os.set_inheritable(self.readypipein, True) |
622 | serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server") | 622 | serverscript = os.path.realpath(os.path.dirname(__file__) + "/../../../bin/bitbake-server") |
623 | os.execl(sys.executable, "bitbake-server", serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout or 0), str(int(self.profile)), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1])) | 623 | os.execl(sys.executable, sys.executable, serverscript, "decafbad", str(self.bitbake_lock.fileno()), str(self.readypipein), self.logfile, self.bitbake_lock.name, self.sockname, str(self.server_timeout or 0), str(int(self.profile)), str(self.xmlrpcinterface[0]), str(self.xmlrpcinterface[1])) |
624 | 624 | ||
625 | def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface, profile): | 625 | def execServer(lockfd, readypipeinfd, lockname, sockname, server_timeout, xmlrpcinterface, profile): |
626 | 626 | ||