All of lore.kernel.org
 help / color / mirror / Atom feed
* (morty) Python exception during rootfs
@ 2017-02-07 14:21 Mike Looijmans
  2017-02-07 16:08 ` Mike Looijmans
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mike Looijmans @ 2017-02-07 14:21 UTC (permalink / raw)
  To: OE-core

I get this stacktrace from bitbake. No idea what's wrong. Apparently, 
d.getVarFlags(func) returns None and the code cannot handle that. Is this a 
bug in bitbake, or should 'flags' never evaluate to None?



The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
      0001:
  *** 0002:do_rootfs(d)
      0003:
File: '/home/mike/projects/zynq-platform/oe-core/meta/classes/image.bbclass', 
lineno: 249, function: do_rootfs
      0245:
      0246:    progress_reporter.next_stage()
      0247:
      0248:    # generate rootfs
  *** 0249:    create_rootfs(d, progress_reporter=progress_reporter)
      0250:
      0251:    progress_reporter.finish()
      0252:}
      0253:do_rootfs[dirs] = "${TOPDIR}"
File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/rootfs.py', 
lineno: 1006, function: create_rootfs
      1002:    img_type = d.getVar('IMAGE_PKGTYPE', True)
      1003:    if img_type == "rpm":
      1004:        RpmRootfs(d, manifest_dir, progress_reporter).create()
      1005:    elif img_type == "ipk":
  *** 1006:        OpkgRootfs(d, manifest_dir, progress_reporter).create()
      1007:    elif img_type == "deb":
      1008:        DpkgRootfs(d, manifest_dir, progress_reporter).create()
      1009:
      1010:    os.environ.clear()
File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/rootfs.py', 
lineno: 210, function: create
      0206:        execute_pre_post_process(self.d, rootfs_post_install_cmds)
      0207:
      0208:        self._run_intercepts()
      0209:
  *** 0210:        execute_pre_post_process(self.d, post_process_cmds)
      0211:
      0212:        if self.progress_reporter:
      0213:            self.progress_reporter.next_stage()
      0214:
File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/utils.py', 
lineno: 176, function: execute_pre_post_process
      0172:    for cmd in cmds.strip().split(';'):
      0173:        cmd = cmd.strip()
      0174:        if cmd != '':
      0175:            bb.note("Executing %s ..." % cmd)
  *** 0176:            bb.build.exec_func(cmd, d)
      0177:
      0178:def multiprocess_exec(commands, function):
      0179:    import signal
      0180:    import multiprocessing
File: '/home/mike/projects/zynq-platform/bitbake/lib/bb/build.py', lineno: 
197, function: exec_func
      0193:    except:
      0194:        oldcwd = None
      0195:
      0196:    flags = d.getVarFlags(func)
  *** 0197:    cleandirs = flags.get('cleandirs')
      0198:    if cleandirs:
      0199:        for cdir in d.expand(cleandirs).split():
      0200:            bb.utils.remove(cdir, True)
      0201:            bb.utils.mkdirhier(cdir)
Exception: AttributeError: 'NoneType' object has no attribute 'get'

ERROR: pr-demo-image-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: 
/home/mike/projects/zynq-platform/build/tmp-glibc/work/topic_miami_florida_gen-oe-linux-gnueabi/pr-demo-image/1.0-r0/temp/log.do_rootfs.28716
ERROR: Task 
(/home/mike/projects/zynq-platform/meta-topic-internal/recipes-topic/embedded-world/pr-demo-image.bb:do_rootfs) 
failed with exit code '1'





Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail







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

* Re: (morty) Python exception during rootfs
  2017-02-07 14:21 (morty) Python exception during rootfs Mike Looijmans
@ 2017-02-07 16:08 ` Mike Looijmans
  2017-02-08  8:29   ` Patrick Ohly
  2017-02-08  6:17 ` [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist Mike Looijmans
  2017-02-08  6:29 ` ✗ patchtest: failure for " Patchwork
  2 siblings, 1 reply; 6+ messages in thread
From: Mike Looijmans @ 2017-02-07 16:08 UTC (permalink / raw)
  To: openembedded-core

Found it. A rootfs post-process function was misspelled, and that caused it.

I'll make a patch to improve the error message here, to make it just say that 
it cannot find "func".


On 07-02-17 15:21, Mike Looijmans wrote:
> I get this stacktrace from bitbake. No idea what's wrong. Apparently,
> d.getVarFlags(func) returns None and the code cannot handle that. Is this a
> bug in bitbake, or should 'flags' never evaluate to None?
>
>
>
> The stack trace of python calls that resulted in this exception/failure was:
> File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
>      0001:
>  *** 0002:do_rootfs(d)
>      0003:
> File: '/home/mike/projects/zynq-platform/oe-core/meta/classes/image.bbclass',
> lineno: 249, function: do_rootfs
>      0245:
>      0246:    progress_reporter.next_stage()
>      0247:
>      0248:    # generate rootfs
>  *** 0249:    create_rootfs(d, progress_reporter=progress_reporter)
>      0250:
>      0251:    progress_reporter.finish()
>      0252:}
>      0253:do_rootfs[dirs] = "${TOPDIR}"
> File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/rootfs.py',
> lineno: 1006, function: create_rootfs
>      1002:    img_type = d.getVar('IMAGE_PKGTYPE', True)
>      1003:    if img_type == "rpm":
>      1004:        RpmRootfs(d, manifest_dir, progress_reporter).create()
>      1005:    elif img_type == "ipk":
>  *** 1006:        OpkgRootfs(d, manifest_dir, progress_reporter).create()
>      1007:    elif img_type == "deb":
>      1008:        DpkgRootfs(d, manifest_dir, progress_reporter).create()
>      1009:
>      1010:    os.environ.clear()
> File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/rootfs.py',
> lineno: 210, function: create
>      0206:        execute_pre_post_process(self.d, rootfs_post_install_cmds)
>      0207:
>      0208:        self._run_intercepts()
>      0209:
>  *** 0210:        execute_pre_post_process(self.d, post_process_cmds)
>      0211:
>      0212:        if self.progress_reporter:
>      0213:            self.progress_reporter.next_stage()
>      0214:
> File: '/home/mike/projects/zynq-platform/oe-core/meta/lib/oe/utils.py',
> lineno: 176, function: execute_pre_post_process
>      0172:    for cmd in cmds.strip().split(';'):
>      0173:        cmd = cmd.strip()
>      0174:        if cmd != '':
>      0175:            bb.note("Executing %s ..." % cmd)
>  *** 0176:            bb.build.exec_func(cmd, d)
>      0177:
>      0178:def multiprocess_exec(commands, function):
>      0179:    import signal
>      0180:    import multiprocessing
> File: '/home/mike/projects/zynq-platform/bitbake/lib/bb/build.py', lineno:
> 197, function: exec_func
>      0193:    except:
>      0194:        oldcwd = None
>      0195:
>      0196:    flags = d.getVarFlags(func)
>  *** 0197:    cleandirs = flags.get('cleandirs')
>      0198:    if cleandirs:
>      0199:        for cdir in d.expand(cleandirs).split():
>      0200:            bb.utils.remove(cdir, True)
>      0201:            bb.utils.mkdirhier(cdir)
> Exception: AttributeError: 'NoneType' object has no attribute 'get'
>
> ERROR: pr-demo-image-1.0-r0 do_rootfs: Function failed: do_rootfs
> ERROR: Logfile of failure stored in:
> /home/mike/projects/zynq-platform/build/tmp-glibc/work/topic_miami_florida_gen-oe-linux-gnueabi/pr-demo-image/1.0-r0/temp/log.do_rootfs.28716
>
> ERROR: Task
> (/home/mike/projects/zynq-platform/meta-topic-internal/recipes-topic/embedded-world/pr-demo-image.bb:do_rootfs)
> failed with exit code '1'
>
>
>
>
>
> Kind regards,
>
> Mike Looijmans
> System Expert
>
> TOPIC Products
> Materiaalweg 4, NL-5681 RJ Best
> Postbus 440, NL-5680 AK Best
> Telefoon: +31 (0) 499 33 69 79
> E-mail: mike.looijmans@topicproducts.com
> Website: www.topicproducts.com
>
> Please consider the environment before printing this e-mail
>
>
>
>
>



Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans@topicproducts.com
Website: www.topicproducts.com

Please consider the environment before printing this e-mail







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

* [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist
  2017-02-07 14:21 (morty) Python exception during rootfs Mike Looijmans
  2017-02-07 16:08 ` Mike Looijmans
@ 2017-02-08  6:17 ` Mike Looijmans
  2017-02-08 22:10   ` Paul Eggleton
  2017-02-08  6:29 ` ✗ patchtest: failure for " Patchwork
  2 siblings, 1 reply; 6+ messages in thread
From: Mike Looijmans @ 2017-02-08  6:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: Mike Looijmans

If one adds the following line to an image recipe without defining
the function:
ROOTFS_POSTPROCESS_COMMAND += "rootfs_funky_stuff;"
bitbake will terminate with a cryptic error message:
AttributeError: 'NoneType' object has no attribute 'get'

To inform the user of what bitbake wasn't able to find, raise a KeyError
exception denoting the function name before that happens. This changes the
message to the much more useful:
KeyError: 'rootfs_funky_stuff'

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
---
 lib/bb/build.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/bb/build.py b/lib/bb/build.py
index c4c8aeb..5bc18c1 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -194,6 +194,8 @@ def exec_func(func, d, dirs = None, pythonexception=False):
         oldcwd = None
 
     flags = d.getVarFlags(func)
+    if flags is None:
+        raise KeyError(func)
     cleandirs = flags.get('cleandirs')
     if cleandirs:
         for cdir in d.expand(cleandirs).split():
-- 
1.9.1



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

* ✗ patchtest: failure for lib/bb/build.py: Raise proper KeyError if function does not exist
  2017-02-07 14:21 (morty) Python exception during rootfs Mike Looijmans
  2017-02-07 16:08 ` Mike Looijmans
  2017-02-08  6:17 ` [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist Mike Looijmans
@ 2017-02-08  6:29 ` Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-02-08  6:29 UTC (permalink / raw)
  To: mike.looijmans; +Cc: openembedded-core

== Series Details ==

Series: lib/bb/build.py: Raise proper KeyError if function does not exist
Revision: 1
URL   : https://patchwork.openembedded.org/series/5202/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at 68da6c9884)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

* Re: (morty) Python exception during rootfs
  2017-02-07 16:08 ` Mike Looijmans
@ 2017-02-08  8:29   ` Patrick Ohly
  0 siblings, 0 replies; 6+ messages in thread
From: Patrick Ohly @ 2017-02-08  8:29 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core

On Tue, 2017-02-07 at 17:08 +0100, Mike Looijmans wrote:
> Found it. A rootfs post-process function was misspelled, and that caused it.
> 
> I'll make a patch to improve the error message here, to make it just say that 
> it cannot find "func".

I already fixed that in bitbake master, see commit 25df3db5 "build.py:
avoid exception when function is not defined". Sorry, only now saw your
original email.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.





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

* Re: [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist
  2017-02-08  6:17 ` [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist Mike Looijmans
@ 2017-02-08 22:10   ` Paul Eggleton
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Eggleton @ 2017-02-08 22:10 UTC (permalink / raw)
  To: Mike Looijmans; +Cc: openembedded-core

Hi Mike,

On Wednesday, 8 February 2017 7:17:53 AM NZDT Mike Looijmans wrote:
> If one adds the following line to an image recipe without defining
> the function:
> ROOTFS_POSTPROCESS_COMMAND += "rootfs_funky_stuff;"
> bitbake will terminate with a cryptic error message:
> AttributeError: 'NoneType' object has no attribute 'get'
> 
> To inform the user of what bitbake wasn't able to find, raise a KeyError
> exception denoting the function name before that happens. This changes the
> message to the much more useful:
> KeyError: 'rootfs_funky_stuff'
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
>  lib/bb/build.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/bb/build.py b/lib/bb/build.py
> index c4c8aeb..5bc18c1 100644
> --- a/lib/bb/build.py
> +++ b/lib/bb/build.py
> @@ -194,6 +194,8 @@ def exec_func(func, d, dirs = None,
> pythonexception=False): oldcwd = None
> 
>      flags = d.getVarFlags(func)
> +    if flags is None:
> +        raise KeyError(func)
>      cleandirs = flags.get('cleandirs')
>      if cleandirs:
>          for cdir in d.expand(cleandirs).split():

This should got to the bitbake-devel list.

Whilst I agree this is an improvement, since we're trying to print a more 
reasonable error message, wouldn't we be better off explicitly saying 
"Function %s not defined" or similar?

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

end of thread, other threads:[~2017-02-08 22:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 14:21 (morty) Python exception during rootfs Mike Looijmans
2017-02-07 16:08 ` Mike Looijmans
2017-02-08  8:29   ` Patrick Ohly
2017-02-08  6:17 ` [bitbake][PATCH] lib/bb/build.py: Raise proper KeyError if function does not exist Mike Looijmans
2017-02-08 22:10   ` Paul Eggleton
2017-02-08  6:29 ` ✗ patchtest: failure for " Patchwork

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.