diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-09-26 09:29:47 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-11-08 22:24:03 +0000 |
commit | 9c227071224abe1ec2901242b5b1e2008db317a1 (patch) | |
tree | 77196c5d66f7fe424e0c87cce11ca039aa06fc19 /meta | |
parent | 7179878b28e73388bdf3a90d1f5ff8687abf5ec2 (diff) | |
download | poky-9c227071224abe1ec2901242b5b1e2008db317a1.tar.gz |
useradd-staticids: skip recipes without static IDs
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. Only trying to build them 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.
(From OE-Core rev: 9113928cea88c2187e8640ac489671cb81f58103)
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/useradd-staticids.bbclass | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass index eb8e59e67a..3d0bc09148 100644 --- a/meta/classes/useradd-staticids.bbclass +++ b/meta/classes/useradd-staticids.bbclass | |||
@@ -40,10 +40,14 @@ def update_useradd_static_config(d): | |||
40 | 40 | ||
41 | def handle_missing_id(id, type, pkg): | 41 | def handle_missing_id(id, type, pkg): |
42 | # For backwards compatibility we accept "1" in addition to "error" | 42 | # For backwards compatibility we accept "1" in addition to "error" |
43 | if d.getVar('USERADD_ERROR_DYNAMIC') == 'error' or d.getVar('USERADD_ERROR_DYNAMIC') == '1': | 43 | error_dynamic = d.getVar('USERADD_ERROR_DYNAMIC') |
44 | raise NotImplementedError("%s - %s: %sname %s does not have a static ID defined. Skipping it." % (d.getVar('PN'), pkg, type, id)) | 44 | msg = "%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id) |
45 | elif d.getVar('USERADD_ERROR_DYNAMIC') == 'warn': | 45 | if error_dynamic == 'error' or error_dynamic == '1': |
46 | bb.warn("%s - %s: %sname %s does not have a static ID defined." % (d.getVar('PN'), pkg, type, id)) | 46 | raise NotImplementedError(msg) |
47 | elif error_dynamic == 'warn': | ||
48 | bb.warn(msg) | ||
49 | elif error_dynamic == 'skip': | ||
50 | raise bb.parse.SkipRecipe(msg) | ||
47 | 51 | ||
48 | # We parse and rewrite the useradd components | 52 | # We parse and rewrite the useradd components |
49 | def rewrite_useradd(params, is_pkg): | 53 | def rewrite_useradd(params, is_pkg): |