summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMingli Yu <mingli.yu@windriver.com>2021-08-31 15:48:07 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-02 12:05:07 +0100
commit6901cdbe20783b82127d3c32ea0961651efe76b9 (patch)
tree0baf78a33a2c117e33ba7be1d309b1e9786fcd64 /bitbake
parentb978f7c3a028ff4cc61de79d296723b5f873651d (diff)
downloadpoky-6901cdbe20783b82127d3c32ea0961651efe76b9.tar.gz
bitbake: prserv: make localhost work
After [1] introduced, the PR server doesn't work in docker when use below setting like before. PRSERV_HOST = "localhost:0" And it's because the localhost is resolved to an ipv6 address ::1 as the below bitbake-prserv shows. bitbake$ bitbake-prserv --start --host=localhost --port=42005 bitbake$ cat prserv.log Traceback (most recent call last): File "/OE/nodistro/honister/bitbake/bin/bitbake-prserv", line 55, in <module> ret = main() File "/OE/nodistro/honister/bitbake/bin/bitbake-prserv", line 46, in main ret=prserv.serv.start_daemon(options.dbfile, options.host, options.port,os.path.abspath(options.logfile), options.read_only) File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 226, in start_daemon run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile)) File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 202, in run_as_daemon func() File "/OE/nodistro/honister/bitbake/lib/prserv/serv.py", line 224, in daemon_main server.serve_forever() File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/serv.py", line 233, in serve_forever self.start() File "/OE/nodistro/honister/bitbake/lib/bb/asyncrpc/serv.py", line 144, in start_tcp self.server = self.loop.run_until_complete(server_coro) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/usr/lib/python3.8/asyncio/streams.py", line 94, in start_server return await loop.create_server(factory, host, port, **kwds) File "/usr/lib/python3.8/asyncio/base_events.py", line 1463, in create_server raise OSError(err.errno, 'error while attempting ' OSError: [Errno 99] error while attempting to bind on address ('::1', 42005, 0, 0): cannot assign requested address So add the extra logic to make the localhost resolved as expected to make the PR service work especially in docker. [1] 6a2b23e2 prserv: Replace XML RPC with modern asyncrpc implementation (Bitbake rev: 0a11696e0898c3c5108e6d7c5ad28da50e00ea66) Signed-off-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/prserv/serv.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index 68db3d3ec0..0a20b927c7 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -126,7 +126,7 @@ class PRServSingleton(object):
126 126
127 def start(self): 127 def start(self):
128 self.prserv = PRServer(self.dbfile) 128 self.prserv = PRServer(self.dbfile)
129 self.prserv.start_tcp_server(self.host, self.port) 129 self.prserv.start_tcp_server(socket.gethostbyname(self.host), self.port)
130 self.process = self.prserv.serve_as_process() 130 self.process = self.prserv.serve_as_process()
131 131
132 if not self.prserv.address: 132 if not self.prserv.address:
@@ -221,7 +221,7 @@ def start_daemon(dbfile, host, port, logfile, read_only=False):
221 dbfile = os.path.abspath(dbfile) 221 dbfile = os.path.abspath(dbfile)
222 def daemon_main(): 222 def daemon_main():
223 server = PRServer(dbfile, read_only=read_only) 223 server = PRServer(dbfile, read_only=read_only)
224 server.start_tcp_server(host, port) 224 server.start_tcp_server(ip, port)
225 server.serve_forever() 225 server.serve_forever()
226 226
227 run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile)) 227 run_as_daemon(daemon_main, pidfile, os.path.abspath(logfile))