[oe-commits] [openembedded-core] 09/33: useradd-staticids.bbclass: Use bb.fatal() instead of raising FuncFailed
git at git.openembedded.org
git at git.openembedded.org
Mon Oct 3 14:50:35 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit e507cb978fd52164beb28324933cb3d5e368c3ab
Author: Ulf Magnusson <ulfalizer at gmail.com>
AuthorDate: Sat Oct 1 04:46:54 2016 +0200
useradd-staticids.bbclass: Use bb.fatal() instead of raising FuncFailed
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 at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/useradd-staticids.bbclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index 46d4a4b..afb580a 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -16,7 +16,7 @@ def update_useradd_static_config(d):
error(message)
def error(self, message):
- raise bb.build.FuncFailed(message)
+ bb.fatal(message)
def list_extend(iterable, length, obj = None):
"""Ensure that iterable is the specified length by extending with obj
@@ -54,7 +54,7 @@ def update_useradd_static_config(d):
# For backwards compatibility we accept "1" in addition to "error"
if d.getVar('USERADD_ERROR_DYNAMIC', True) == 'error' or d.getVar('USERADD_ERROR_DYNAMIC', True) == '1':
#bb.error("Skipping recipe %s, package %s which adds %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id))
- raise bb.build.FuncFailed("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id))
+ bb.fatal("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id))
elif d.getVar('USERADD_ERROR_DYNAMIC', True) == 'warn':
bb.warn("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN', True), pkg, type, id))
@@ -107,7 +107,7 @@ def update_useradd_static_config(d):
try:
uaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param))
except:
- raise bb.build.FuncFailed("%s: Unable to parse arguments for USERADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param))
+ bb.fatal("%s: Unable to parse arguments for USERADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param))
# Read all passwd files specified in USERADD_UID_TABLES or files/passwd
# Use the standard passwd layout:
@@ -242,7 +242,7 @@ def update_useradd_static_config(d):
# If we're processing multiple lines, we could have left over values here...
gaargs = parser.parse_args(re.split('''[ \t]+(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', param))
except:
- raise bb.build.FuncFailed("%s: Unable to parse arguments for GROUPADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param))
+ bb.fatal("%s: Unable to parse arguments for GROUPADD_PARAM_%s: '%s'" % (d.getVar('PN', True), pkg, param))
# Read all group files specified in USERADD_GID_TABLES or files/group
# Use the standard group layout:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list