summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-21 12:50:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-31 09:09:21 +0000
commit5dacc5516718efdf0a470e074a5c05b1ecf8cc15 (patch)
treed94044d3f204c2b59cb9cafe706190ea3efda963 /bitbake
parent800e9a50594d6992e1515b14fdd657afe6f7c066 (diff)
downloadpoky-5dacc5516718efdf0a470e074a5c05b1ecf8cc15.tar.gz
bitbake: main: Give a user readable error if we can't locate topdir
Currently if you run bitbake in an invalid directory, the user experience is poor: birbake/lib/bb/main.py", line 427, in setup_bitbake topdir, lock = lockBitbake() File "./bitbake/lib/bb/main.py", line 494, in lockBitbake lockfile = topdir + "/bitbake.lock" TypeError: unsupported operand type(s) for +: 'NoneType' and 'str' This ensures we exit straight away with a better error message. [YOCTO #12163] (Bitbake rev: 562f9ee674a8b392437096422b9cceab9c3cba2e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/lib/bb/main.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index a488c3d18e..7711b290de 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -47,6 +47,9 @@ logger = logging.getLogger("BitBake")
47class BBMainException(Exception): 47class BBMainException(Exception):
48 pass 48 pass
49 49
50class BBMainFatal(bb.BBHandledException):
51 pass
52
50def present_options(optionlist): 53def present_options(optionlist):
51 if len(optionlist) > 1: 54 if len(optionlist) > 1:
52 return ' or '.join([', '.join(optionlist[:-1]), optionlist[-1]]) 55 return ' or '.join([', '.join(optionlist[:-1]), optionlist[-1]])
@@ -461,6 +464,8 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
461 464
462 if server_connection or configParams.server_only: 465 if server_connection or configParams.server_only:
463 break 466 break
467 except BBMainFatal:
468 raise
464 except (Exception, bb.server.process.ProcessTimeout) as e: 469 except (Exception, bb.server.process.ProcessTimeout) as e:
465 if not retries: 470 if not retries:
466 raise 471 raise
@@ -491,6 +496,9 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
491 496
492def lockBitbake(): 497def lockBitbake():
493 topdir = bb.cookerdata.findTopdir() 498 topdir = bb.cookerdata.findTopdir()
499 if not topdir:
500 bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBAPTH is unset and/or not in a build directory?")
501 raise BBMainFatal
494 lockfile = topdir + "/bitbake.lock" 502 lockfile = topdir + "/bitbake.lock"
495 return topdir, bb.utils.lockfile(lockfile, False, False) 503 return topdir, bb.utils.lockfile(lockfile, False, False)
496 504