Skip to contentSkip to conversation

wic: honor the SOURCE_DATE_EPOCH in case of updated fstab

PATCH Superseded [email protected] 2 participants 2 messages Oct 13, 2022 – Oct 14, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wic: honor the SOURCE_DATE_EPOCH in case of updated fstab

From: Sergei Zhmylev <[email protected]>

In case user requested to build a binary repeatable package, it's required to honor the SOURCE_DATE_EPOCH environment variable. So forcefully set mtime inside all the routines which modify fstab in case it is updated.

---
 scripts/lib/wic/partition.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/lib/wic/partition.py +4 -1
index e50871b8d7..cac1bab4dd 100644
@@ -291,6 +291,9 @@ class Partition():
         if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
             debugfs_script_path = os.path.join(cr_workdir, "debugfs_script")
             with open(debugfs_script_path, "w") as f:
+                if os.getenv('SOURCE_DATE_EPOCH'):
+                    fstab_time = int(os.getenv('SOURCE_DATE_EPOCH'))
+                    f.write("set_current_time %s\n" % (fstab_time))
                 f.write("cd etc\n")
                 f.write("rm fstab\n")
                 f.write("write %s fstab\n" % (self.updated_fstab_path))
@@ -353,7 +356,7 @@ class Partition():
         exec_native_cmd(mcopy_cmd, native_sysroot)
 
         if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
-            mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
+            mcopy_cmd = "mcopy -m -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
             exec_native_cmd(mcopy_cmd, native_sysroot)
 
         chmod_cmd = "chmod 644 %s" % rootfs
Signature · 1 line
2.37.2
#1 lore raw

Hi,

This caused:

https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/6305/steps/13/logs/stdio

Quoted 48 lines · Sergey Zhmylev

From: Sergei Zhmylev <[email protected]>

In case user requested to build a binary repeatable package, it's required to honor the SOURCE_DATE_EPOCH environment variable. So forcefully set mtime inside all the routines which modify fstab in case it is updated.

---
 scripts/lib/wic/partition.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/lib/wic/partition.py +4 -1
index e50871b8d7..cac1bab4dd 100644
@@ -291,6 +291,9 @@ class Partition():
         if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
             debugfs_script_path = os.path.join(cr_workdir, "debugfs_script")
             with open(debugfs_script_path, "w") as f:
+                if os.getenv('SOURCE_DATE_EPOCH'):
+                    fstab_time = int(os.getenv('SOURCE_DATE_EPOCH'))
+                    f.write("set_current_time %s\n" % (fstab_time))
                 f.write("cd etc\n")
                 f.write("rm fstab\n")
                 f.write("write %s fstab\n" % (self.updated_fstab_path))
@@ -353,7 +356,7 @@ class Partition():
         exec_native_cmd(mcopy_cmd, native_sysroot)
 
         if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
-            mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
+            mcopy_cmd = "mcopy -m -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
             exec_native_cmd(mcopy_cmd, native_sysroot)
 
         chmod_cmd = "chmod 644 %s" % rootfs
Signature · 11 lines
2.37.2



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#171718): https://lists.openembedded.org/g/openembedded-core/message/171718
Mute This Topic: https://lists.openembedded.org/mt/94308156/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com