diff options
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 1d9148b817..6d8142fcc4 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
@@ -450,29 +450,35 @@ class PRServiceConfigError(Exception): | |||
450 | def auto_start(d): | 450 | def 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: |