All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cookerdata: print an error if layer dir does not exist
@ 2016-05-24  7:25 Markus Lehtonen
  2016-05-24 14:09 ` Leonardo Sandoval
  2016-05-25  9:57 ` Peter Kjellerstedt
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Lehtonen @ 2016-05-24  7:25 UTC (permalink / raw)
  To: bitbake-devel

Makes it easier for user to identify problems, e.g. typos, in BBLAYERS.

[YOCTO #9507]

Signed-off-by: Markus Lehtonen <markus.lehtonen@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)
                 parselog.debug(2, "Adding layer %s", layer)
                 if 'HOME' in approved and '~' in layer:
                     layer = os.path.expanduser(layer)
-- 
2.6.6



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cookerdata: print an error if layer dir does not exist
  2016-05-24  7:25 [PATCH] cookerdata: print an error if layer dir does not exist Markus Lehtonen
@ 2016-05-24 14:09 ` Leonardo Sandoval
  2016-05-25  9:04   ` Markus Lehtonen
  2016-05-25  9:57 ` Peter Kjellerstedt
  1 sibling, 1 reply; 4+ messages in thread
From: Leonardo Sandoval @ 2016-05-24 14:09 UTC (permalink / raw)
  To: Markus Lehtonen, bitbake-devel



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@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)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cookerdata: print an error if layer dir does not exist
  2016-05-24 14:09 ` Leonardo Sandoval
@ 2016-05-25  9:04   ` Markus Lehtonen
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Lehtonen @ 2016-05-25  9:04 UTC (permalink / raw)
  To: Leonardo Sandoval, bitbake-devel

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@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cookerdata: print an error if layer dir does not exist
  2016-05-24  7:25 [PATCH] cookerdata: print an error if layer dir does not exist Markus Lehtonen
  2016-05-24 14:09 ` Leonardo Sandoval
@ 2016-05-25  9:57 ` Peter Kjellerstedt
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2016-05-25  9:57 UTC (permalink / raw)
  To: Markus Lehtonen; +Cc: bitbake-devel@lists.openembedded.org

> -----Original Message-----
> From: bitbake-devel-bounces@lists.openembedded.org [mailto:bitbake-
> devel-bounces@lists.openembedded.org] On Behalf Of Markus Lehtonen
> Sent: den 24 maj 2016 09:26
> To: bitbake-devel@lists.openembedded.org
> Subject: [bitbake-devel] [PATCH] cookerdata: print an error if layer
> dir does not exist
> 
> Makes it easier for user to identify problems, e.g. typos, in BBLAYERS.
> 
> [YOCTO #9507]
> 
> Signed-off-by: Markus Lehtonen <markus.lehtonen@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! "
                                                                        ^^
Change "not to exist" to "not exist".

> +                                      "Please check BBLAYERS in %s" % (layer, layerconf))
> +                    sys.exit(1)
>                  parselog.debug(2, "Adding layer %s", layer)
>                  if 'HOME' in approved and '~' in layer:
>                      layer = os.path.expanduser(layer)
> --
> 2.6.6

//Peter



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-05-25  9:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-24  7:25 [PATCH] cookerdata: print an error if layer dir does not exist Markus Lehtonen
2016-05-24 14:09 ` Leonardo Sandoval
2016-05-25  9:04   ` Markus Lehtonen
2016-05-25  9:57 ` Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.