diff options
Diffstat (limited to 'bitbake')
-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: |