On Thu, 2024-02-22 at 14:53 +0000, Eilís 'pidge' Ní Fhlannagáin wrote:
> From: Piotr Łobacz <p.lob...@welotec.com>
> 
> postinst-useradd-* haven't been running in order of dependency.
> 
> This patch is reworked from Piotr Łobacz's patch and fixes:
> 
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=15084
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=13904
> 
> It ensures that groups, users and groupmems are all run in the correct order.

I think this needs a little bit more explanation in the commit message.
What is the issue, why do we need to solve it like this etc.

> 
> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pi...@baylibre.com>
> ---
>  meta/classes-global/staging.bbclass |  7 +--
>  meta/classes/useradd.bbclass        | 72 ++++++++++++++++++-----------
>  2 files changed, 49 insertions(+), 30 deletions(-)
> 
> diff --git a/meta/classes-global/staging.bbclass 
> b/meta/classes-global/staging.bbclass
> index ab3e1d71b5..6c21510377 100644
> --- a/meta/classes-global/staging.bbclass
> +++ b/meta/classes-global/staging.bbclass
> @@ -245,8 +245,9 @@ def staging_populate_sysroot_dir(targetsysroot, 
> nativesysroot, native, d):
>                          continue
>  
>      staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
> -    for p in postinsts:
> -        bb.note("Running postinst {}, output:\n{}".format(p, 
> subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)))


> +    bb.warn(sorted(postinsts))

Come on, please! :)


> +    for p in sorted(postinsts):
> +        bb.warn("Running postinst {}, output:\n{}".format(p, 
> subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)))
>  
>  #
>  # Manifests here are complicated. The main sysroot area has the unpacked 
> sstate
> @@ -629,7 +630,7 @@ python extend_recipe_sysroot() {
>      for f in fixme:
>          staging_processfixme(fixme[f], f, recipesysroot, 
> recipesysrootnative, d)
>  
> -    for p in postinsts:
> +    for p in sorted(postinsts):
>          bb.note("Running postinst {}, output:\n{}".format(p, 
> subprocess.check_output(p, shell=True, stderr=subprocess.STDOUT)))
>  
>      for dep in manifests:
> diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
> index a58f8287c9..924eeadf9c 100644
> --- a/meta/classes/useradd.bbclass
> +++ b/meta/classes/useradd.bbclass
> @@ -103,6 +103,18 @@ fi
>  }
>  
>  useradd_sysroot () {
> +     user_group_groupmems_add_sysroot user
> +}
> +
> +groupadd_sysroot () {
> +     user_group_groupmems_add_sysroot group
> +}
> +
> +groupmemsadd_sysroot () {
> +     user_group_groupmems_add_sysroot groupmems
> +}
> +
> +user_group_groupmems_add_sysroot () {
>       # Pseudo may (do_prepare_recipe_sysroot) or may not 
> (do_populate_sysroot_setscene) be running 
>       # at this point so we're explicit about the environment so pseudo can 
> load if 
>       # not already present.
> @@ -130,10 +142,19 @@ useradd_sysroot () {
>               exit 0
>       fi
>  
> -     # Add groups and users defined for all recipe packages
> -     GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}"
> -     USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}"
> -     GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}"
> +     # Add groups and users defined for all recipe packages
> +     if test "x$1" = "xgroup"; then
> +             GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}"
> +     fi
> +     if test "x$1" = "xuser"; then
> +             USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}"
> +     fi
> +     if test "x$1" = "xgroupmems"; then
> +             GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}"
> +     fi
> +     if test "x$1" = "x"; then
> +             bbwarn "missing type of passwd db action"
> +    fi               

whitespace...



Cheers,

Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196034): 
https://lists.openembedded.org/g/openembedded-core/message/196034
Mute This Topic: https://lists.openembedded.org/mt/104509398/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to