1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

bitbake: cooker/hashserv: Allow autostarting of a local hash server using BB_HASHSERVE

Its useful, particularly in the local developer model of usage, for
bitbake to start and stop a hash equivalence server on local port,
rather than relying on one being started by the user before the build.

The new BB_HASHSERVE variable supports this.

The database handling is moved internally into the hashserv code so that
different threads/processes can be used for the server without errors.

(Bitbake rev: a4fa8f1bd88995ae60e10430316fbed63d478587)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2019-07-24 09:13:55 +01:00
parent d9aafb8507
commit ca04aaf7b5
6 changed files with 37 additions and 10 deletions
+4 -3
View File
@@ -11,14 +11,15 @@ import sqlite3
import hashlib
import urllib.request
import json
import tempfile
from . import create_server
class TestHashEquivalenceServer(unittest.TestCase):
def setUp(self):
# Start an in memory hash equivalence server in the background bound to
# Start a hash equivalence server in the background bound to
# an ephemeral port
db = sqlite3.connect(':memory:', check_same_thread=False)
self.server = create_server(('localhost', 0), db)
self.dbfile = tempfile.NamedTemporaryFile(prefix="bb-hashserv-db-")
self.server = create_server(('localhost', 0), self.dbfile.name)
self.server_addr = 'http://localhost:%d' % self.server.socket.getsockname()[1]
self.server_thread = threading.Thread(target=self.server.serve_forever)
self.server_thread.start()