summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-20 16:20:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-20 23:58:05 +0100
commitc0c46125b6a392fd3f1f0f6cae83fedb2c86acc8 (patch)
tree458b9e0799b8e70a69c9937391b03084bdd19a2d /bitbake
parent2d31fa1a7fb99dc321fb224b3108d0ba09f884c6 (diff)
downloadpoky-c0c46125b6a392fd3f1f0f6cae83fedb2c86acc8.tar.gz
bitbake: prserv/cooker: Handle PRService errors cleanly
Current if the PR Service fails to start, bitbake carries on regardless or hangs with no error message. This adds an exception and then handles it correctly so the UIs correctly handle the error and exit cleanly. [YOCTO #4010] (Bitbake master rev: 949c01228a977c3b92bfc0802f6c71b40d8e05b3) (Bitbake rev: c21c3fd3adc7bbbd7018a03e99f058b05bec10b2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/cooker.py5
-rw-r--r--bitbake/lib/prserv/serv.py9
2 files changed, 10 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index c7c2ca6483..2c54209f89 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1486,7 +1486,10 @@ class BBCooker:
1486 # Empty the environment. The environment will be populated as 1486 # Empty the environment. The environment will be populated as
1487 # necessary from the data store. 1487 # necessary from the data store.
1488 #bb.utils.empty_environment() 1488 #bb.utils.empty_environment()
1489 prserv.serv.auto_start(self.configuration.data) 1489 try:
1490 prserv.serv.auto_start(self.configuration.data)
1491 except prserv.serv.PRServiceConfigError:
1492 bb.event.fire(CookerExit(), self.configuration.event_data)
1490 return 1493 return
1491 1494
1492 def post_serve(self): 1495 def post_serve(self):
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index 3489200536..6132100eed 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -263,6 +263,9 @@ def is_local_special(host, port):
263 else: 263 else:
264 return False 264 return False
265 265
266class PRServiceConfigError(Exception):
267 pass
268
266def auto_start(d): 269def auto_start(d):
267 global singleton 270 global singleton
268 271
@@ -273,14 +276,14 @@ def auto_start(d):
273 if len(host_params) != 2: 276 if len(host_params) != 2:
274 logger.critical('\n'.join(['PRSERV_HOST: incorrect format', 277 logger.critical('\n'.join(['PRSERV_HOST: incorrect format',
275 'Usage: PRSERV_HOST = "<hostname>:<port>"'])) 278 'Usage: PRSERV_HOST = "<hostname>:<port>"']))
276 return True 279 raise PRServiceConfigError
277 280
278 if is_local_special(host_params[0], int(host_params[1])) and not singleton: 281 if is_local_special(host_params[0], int(host_params[1])) and not singleton:
279 import bb.utils 282 import bb.utils
280 cachedir = (d.getVar("PERSISTENT_DIR", True) or d.getVar("CACHE", True)) 283 cachedir = (d.getVar("PERSISTENT_DIR", True) or d.getVar("CACHE", True))
281 if not cachedir: 284 if not cachedir:
282 logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable") 285 logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable")
283 sys.exit(1) 286 raise PRServiceConfigError
284 bb.utils.mkdirhier(cachedir) 287 bb.utils.mkdirhier(cachedir)
285 dbfile = os.path.join(cachedir, "prserv.sqlite3") 288 dbfile = os.path.join(cachedir, "prserv.sqlite3")
286 logfile = os.path.join(cachedir, "prserv.log") 289 logfile = os.path.join(cachedir, "prserv.log")
@@ -296,7 +299,7 @@ def auto_start(d):
296 return PRServerConnection(host,port).ping() 299 return PRServerConnection(host,port).ping()
297 except Exception: 300 except Exception:
298 logger.critical("PRservice %s:%d not available" % (host, port)) 301 logger.critical("PRservice %s:%d not available" % (host, port))
299 return False 302 raise PRServiceConfigError
300 303
301def auto_shutdown(d=None): 304def auto_shutdown(d=None):
302 global singleton 305 global singleton