public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] image.bbclass: fix non-reproducible file time-stamps inside rootfs image
@ 2023-01-02 14:58 venkata.pyla
  2023-01-02 15:32 ` Jan Kiszka
  2023-01-02 16:44 ` Henning Schild
  0 siblings, 2 replies; 30+ messages in thread
From: venkata.pyla @ 2023-01-02 14:58 UTC (permalink / raw)
  To: isar-users
  Cc: venkata pyla, amikan, jan.kiszka, henning.schild,
	kazuhiro3.hayashi, dinesh.kumar

From: venkata pyla <venkata.pyla@toshiba-tsip.com>

As part of reproducible-build work, the rootfs images generated on same
source should be identical between two builds.

In this commit it tries to solve one of the non-reproducible problem
i.e. the rootfs file time-stamps generated during build time are not
reproducible, it uses one of the solution provided in the debian
live-build image project (refer [1]), it fixes by finding all the
files/folders that are gernerated newly and set the time-stamp provided
by `SOURCE_DATE_EPOCH` environment variable.

[1] https://salsa.debian.org/live-team/live-build/-/merge_requests/218

Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
 meta/classes/image.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 813e1f3..f592a12 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -430,6 +430,15 @@ do_rootfs_finalize() {
             "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
 
         rm -f "${ROOTFSDIR}/etc/apt/sources-list"
+
+        # Set same time-stamps to the newly generated file/folders in the
+        # rootfs image for the purpose of reproducible builds.
+        test ! -z "${SOURCE_DATE_EPOCH}" && \
+            find ${ROOTFSDIR} -newermt \
+                "$(date -d@${SOURCE_DATE_EPOCH} '+%Y-%m-%d %H:%M:%S')" \
+                -printf "%y %p\n" \
+                -exec touch '{}' -h -d@${SOURCE_DATE_EPOCH} ';'
+
 EOSUDO
 }
 addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
-- 
2.20.1



^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-01-06 10:18 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 14:58 [PATCH] image.bbclass: fix non-reproducible file time-stamps inside rootfs image venkata.pyla
2023-01-02 15:32 ` Jan Kiszka
2023-01-03  5:54   ` Venkata.Pyla
2023-01-02 16:44 ` Henning Schild
2023-01-03  8:05   ` Jan Kiszka
2023-01-03 18:51     ` Henning Schild
2023-01-03 14:10   ` Venkata.Pyla
2023-01-03 19:05     ` Henning Schild
2023-01-04  7:54       ` Venkata.Pyla
2023-01-04  9:29         ` Henning Schild
2023-01-04 13:48           ` Venkata.Pyla
2023-01-04 13:53             ` Henning Schild
2023-01-04 14:35               ` Jan Kiszka
2023-01-04 14:50                 ` Venkata.Pyla
2023-01-04 15:07                   ` Henning Schild
2023-01-04 15:34                     ` Venkata.Pyla
2023-01-05  6:18                       ` [PATCH v2 0/1] Fix for reproducible build issue venkata.pyla
2023-01-05  6:18                       ` [PATCH v2 1/1] image.bbclass: fix non-reproducible file time-stamps inside rootfs venkata.pyla
2023-01-05  8:19                         ` Henning Schild
2023-01-05  9:50                           ` Moessbauer, Felix
2023-01-05 17:05                             ` Henning Schild
2023-01-06  2:08                               ` Moessbauer, Felix
2023-01-05 13:52                           ` Venkata.Pyla
2023-01-05 15:12                             ` [PATCH v3 0/1] Fix for reproducible build issue venkata.pyla
2023-01-05 15:12                             ` [PATCH v3 1/1] image.bbclass: fix non-reproducible file time-stamps inside rootfs venkata.pyla
2023-01-06  9:45                               ` Moessbauer, Felix
2023-01-06 10:17                                 ` Venkata.Pyla
2023-01-05 16:49                             ` [PATCH v2 " Henning Schild
2023-01-04 15:01                 ` [PATCH] image.bbclass: fix non-reproducible file time-stamps inside rootfs image Henning Schild
2023-01-04 15:27                   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox