summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/partition.py
diff options
context:
space:
mode:
authorSergei Zhmylev <s.zhmylev@yadro.com>2022-10-21 17:56:22 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-10-26 12:28:39 +0100
commit0ee936da2eaf3b5581864d94c9091ca59db1f8bd (patch)
tree0a2da97a8797dbf4f34bc0156187e4600d62179c /scripts/lib/wic/partition.py
parent0cc7ac200d8c8bbdb6b5ed037ab2cd705338d446 (diff)
downloadpoky-0ee936da2eaf3b5581864d94c9091ca59db1f8bd.tar.gz
wic: honor the SOURCE_DATE_EPOCH in case of updated fstab
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. (From OE-Core rev: 99719a3712a88dce8450994d995803e126e49115) Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/partition.py')
-rw-r--r--scripts/lib/wic/partition.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index e50871b8d7..bc889bdeb9 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -294,6 +294,11 @@ class Partition():
294 f.write("cd etc\n") 294 f.write("cd etc\n")
295 f.write("rm fstab\n") 295 f.write("rm fstab\n")
296 f.write("write %s fstab\n" % (self.updated_fstab_path)) 296 f.write("write %s fstab\n" % (self.updated_fstab_path))
297 if os.getenv('SOURCE_DATE_EPOCH'):
298 fstab_time = int(os.getenv('SOURCE_DATE_EPOCH'))
299 for time in ["atime", "mtime", "ctime"]:
300 f.write("set_inode_field fstab %s %s\n" % (time, hex(fstab_time)))
301 f.write("set_inode_field fstab %s_extra 0\n" % (time))
297 debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) 302 debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs)
298 exec_native_cmd(debugfs_cmd, native_sysroot) 303 exec_native_cmd(debugfs_cmd, native_sysroot)
299 304
@@ -353,7 +358,7 @@ class Partition():
353 exec_native_cmd(mcopy_cmd, native_sysroot) 358 exec_native_cmd(mcopy_cmd, native_sysroot)
354 359
355 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update: 360 if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update:
356 mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path) 361 mcopy_cmd = "mcopy -m -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path)
357 exec_native_cmd(mcopy_cmd, native_sysroot) 362 exec_native_cmd(mcopy_cmd, native_sysroot)
358 363
359 chmod_cmd = "chmod 644 %s" % rootfs 364 chmod_cmd = "chmod 644 %s" % rootfs