[OE-core] [PATCH] useradd-staticids.bbclass: catch missing uid/gid exceptions

Christopher Larson clarson at kergoth.com
Fri Oct 21 16:12:43 UTC 2016


On Fri, Oct 21, 2016 at 12:05 AM, Mikko Ylinen <mikko.ylinen at intel.com>
wrote:

> The change to get rid of FuncFailed exceptions changed the behavior
> of how missing uid/gid error are be handled. Instead of catching
> the exception and handling that via bb.parse.SkipPackage(), a fatal
> error was called.
>
> This won't work with recipes that are unused and therefore do not have
> UID/GIDs defined. The problem triggers when parsing all recipes (e.g.,
> oe-selftest runs bitbake -p).
>
> The right way to handle this is to raise bb.parse.SkipPackage(). This
> will error correctly once the recipe is needed.
>
> Signed-off-by: Mikko Ylinen <mikko.ylinen at intel.com>
> ---
>  meta/classes/useradd-staticids.bbclass | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/meta/classes/useradd-staticids.bbclass
> b/meta/classes/useradd-staticids.bbclass
> index afb580a..4162774 100644
> --- a/meta/classes/useradd-staticids.bbclass
> +++ b/meta/classes/useradd-staticids.bbclass
> @@ -53,8 +53,7 @@ def update_useradd_static_config(d):
>      def handle_missing_id(id, type, pkg):
>          # 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))
> -            bb.fatal("%s - %s: %sname %s does not have a static ID
> defined." % (d.getVar('PN', True), pkg, type, id))
> +            raise NotImplementedError("%s - %s: %sname %s does not have a
> static ID defined. Skipping it." % (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))
>
> @@ -323,7 +322,7 @@ python __anonymous() {
>          and not bb.data.inherits_class('native', d):
>          try:
>              update_useradd_static_config(d)
> -        except bb.build.FuncFailed as f:
> +        except NotImplementedError as f:
>              bb.debug(1, "Skipping recipe %s: %s" % (d.getVar('PN', True),
> f))
>              raise bb.parse.SkipPackage(f)
>

NotImplementedError is not the right exception for this.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20161021/bdbc51ad/attachment-0002.html>


More information about the Openembedded-core mailing list