* [PATCH v3] image-account-extenstion: rebuild on varflag changes
@ 2024-04-18 16:11 B. Niedermayr
2024-04-26 6:08 ` Uladzimir Bely
0 siblings, 1 reply; 2+ messages in thread
From: B. Niedermayr @ 2024-04-18 16:11 UTC (permalink / raw)
To: isar-users
From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
When adding items (e.g. foo) to the USER or GROUP variables, the
buildsystem automatically creates new variables (USER_foo).
One can then set these variables, or more precise, the variable
flags (e.g. USER_foo[password]) to control differents aspects
of the user creation.
Isar does not trigger a rebuild when applying changes to these
variable flags since they are not recognized by the
tasks signature generation.
The same applies to the USERS and GROUPS variables as well as
for the SOURCE_DATE_EPOCH variable.
Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
---
meta/classes/image-account-extension.bbclass | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/meta/classes/image-account-extension.bbclass b/meta/classes/image-account-extension.bbclass
index 3d4e1d1dd175..45526da72cea 100644
--- a/meta/classes/image-account-extension.bbclass
+++ b/meta/classes/image-account-extension.bbclass
@@ -8,6 +8,16 @@
USERS ??= ""
GROUPS ??= ""
+python() {
+ for entry in (d.getVar("GROUPS") or "").split():
+ group_entry = "GROUP_{}".format(entry)
+ d.appendVarFlag("image_postprocess_accounts", "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))
+}
+
def image_create_groups(d: "DataSmart") -> None:
"""Creates the groups defined in the ``GROUPS`` bitbake variable.
@@ -130,11 +140,12 @@ def image_create_users(d: "DataSmart") -> None:
ROOTFS_POSTPROCESS_COMMAND += "image_postprocess_accounts"
+image_postprocess_accounts[vardeps] += "USERS GROUPS SOURCE_DATE_EPOCH"
python image_postprocess_accounts() {
import os
if d.getVar("SOURCE_DATE_EPOCH") != None:
os.environ["SOURCE_DATE_EPOCH"] = d.getVar("SOURCE_DATE_EPOCH")
-
+
image_create_groups(d)
image_create_users(d)
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v3] image-account-extenstion: rebuild on varflag changes
2024-04-18 16:11 [PATCH v3] image-account-extenstion: rebuild on varflag changes B. Niedermayr
@ 2024-04-26 6:08 ` Uladzimir Bely
0 siblings, 0 replies; 2+ messages in thread
From: Uladzimir Bely @ 2024-04-26 6:08 UTC (permalink / raw)
To: B. Niedermayr, isar-users
On Thu, 2024-04-18 at 18:11 +0200, 'B. Niedermayr' via isar-users
wrote:
> From: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
>
> When adding items (e.g. foo) to the USER or GROUP variables, the
> buildsystem automatically creates new variables (USER_foo).
> One can then set these variables, or more precise, the variable
> flags (e.g. USER_foo[password]) to control differents aspects
> of the user creation.
> Isar does not trigger a rebuild when applying changes to these
> variable flags since they are not recognized by the
> tasks signature generation.
>
> The same applies to the USERS and GROUPS variables as well as
> for the SOURCE_DATE_EPOCH variable.
>
> Signed-off-by: Benedikt Niedermayr <benedikt.niedermayr@siemens.com>
> ---
> meta/classes/image-account-extension.bbclass | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image-account-extension.bbclass
> b/meta/classes/image-account-extension.bbclass
> index 3d4e1d1dd175..45526da72cea 100644
> --- a/meta/classes/image-account-extension.bbclass
> +++ b/meta/classes/image-account-extension.bbclass
> @@ -8,6 +8,16 @@
> USERS ??= ""
> GROUPS ??= ""
>
> +python() {
> + for entry in (d.getVar("GROUPS") or "").split():
> + group_entry = "GROUP_{}".format(entry)
> + d.appendVarFlag("image_postprocess_accounts", "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))
> +}
> +
> def image_create_groups(d: "DataSmart") -> None:
> """Creates the groups defined in the ``GROUPS`` bitbake
> variable.
>
> @@ -130,11 +140,12 @@ def image_create_users(d: "DataSmart") -> None:
>
>
> ROOTFS_POSTPROCESS_COMMAND += "image_postprocess_accounts"
> +image_postprocess_accounts[vardeps] += "USERS GROUPS
> SOURCE_DATE_EPOCH"
> python image_postprocess_accounts() {
> import os
> if d.getVar("SOURCE_DATE_EPOCH") != None:
> os.environ["SOURCE_DATE_EPOCH"] =
> d.getVar("SOURCE_DATE_EPOCH")
> -
> +
> image_create_groups(d)
> image_create_users(d)
> }
> --
> 2.34.1
>
Applied to next, thanks.
--
Best regards,
Uladzimir.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-26 6:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 16:11 [PATCH v3] image-account-extenstion: rebuild on varflag changes B. Niedermayr
2024-04-26 6:08 ` Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox