]> code.ossystems Code Review - openembedded-core.git/commitdiff
grub-efi.bbclass: Use bb.fatal() instead of raising FuncFailed
authorUlf Magnusson <ulfalizer@gmail.com>
Sat, 1 Oct 2016 02:46:55 +0000 (04:46 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 3 Oct 2016 14:46:21 +0000 (15:46 +0100)
This sets a good example and avoids unnecessarily contributing to
perceived complexity and cargo culting.

Motivating quote below:

< 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

FuncFailed.__init__ takes a 'name' argument rather than a 'msg'
argument, which also shows that the original purpose got lost.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/grub-efi.bbclass

index 26ba8cefcbc70572f8409984b43c972b8daba251..17417ba5d947d02cf7046916b24afd56521a424b 100644 (file)
@@ -90,12 +90,12 @@ python build_efi_cfg() {
 
     cfile = d.getVar('GRUB_CFG', True)
     if not cfile:
-        raise bb.build.FuncFailed('Unable to read GRUB_CFG')
+        bb.fatal('Unable to read GRUB_CFG')
 
     try:
          cfgfile = open(cfile, 'w')
     except OSError:
-        raise bb.build.FuncFailed('Unable to open %s' % (cfile))
+        bb.fatal('Unable to open %s' % cfile)
 
     cfgfile.write('# Automatically created by OE\n')
 
@@ -114,7 +114,7 @@ python build_efi_cfg() {
 
     root = d.getVar('GRUB_ROOT', True)
     if not root:
-        raise bb.build.FuncFailed('GRUB_ROOT not defined')
+        bb.fatal('GRUB_ROOT not defined')
 
     if gfxserial == "1":
         btypes = [ [ " graphics console", "" ],
@@ -127,7 +127,7 @@ python build_efi_cfg() {
 
         overrides = localdata.getVar('OVERRIDES', True)
         if not overrides:
-            raise bb.build.FuncFailed('OVERRIDES not defined')
+            bb.fatal('OVERRIDES not defined')
 
         for btype in btypes:
             localdata.setVar('OVERRIDES', label + ':' + overrides)