diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-23 11:48:31 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-25 17:58:11 +0000 |
commit | 5ec9511400abc4e3a6c416727a32e326a7d3daae (patch) | |
tree | bd72295c8d931fe6f7b687f0bee0f71563483ee8 /bitbake/lib/prserv | |
parent | 19388a6922e04219d2b218963b56df220fd4b92a (diff) | |
download | poky-5ec9511400abc4e3a6c416727a32e326a7d3daae.tar.gz |
bitbake: prserv/serv: Only restart the server if settings change
The server is now restarting when running commands which doesn't make
sense. Only restart if its configuration has changed. This should
potentially fix various memory resident bitbake usages too.
(Bitbake rev: 0d2c67abf8c92386802eccfbb6b124dd65597941)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/prserv')
-rw-r--r-- | bitbake/lib/prserv/serv.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py index b854ba14b7..3124b07992 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
@@ -449,29 +449,35 @@ class PRServiceConfigError(Exception): | |||
449 | def auto_start(d): | 449 | def auto_start(d): |
450 | global singleton | 450 | global singleton |
451 | 451 | ||
452 | # Shutdown any existing PR Server | ||
453 | auto_shutdown() | ||
454 | |||
455 | host_params = list(filter(None, (d.getVar('PRSERV_HOST') or '').split(':'))) | 452 | host_params = list(filter(None, (d.getVar('PRSERV_HOST') or '').split(':'))) |
456 | if not host_params: | 453 | if not host_params: |
454 | # Shutdown any existing PR Server | ||
455 | auto_shutdown() | ||
457 | return None | 456 | return None |
458 | 457 | ||
459 | if len(host_params) != 2: | 458 | if len(host_params) != 2: |
459 | # Shutdown any existing PR Server | ||
460 | auto_shutdown() | ||
460 | logger.critical('\n'.join(['PRSERV_HOST: incorrect format', | 461 | logger.critical('\n'.join(['PRSERV_HOST: incorrect format', |
461 | 'Usage: PRSERV_HOST = "<hostname>:<port>"'])) | 462 | 'Usage: PRSERV_HOST = "<hostname>:<port>"'])) |
462 | raise PRServiceConfigError | 463 | raise PRServiceConfigError |
463 | 464 | ||
464 | if is_local_special(host_params[0], int(host_params[1])) and not singleton: | 465 | if is_local_special(host_params[0], int(host_params[1])): |
465 | import bb.utils | 466 | import bb.utils |
466 | cachedir = (d.getVar("PERSISTENT_DIR") or d.getVar("CACHE")) | 467 | cachedir = (d.getVar("PERSISTENT_DIR") or d.getVar("CACHE")) |
467 | if not cachedir: | 468 | if not cachedir: |
468 | logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable") | 469 | logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable") |
469 | raise PRServiceConfigError | 470 | raise PRServiceConfigError |
470 | bb.utils.mkdirhier(cachedir) | ||
471 | dbfile = os.path.join(cachedir, "prserv.sqlite3") | 471 | dbfile = os.path.join(cachedir, "prserv.sqlite3") |
472 | logfile = os.path.join(cachedir, "prserv.log") | 472 | logfile = os.path.join(cachedir, "prserv.log") |
473 | singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0)) | 473 | if singleton: |
474 | singleton.start() | 474 | if singleton.dbfile != dbfile: |
475 | # Shutdown any existing PR Server as doesn't match config | ||
476 | auto_shutdown() | ||
477 | if not singleton: | ||
478 | bb.utils.mkdirhier(cachedir) | ||
479 | singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0)) | ||
480 | singleton.start() | ||
475 | if singleton: | 481 | if singleton: |
476 | host, port = singleton.getinfo() | 482 | host, port = singleton.getinfo() |
477 | else: | 483 | else: |