Message ID | 20231206142747.14117-1-venkata.pyla@toshiba-tsip.com |
---|---|
State | Accepted, archived |
Headers | show |
Series | wic:rootfs-u-boot.py: Set timestamps for newly updated files | expand |
On 06.12.23 22:27, venkata.pyla@toshiba-tsip.com wrote: > From: venkata pyla <venkata.pyla@toshiba-tsip.com> > > The u-boot rootfs image is not reproducible because the > `update-u-boot-script` is creating new files with build timestamps, > whereas the rootfs files timestamps are set to SOURCE_DATE_EPOCH during > do_rootfs_finalize task and so for set the timestamps for the newly > updated files. > > Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com> > --- > meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py > index 93600dc2..b7011775 100644 > --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py > +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py > @@ -106,6 +106,15 @@ class RootfsUBootPlugin(RootfsPlugin): > rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static) > exec_cmd(rm_cmd) > > + # For reproducibility set the time stamp of newly updated files > + if os.getenv('SOURCE_DATE_EPOCH'): > + sde_time = int(os.getenv('SOURCE_DATE_EPOCH')) > + os.utime(u_boot_script, (sde_time, sde_time)) > + os.utime(os.path.join(real_rootfs_dir, "boot/boot.scr"), > + (sde_time, sde_time)) > + os.utime(os.path.join(real_rootfs_dir, "tmp"), > + (sde_time, sde_time)) > + > RootfsPlugin.do_prepare_partition(part, source_params, cr, cr_workdir, > oe_builddir, bootimg_dir, kernel_dir, > krootfs_dir, native_sysroot) Good catch! Looks fine to me. Thanks, Jan
On Wed, 2023-12-06 at 19:57 +0530, venkata.pyla@toshiba-tsip.com wrote: > From: venkata pyla <venkata.pyla@toshiba-tsip.com> > > The u-boot rootfs image is not reproducible because the > `update-u-boot-script` is creating new files with build timestamps, > whereas the rootfs files timestamps are set to SOURCE_DATE_EPOCH > during > do_rootfs_finalize task and so for set the timestamps for the newly > updated files. > > Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com> > --- > meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py | 9 +++++++++ > 1 file changed, 9 insertions(+) > Applied to next, thanks.
diff --git a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py index 93600dc2..b7011775 100644 --- a/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py +++ b/meta/scripts/lib/wic/plugins/source/rootfs-u-boot.py @@ -106,6 +106,15 @@ class RootfsUBootPlugin(RootfsPlugin): rm_cmd = "rm -f %s/usr/bin/%s" % (real_rootfs_dir, qemu_static) exec_cmd(rm_cmd) + # For reproducibility set the time stamp of newly updated files + if os.getenv('SOURCE_DATE_EPOCH'): + sde_time = int(os.getenv('SOURCE_DATE_EPOCH')) + os.utime(u_boot_script, (sde_time, sde_time)) + os.utime(os.path.join(real_rootfs_dir, "boot/boot.scr"), + (sde_time, sde_time)) + os.utime(os.path.join(real_rootfs_dir, "tmp"), + (sde_time, sde_time)) + RootfsPlugin.do_prepare_partition(part, source_params, cr, cr_workdir, oe_builddir, bootimg_dir, kernel_dir, krootfs_dir, native_sysroot)