image-account-extension: Also rebuild roots on GROUP_* changes

Message ID 9e54c21f-63df-4a0c-bdca-711dc8079380@siemens.com
State Under Review
Headers show
Series image-account-extension: Also rebuild roots on GROUP_* changes | expand

Commit Message

Jan Kiszka June 18, 2025, 6:57 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Unlike what 3330e1ca2bca what assumed, also certain changes to groups
can invalidate previous runs of the account extensions against the
cached rootfs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/image-account-extension.bbclass | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch

diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
index 3c461b1a..5039adab 100644
--- a/meta/classes/image-account-extension.bbclass
+++ b/meta/classes/image-account-extension.bbclass
@@ -8,21 +8,20 @@ 
 USERS ??= ""
 GROUPS ??= ""
 
-# rebuild rootfs on change of USERS as homes might be moved / created
-# no need to depend on GROUPS as they don't create directories
-# groups need to be created before users, hence do not move the user creation into
-# the do_rootfs_install task but only add a dependency
+# rebuild rootfs on change of USERS or GROUPS as homes might be created, moved
+# or given different IDs.
 python() {
     for entry in (d.getVar("GROUPS") or "").split():
         group_entry = "GROUP_{}".format(entry)
         d.appendVarFlag("image_postprocess_accounts", "vardeps", " {}".format(group_entry))
+        d.appendVarFlag("do_rootfs_install", "vardeps", " {}".format(group_entry))
 
     for entry in (d.getVar("USERS") or "").split():
         user_entry = "USER_{}".format(entry)
         d.appendVarFlag("image_postprocess_accounts", "vardeps", " {}".format(user_entry))
         d.appendVarFlag("do_rootfs_install", "vardeps", " {}".format(user_entry))
 }
-do_rootfs_install[vardeps] += "USERS"
+do_rootfs_install[vardeps] += "GROUPS USERS"
 
 def image_create_groups(d: "DataSmart") -> None:
     """Creates the groups defined in the ``GROUPS`` bitbake variable.