[oe-commits] [bitbake] 02/02: main: Give a user readable error if we can't locate topdir

git at git.openembedded.org git at git.openembedded.org
Tue Oct 24 13:56:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit a6da63869fd581baffbb3401e614d2978fa7e529
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Sat Oct 21 12:50:07 2017 +0100

    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]
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/main.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/bb/main.py b/lib/bb/main.py
index a488c3d..7711b29 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -47,6 +47,9 @@ logger = logging.getLogger("BitBake")
 class BBMainException(Exception):
     pass
 
+class BBMainFatal(bb.BBHandledException):
+    pass
+
 def present_options(optionlist):
     if len(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:
                     break
+            except BBMainFatal:
+                raise
             except (Exception, bb.server.process.ProcessTimeout) as e:
                 if not retries:
                     raise
@@ -491,6 +496,9 @@ def setup_bitbake(configParams, configuration, extrafeatures=None):
 
 def lockBitbake():
     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"
     return topdir, bb.utils.lockfile(lockfile, False, False)
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list