[bitbake-devel] [PATCH] cookerdata: print an error if layer dir does not exist

Markus Lehtonen markus.lehtonen at linux.intel.com
Wed May 25 09:04:47 UTC 2016


Hi Leonardo,

On Tue, 2016-05-24 at 09:09 -0500, Leonardo Sandoval wrote:
> 
> On 05/24/2016 02:25 AM, Markus Lehtonen wrote:
> > Makes it easier for user to identify problems, e.g. typos, in
> > BBLAYERS.
> > 
> > [YOCTO #9507]
> > 
> > Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
> > ---
> >   lib/bb/cookerdata.py | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
> > index 1615db5..7dfe7b5 100644
> > --- a/lib/bb/cookerdata.py
> > +++ b/lib/bb/cookerdata.py
> > @@ -292,6 +292,10 @@ class CookerDataBuilder(object):
> >               data = bb.data.createCopy(data)
> >               approved = bb.utils.approved_variables()
> >               for layer in layers:
> > +                if not os.path.isdir(layer):
> > +                    parselog.critical("Layer directory '%s' does
> > not to exist! "
> > +                                      "Please check BBLAYERS in
> > %s" % (layer, layerconf))
> > +                    sys.exit(1)
> 
> Markus, I am not familiar with this code, but instead of a
> sys.exit(1), 
> would it be better to raise a exception instead (raise
> SystemExit(msg))?
> 
> >                   parselog.debug(2, "Adding layer %s", layer)
> >                   if 'HOME' in approved and '~' in layer:
> >                       layer = os.path.expanduser(layer)
> 

The reason for this is that with SystemExit() the output will be much
uglier. Bitbake will not only print the error message but also all
logging debug messages and I think that this may confuse the user. The
output would look something like:
--- SNIP -----------------------------------------------------
Layer directory '#' does not to exist! Please check BBLAYERS in
/home/marquiz/yocto/openembedded-core/build-9507/conf/bblayers.conf
DEBUG: Removed the following variables from the environment: _,
LS_COLORS, EMAIL, JAVA_ROOT, LESS, G_BROKEN_FILENAMES, MINICOM,
CSHEDIT, HOSTTYPE, LESSOPEN, QT_SYSTEM_DIR, PYTHONSTARTUP, CVS_RSH,
GPG_AGENT_INFO, INPUTRC, XDG_VTNR, SOCKS_PROXY, CPU, QT_IM_SWITCHER,
XSESSION_IS_UP, AUDIODRIVER, LESSKEY, XDG_DATA_DIRS, XNLSPATH,
TERMINATOR_UUID, ALSA_CONFIG_PATH, HISTSIZE, SDL_AUDIODRIVER, WINDOWID,
LESS_ADVANCED_PREPROCESSOR, gopher_proxy, MANPATH, XMODIFIERS,
WINDOWPATH, JAVA_HOME, PROFILEREAD, XKEYSYMDB, VDPAU_DRIVER,
GIT_CEILING_DIRECTORIES, JAVA_BINDIR, XDG_RUNTIME_DIR, DISPLAY,
PYTHONPATH, COMP_WORDBREAKS, NNTPSERVER, XCURSOR_THEME,
DBUS_SESSION_BUS_PID, G_FILENAME_ENCODING, OSTYPE, HOST, FROM_HEADER,
LESSCLOSE, JRE_HOME, socks_proxy, LS_OPTIONS, GPG_TTY, XDG_SESSION_ID,
DBUS_SESSION_BUS_ADDRESS, ORBIT_SOCKETDIR, LANG, GTK_IM_MODULE,
CONFIG_SITE, XDG_CONFIG_DIRS, GTK_MODULES, SOCKS5_SERVER, XDG_SEAT,
OLDPWD, HOSTNAME, WINDOWMANAGER, INPUT_METHOD, SHLVL, QT_IM_MODULE,
COLORTERM, BUILDDIR, QEMU_AUDIO_DRV, MAIL, MACHTYPE, PAGER,
XAUTHLOCALHOSTNAME, MORE
DEBUG: Found bblayers.conf (/home/marquiz/yocto/openembedded-core/build
-9507/conf/bblayers.conf)
DEBUG: Adding layer /home/marquiz/yocto/openembedded-core/meta
--- SNIP -----------------------------------------------------


The reason for this behavior is that bitbake will spit out all log messages (even debug messages) if it exits at this early stage and there are no non-debug messages in the logger.


Thanks,
  Markus






More information about the bitbake-devel mailing list