diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-10-21 12:50:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-10-31 09:09:27 +0000 |
commit | f7b90ab3eaf832bd81f3efc1dab4dcf6863ac284 (patch) | |
tree | 1e75d2c8bd68630e3387cf6409774bf031a0fc4d /bitbake/lib | |
parent | 7226a1c6003ddc06af620026a212726d60eaf794 (diff) | |
download | poky-f7b90ab3eaf832bd81f3efc1dab4dcf6863ac284.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: 2a931d5e4ac092ce275f3a51e22b802689f511e6)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rwxr-xr-x | bitbake/lib/bb/main.py | 8 |
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") | |||
47 | class BBMainException(Exception): | 47 | class BBMainException(Exception): |
48 | pass | 48 | pass |
49 | 49 | ||
50 | class BBMainFatal(bb.BBHandledException): | ||
51 | pass | ||
52 | |||
50 | def present_options(optionlist): | 53 | def 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 | ||
492 | def lockBitbake(): | 497 | def 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 | ||