summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-02 17:22:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-18 10:15:58 +0000
commitbc883e49912b8d0cdc9ea403e85f2cb3198b48ff (patch)
treead622ca70314eb78e12a74ceb4d09f4b75fc17a9 /meta
parent12619deabd1f85d88ff14d7c3861e23eeb58bf1b (diff)
downloadpoky-bc883e49912b8d0cdc9ea403e85f2cb3198b48ff.tar.gz
rootfs-postcommands: Try and improve ordering constraints
The current code is in race to see who can set things last. This isn't scalable or sustainable and problemtic in the face of inherit ordering changes. Move the ordering issue into the actual code execution, which isn't ideal but the best of several bad options and at least lets us drop the anonymous python. (From OE-Core rev: 0ffff2c1f80a9b79b133d787764bab164d9abd70) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes-recipe/rootfs-postcommands.bbclass13
-rw-r--r--meta/lib/oe/rootfs.py12
2 files changed, 16 insertions, 9 deletions
diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass b/meta/classes-recipe/rootfs-postcommands.bbclass
index 29ee74932a..163c7f41b1 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -55,19 +55,14 @@ inherit image-artifact-names
55# deterministic. Package installs are not deterministic, causing the ordering 55# deterministic. Package installs are not deterministic, causing the ordering
56# of entries to change between builds. In case that this isn't desired, 56# of entries to change between builds. In case that this isn't desired,
57# the command can be overridden. 57# the command can be overridden.
58SORT_PASSWD_POSTPROCESS_COMMAND ??= "tidy_shadowutils_files"
59ROOTFS_POSTPROCESS_COMMAND += '${SORT_PASSWD_POSTPROCESS_COMMAND}'
60
58# 61#
59# Note that useradd-staticids.bbclass has to be used to ensure that 62# Note that useradd-staticids.bbclass has to be used to ensure that
60# the numeric IDs of dynamically created entries remain stable. 63# the numeric IDs of dynamically created entries remain stable.
61# 64#
62# We want this to run as late as possible, in particular after 65ROOTFS_POSTPROCESS_COMMAND += 'rootfs_reproducible'
63# systemd_sysusers_create and set_user_group. Using :append is not
64# enough for that, set_user_group is added that way and would end
65# up running after us.
66SORT_PASSWD_POSTPROCESS_COMMAND ??= "tidy_shadowutils_files"
67python () {
68 d.appendVar('ROOTFS_POSTPROCESS_COMMAND', ' ${SORT_PASSWD_POSTPROCESS_COMMAND}')
69 d.appendVar('ROOTFS_POSTPROCESS_COMMAND', ' rootfs_reproducible')
70}
71 66
72# Resolve the ID as described in the sysusers.d(5) manual: ID can be a numeric 67# Resolve the ID as described in the sysusers.d(5) manual: ID can be a numeric
73# uid, a couple uid:gid or uid:groupname or it is '-' meaning leaving it 68# uid, a couple uid:gid or uid:groupname or it is '-' meaning leaving it
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index 3f27164536..8cd48f9450 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -194,6 +194,18 @@ class Rootfs(object, metaclass=ABCMeta):
194 post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND") 194 post_process_cmds = self.d.getVar("ROOTFS_POSTPROCESS_COMMAND")
195 rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND') 195 rootfs_post_install_cmds = self.d.getVar('ROOTFS_POSTINSTALL_COMMAND')
196 196
197 def make_last(command, commands):
198 commands = commands.split()
199 if command in commands:
200 commands.remove(command)
201 commands.append(command)
202 return "".join(commands)
203
204 # We want this to run as late as possible, in particular after
205 # systemd_sysusers_create and set_user_group. Using :append is not enough
206 make_last("tidy_shadowutils_files", post_process_cmds)
207 make_last("rootfs_reproducible", post_process_cmds)
208
197 execute_pre_post_process(self.d, pre_process_cmds) 209 execute_pre_post_process(self.d, pre_process_cmds)
198 210
199 if self.progress_reporter: 211 if self.progress_reporter: