summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-23 11:48:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-25 21:26:15 +0000
commit8e2bb3baf97751b7a984295737a5f543d2dc3b7d (patch)
tree3b9c6d94c362187f4ece472344fe325b0763b19c /bitbake
parent3e8e6700cc1e6842f1621f715b9dad1c529fda66 (diff)
downloadpoky-8e2bb3baf97751b7a984295737a5f543d2dc3b7d.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: 7c847b01c30fc42cc78244f00fdf5eaa7b5df716) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/prserv/serv.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index 1d9148b817..6d8142fcc4 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -450,29 +450,35 @@ class PRServiceConfigError(Exception):
450def auto_start(d): 450def auto_start(d):
451 global singleton 451 global singleton
452 452
453 # Shutdown any existing PR Server
454 auto_shutdown()
455
456 host_params = list(filter(None, (d.getVar('PRSERV_HOST') or '').split(':'))) 453 host_params = list(filter(None, (d.getVar('PRSERV_HOST') or '').split(':')))
457 if not host_params: 454 if not host_params:
455 # Shutdown any existing PR Server
456 auto_shutdown()
458 return None 457 return None
459 458
460 if len(host_params) != 2: 459 if len(host_params) != 2:
460 # Shutdown any existing PR Server
461 auto_shutdown()
461 logger.critical('\n'.join(['PRSERV_HOST: incorrect format', 462 logger.critical('\n'.join(['PRSERV_HOST: incorrect format',
462 'Usage: PRSERV_HOST = "<hostname>:<port>"'])) 463 'Usage: PRSERV_HOST = "<hostname>:<port>"']))
463 raise PRServiceConfigError 464 raise PRServiceConfigError
464 465
465 if is_local_special(host_params[0], int(host_params[1])) and not singleton: 466 if is_local_special(host_params[0], int(host_params[1])):
466 import bb.utils 467 import bb.utils
467 cachedir = (d.getVar("PERSISTENT_DIR") or d.getVar("CACHE")) 468 cachedir = (d.getVar("PERSISTENT_DIR") or d.getVar("CACHE"))
468 if not cachedir: 469 if not cachedir:
469 logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable") 470 logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable")
470 raise PRServiceConfigError 471 raise PRServiceConfigError
471 bb.utils.mkdirhier(cachedir)
472 dbfile = os.path.join(cachedir, "prserv.sqlite3") 472 dbfile = os.path.join(cachedir, "prserv.sqlite3")
473 logfile = os.path.join(cachedir, "prserv.log") 473 logfile = os.path.join(cachedir, "prserv.log")
474 singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0)) 474 if singleton:
475 singleton.start() 475 if singleton.dbfile != dbfile:
476 # Shutdown any existing PR Server as doesn't match config
477 auto_shutdown()
478 if not singleton:
479 bb.utils.mkdirhier(cachedir)
480 singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0))
481 singleton.start()
476 if singleton: 482 if singleton:
477 host, port = singleton.getinfo() 483 host, port = singleton.getinfo()
478 else: 484 else: