mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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>
This commit is contained in:
@@ -47,6 +47,9 @@ logger = logging.getLogger("BitBake")
|
|||||||
class BBMainException(Exception):
|
class BBMainException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class BBMainFatal(bb.BBHandledException):
|
||||||
|
pass
|
||||||
|
|
||||||
def present_options(optionlist):
|
def present_options(optionlist):
|
||||||
if len(optionlist) > 1:
|
if len(optionlist) > 1:
|
||||||
return ' or '.join([', '.join(optionlist[:-1]), optionlist[-1]])
|
return ' or '.join([', '.join(optionlist[:-1]), optionlist[-1]])
|
||||||
@@ -461,6 +464,8 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
|
|||||||
|
|
||||||
if server_connection or configParams.server_only:
|
if server_connection or configParams.server_only:
|
||||||
break
|
break
|
||||||
|
except BBMainFatal:
|
||||||
|
raise
|
||||||
except (Exception, bb.server.process.ProcessTimeout) as e:
|
except (Exception, bb.server.process.ProcessTimeout) as e:
|
||||||
if not retries:
|
if not retries:
|
||||||
raise
|
raise
|
||||||
@@ -491,6 +496,9 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
|
|||||||
|
|
||||||
def lockBitbake():
|
def lockBitbake():
|
||||||
topdir = bb.cookerdata.findTopdir()
|
topdir = bb.cookerdata.findTopdir()
|
||||||
|
if not topdir:
|
||||||
|
bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBAPTH is unset and/or not in a build directory?")
|
||||||
|
raise BBMainFatal
|
||||||
lockfile = topdir + "/bitbake.lock"
|
lockfile = topdir + "/bitbake.lock"
|
||||||
return topdir, bb.utils.lockfile(lockfile, False, False)
|
return topdir, bb.utils.lockfile(lockfile, False, False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user