Message ID | 20220810134337.420149-1-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | f7c55c8147329670fd5bc55b1ae3f47f25b89bab |
Headers | show |
Series | [1/3] BBHandler: Allow earlier exit for classes not found | expand |
I seeing % bitbake binutils WARNING: ['base', 'sanity-meta-odroid-extras', 'clang', 'report-error', 'image-buildinfo', 'package_ipk', 'buildhistory', 'buildstats', 'buildstats-summary', 'debian', 'devshell', 'sstate', 'license', 'remove-libtool', 'sanity'] ERROR: ParseError at /mnt/b/yoe/master/sources/openembedded-core/meta/classes/buildhistory.bbclass:10: Could not inherit file classes/image-artifact-names.bbclass On Wed, Aug 10, 2022 at 6:43 AM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > Rather than relying on later code to error if the class isn't found, > exit earlier and more clearly from a code perspective. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > lib/bb/parse/parse_py/BBHandler.py | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py > index 68415735fd..532a4e08f1 100644 > --- a/lib/bb/parse/parse_py/BBHandler.py > +++ b/lib/bb/parse/parse_py/BBHandler.py > @@ -56,6 +56,9 @@ def inherit(files, fn, lineno, d): > if abs_fn: > file = abs_fn > > + if not os.path.exists(file): > + raise ParseError("Could not inherit file %s" % (file), fn, lineno) > + > if not file in __inherit_cache: > logger.debug("Inheriting %s (from %s:%d)" % (file, fn, lineno)) > __inherit_cache.append( file ) > -- > 2.34.1 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13880): https://lists.openembedded.org/g/bitbake-devel/message/13880 > Mute This Topic: https://lists.openembedded.org/mt/92936457/1997914 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On Wed, 2022-08-10 at 08:55 -0700, Khem Raj wrote: > I seeing > > % bitbake binutils > WARNING: ['base', 'sanity-meta-odroid-extras', 'clang', > 'report-error', 'image-buildinfo', 'package_ipk', 'buildhistory', > 'buildstats', 'buildstats-summary', 'debian', 'devshell', 'sstate', > 'license', 'remove-libtool', 'sanity'] > ERROR: ParseError at > /mnt/b/yoe/master/sources/openembedded-core/meta/classes/buildhistory.bbclass:10: > Could not inherit file classes/image-artifact-names.bbclass I think we need something like: diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 4345ffc6939..203310ba975 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -7,7 +7,7 @@ # Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> # -inherit image-artifact-names +IMAGE_CLASSES += "image-artifact-names" BUILDHISTORY_FEATURES ?= "image package sdk" BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" Does that help? I need to remove that warning too! Although it does help debugging right now. Cheers, Richard
Can we not make the inherit command adapt to current inherit context, global or recipe? On Wed, Aug 10, 2022 at 9:19 AM Richard Purdie < richard.purdie@linuxfoundation.org> wrote: > On Wed, 2022-08-10 at 08:55 -0700, Khem Raj wrote: > > I seeing > > > > % bitbake binutils > > WARNING: ['base', 'sanity-meta-odroid-extras', 'clang', > > 'report-error', 'image-buildinfo', 'package_ipk', 'buildhistory', > > 'buildstats', 'buildstats-summary', 'debian', 'devshell', 'sstate', > > 'license', 'remove-libtool', 'sanity'] > > ERROR: ParseError at > > > /mnt/b/yoe/master/sources/openembedded-core/meta/classes/buildhistory.bbclass:10: > > Could not inherit file classes/image-artifact-names.bbclass > > I think we need something like: > > diff --git a/meta/classes/buildhistory.bbclass > b/meta/classes/buildhistory.bbclass > index 4345ffc6939..203310ba975 100644 > --- a/meta/classes/buildhistory.bbclass > +++ b/meta/classes/buildhistory.bbclass > @@ -7,7 +7,7 @@ > # Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> > # > > -inherit image-artifact-names > +IMAGE_CLASSES += "image-artifact-names" > > BUILDHISTORY_FEATURES ?= "image package sdk" > BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" > > Does that help? > > I need to remove that warning too! Although it does help debugging right > now. > > Cheers, > > Richard > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#13888): > https://lists.openembedded.org/g/bitbake-devel/message/13888 > Mute This Topic: https://lists.openembedded.org/mt/92936457/3617123 > Group Owner: bitbake-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ > kergoth@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
On Wed, 2022-08-10 at 09:27 -0700, Christopher Larson wrote: > Can we not make the inherit command adapt to current inherit context, > global or recipe? The issue is that I'd made image-artifact-names a recipes class in OE- Core and it was trying to be pulled into the global space via buildhistory. Either we accept it as a global class and change some of the users, or we make it image specific as I'm proposing in the patch. Cheers, Richard > On Wed, Aug 10, 2022 at 9:19 AM Richard Purdie > <richard.purdie@linuxfoundation.org> wrote: > > On Wed, 2022-08-10 at 08:55 -0700, Khem Raj wrote: > > > I seeing > > > > > > % bitbake binutils > > > WARNING: ['base', 'sanity-meta-odroid-extras', 'clang', > > > 'report-error', 'image-buildinfo', 'package_ipk', 'buildhistory', > > > 'buildstats', 'buildstats-summary', 'debian', 'devshell', > > > 'sstate', > > > 'license', 'remove-libtool', 'sanity'] > > > ERROR: ParseError at > > > /mnt/b/yoe/master/sources/openembedded- > > > core/meta/classes/buildhistory.bbclass:10: > > > Could not inherit file classes/image-artifact-names.bbclass > > > > I think we need something like: > > > > diff --git a/meta/classes/buildhistory.bbclass > > b/meta/classes/buildhistory.bbclass > > index 4345ffc6939..203310ba975 100644 > > --- a/meta/classes/buildhistory.bbclass > > +++ b/meta/classes/buildhistory.bbclass > > @@ -7,7 +7,7 @@ > > # Copyright (C) 2007-2011 Koen Kooi <koen@openembedded.org> > > # > > > > -inherit image-artifact-names > > +IMAGE_CLASSES += "image-artifact-names" > > > > BUILDHISTORY_FEATURES ?= "image package sdk" > > BUILDHISTORY_DIR ?= "${TOPDIR}/buildhistory" > > > > Does that help? > > > > I need to remove that warning too! Although it does help debugging > > right now. > > > > Cheers, > > > > Richard > > > > -=-=-=-=-=-=-=-=-=-=-=- > > Links: You receive all messages sent to this group. > > View/Reply Online (#13888): > > https://lists.openembedded.org/g/bitbake-devel/message/13888 > > Mute This Topic: https://lists.openembedded.org/mt/92936457/3617123 > > Group Owner: bitbake-devel+owner@lists.openembedded.org > > Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub > > [kergoth@gmail.com] > > -=-=-=-=-=-=-=-=-=-=-=- > > > >
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py index 68415735fd..532a4e08f1 100644 --- a/lib/bb/parse/parse_py/BBHandler.py +++ b/lib/bb/parse/parse_py/BBHandler.py @@ -56,6 +56,9 @@ def inherit(files, fn, lineno, d): if abs_fn: file = abs_fn + if not os.path.exists(file): + raise ParseError("Could not inherit file %s" % (file), fn, lineno) + if not file in __inherit_cache: logger.debug("Inheriting %s (from %s:%d)" % (file, fn, lineno)) __inherit_cache.append( file )
Rather than relying on later code to error if the class isn't found, exit earlier and more clearly from a code perspective. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/parse/parse_py/BBHandler.py | 3 +++ 1 file changed, 3 insertions(+)