[OE-core] [PATCH 00/22] Use bb.fatal() instead of raising FuncFailed

Ulf Magnusson ulfalizer at gmail.com
Sat Oct 1 02:46:49 UTC 2016


Motiving quote:

< kergoth> the *original* intent was for the function/task to error via
           whatever appropriate means, bb.fatal, whatever, and
           funcfailed was what you'd catch if you were calling
           exec_func/exec_task. that is, it's what those functions
           raise, not what metadata functions should be raising
< kergoth> it didn't end up being used that way
< kergoth> but there's really never a reason to raise it yourself

This seems to be true from looking at the code. exec_func_python() in
bitbake/lib/bb/build.py raises FuncFailed when it catches the
BBHandledException raised by bb.fatal(). Metadata functions that catch
FuncFailed (e.g. in image.bclass) should still work, per the original purpose
of FuncFailed.

The output might change slightly (imo for the better). Here's an example before
the change:

  ERROR: gettext-0.19.8.1-r0 do_fetch: Function failed: Fetcher failure for URL: 'http://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.gz'. ...
  ERROR: Logfile of failure stored in: /home/ulf/poky/build/tmp/work/i586-poky-linux/gettext/0.19.8.1-r0/temp/log.do_fetch.19715

Here's what it looks like after the change:

  ERROR: gettext-0.19.8.1-r0 do_fetch: Fetcher failure for URL: 'http://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.gz'. ...
  ERROR: gettext-0.19.8.1-r0 do_fetch: Function failed: base_do_fetch
  ERROR: Logfile of failure stored in: /home/ulf/poky/build/tmp/work/i586-poky-linux/gettext/0.19.8.1-r0/temp/log.do_fetch.19608

I won't get terribly offended if not all of these get merged. Hopefully it
makes people aware that there's a simpler way at least.

There's also a few instances in meta/lib/oe and meta/lib/oeqa that could
probably be replaced, but I got tired and wasn't sure that they're always
called in a context where it'd be safe.

Ulf Magnusson (22):
  base.bbclass: Use bb.fatal() instead of raising FuncFailed
  package_ipk.bbclass: Use bb.fatal() instead of raising FuncFailed
  package_deb.bbclass: Use bb.fatal() instead of raising FuncFailed
  package_rpm.bbclass: Use bb.fatal() instead of raising FuncFailed
  useradd-staticids.bbclass: Use bb.fatal() instead of raising
    FuncFailed
  grub-efi.bbclass: Use bb.fatal() instead of raising FuncFailed
  syslinux.bbclass: Use bb.fatal() instead of raising FuncFailed
  systemd-boot.bbclass: Use bb.fatal() instead of raising FuncFailed
  gummiboot.bbclass: Use bb.fatal() instead of raising FuncFailed
  update-rc.d.bbclass: Use bb.fatal() instead of raising FuncFailed
  license.bbclass: Use bb.fatal() instead of raising FuncFailed
  systemd.bbclass: Use bb.fatal() instead of raising FuncFailed
  gtk-immodules-cache.bbclass: Use bb.fatal() instead of raising
    FuncFailed
  useradd.bbclass: Use bb.fatal() instead of raising FuncFailed
  sstate.bbclass: Use bb.fatal() instead of raising FuncFailed
  chrpath.bbclass: Use bb.fatal() instead of raising FuncFailed
  testsdk.bbclass: Use bb.fatal() instead of raising FuncFailed
  libc-package.bbclass: Use bb.fatal() instead of raising FuncFailed
  package.bbclass: Use bb.fatal() instead of raising FuncFailed
  utility-tasks.bbclass: Use bb.fatal() instead of raising FuncFailed
  testimage.bbclass: Use bb.fatal() instead of raising FuncFailed
  cmake: Use bb.fatal() instead of raising FuncFailed

 meta/classes/base.bbclass                  |  8 ++++----
 meta/classes/chrpath.bbclass               |  3 +--
 meta/classes/grub-efi.bbclass              |  8 ++++----
 meta/classes/gtk-immodules-cache.bbclass   |  2 +-
 meta/classes/gummiboot.bbclass             |  6 +++---
 meta/classes/libc-package.bbclass          |  2 +-
 meta/classes/license.bbclass               |  4 ++--
 meta/classes/package.bbclass               |  2 +-
 meta/classes/package_deb.bbclass           | 10 +++++-----
 meta/classes/package_ipk.bbclass           | 10 +++++-----
 meta/classes/package_rpm.bbclass           |  6 +++---
 meta/classes/sstate.bbclass                |  2 +-
 meta/classes/syslinux.bbclass              |  8 ++++----
 meta/classes/systemd-boot.bbclass          |  6 +++---
 meta/classes/systemd.bbclass               |  3 +--
 meta/classes/testimage.bbclass             |  2 +-
 meta/classes/testsdk.bbclass               |  2 +-
 meta/classes/update-rc.d.bbclass           |  4 ++--
 meta/classes/useradd-staticids.bbclass     |  8 ++++----
 meta/classes/useradd.bbclass               |  2 +-
 meta/classes/utility-tasks.bbclass         |  2 +-
 meta/recipes-devtools/cmake/cmake_3.6.1.bb |  2 +-
 22 files changed, 50 insertions(+), 52 deletions(-)

-- 
2.7.4




More information about the Openembedded-core mailing list