[OE-core] [PATCH 1/2] useradd-staticids: skip recipes without static IDs
Patrick Ohly
patrick.ohly at intel.com
Thu Oct 19 07:13:25 UTC 2017
When enabling useradd-staticids.bbclass, one has to define static IDs
for all recipes in a world build, otherwise those without static IDs
generate parse errors or warnings, depending on USERADD_ERROR_DYNAMIC.
Defining unused IDs is a lot of work and clutters the passwd/group
file of a distro.
Distros which want to avoid this can now set USERADD_ERROR_DYNAMIC =
"skip" and recipes which would have triggered a message then silently
get disabled. Trying to build them then still shows the error message:
$ bitbake apt
...
ERROR: Nothing PROVIDES 'apt'
ERROR: apt was skipped: apt - apt: username _apt does not have a
static ID defined.
However, some recipes only get selected indirectly through
dependencies. If the recipe providing something that is needed for the
build gets skipped (for example, the nfs-utils recipe providing the
nfs-utils-client package), then the error message is a bit more
obscure:
ERROR: Nothing RPROVIDES 'nfs-utils-client' (but
.../meta/recipes-core/packagegroups/packagegroup-core-nfs.bb RDEPENDS
on or otherwise requires it)
Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
---
meta/classes/useradd-staticids.bbclass | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index eb8e59e..3d0bc09 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -40,10 +40,14 @@ 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') == 'error' or d.getVar('USERADD_ERROR_DYNAMIC') == '1':
- raise NotImplementedError("%s - %s: %sname %s does not have a static ID defined. Skipping it." % (d.getVar('PN'), pkg, type, id))
- elif d.getVar('USERADD_ERROR_DYNAMIC') == 'warn':
- bb.warn("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id))
+ error_dynamic = d.getVar('USERADD_ERROR_DYNAMIC')
+ msg = "%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id)
+ if error_dynamic == 'error' or error_dynamic == '1':
+ raise NotImplementedError(msg)
+ elif error_dynamic == 'warn':
+ bb.warn(msg)
+ elif error_dynamic == 'skip':
+ raise bb.parse.SkipRecipe(msg)
# We parse and rewrite the useradd components
def rewrite_useradd(params, is_pkg):
--
git-series 0.9.1
More information about the Openembedded-core
mailing list