From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7184069459095584768 X-Received: by 2002:a05:6870:6389:b0:150:1927:c44d with SMTP id t9-20020a056870638900b001501927c44dmr1071679oap.238.1672671516082; Mon, 02 Jan 2023 06:58:36 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6870:c80b:b0:14d:3678:867f with SMTP id ee11-20020a056870c80b00b0014d3678867fls8575644oab.10.-pod-prod-gmail; Mon, 02 Jan 2023 06:58:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXtzZZ/HEua6W4H4kfKofzY3q89r1/YFU1r0c6anL5VUP6ho3RA8BfFJV/sjXJRex26nQvMs X-Received: by 2002:a05:6870:3c0c:b0:144:d3f9:ff11 with SMTP id gk12-20020a0568703c0c00b00144d3f9ff11mr19138237oab.28.1672671515550; Mon, 02 Jan 2023 06:58:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672671515; cv=none; d=google.com; s=arc-20160816; b=OOgxMVSRtvuaWoTvEE73ME9/nMZBHGTiJ35riN4Y9jqkD3rS4srYQlDdXbvK77Wct2 pnP5s1MS04i9JJVxUCIIkClSxW8o4RFgp9CoAUeyorpz5i1eZthQUZl0IAasZYrKLCVD nfEb0Mattg5NlOAVYZ8ei038RlZMCInw4Vi2GMvo1HKrPb3loGLfXXFPyxtldvOFtg5s 27v06Xwv8eIytCTho/ZfNmUkiOYNuoR25yZ34svY0VwikGsJGro7Ifj78+8zuxw8iuux et8S6hNPhfuuYYxF1E6Peug2n4RKCyQfJ6GZY+AO4UESVlqaaxIFGEUef8Gnv7YrEtfJ yCug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=1i8IP1npvB+jek0gV2vHKdoxMC/Y1vKtNFhSYDVClis=; b=rLv641QtFJWSmH1SqPo8bbyJzg4kBisvD3mBq454W8dxGuYal8VJouqNJW8IbQ+VFm 0mJky5jlFAPnc6YkxoPDe34XjHHboGGe+IlDavRGhc/Wc68c0fUavICGr6SleTT02hok GJJWyU0EvmwH3O4J3WcLRb8g6HBVynwllbRTC22i7tbOJeaeYih7y5ZE1xZLBuWYO5Xa vIXybn+PkRozR8AHQZuKl7d6tP8jgfu3sk+CDvKm6kDiHg49G+4nzhRB8AzQIZn1Ts6y 7xPZmGrVjSjyiuGL/X8ghDjitiYi0E9uy3x+otXuCx80FxWDTTlWRr9+TJH2VN5OP3bR 7UvA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.157 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Return-Path: Received: from mo-csw.securemx.jp (mo-csw1115.securemx.jp. [210.130.202.157]) by gmr-mx.google.com with ESMTPS id a19-20020a056870b15300b00144a469b41dsi2589950oal.4.2023.01.02.06.58.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jan 2023 06:58:35 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.157 as permitted sender) client-ip=210.130.202.157; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.157 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: by mo-csw.securemx.jp (mx-mo-csw1115) id 302EwW4L029394; Mon, 2 Jan 2023 23:58:32 +0900 X-Iguazu-Qid: 2wGqnqi0HfirK7rrAu X-Iguazu-QSIG: v=2; s=0; t=1672671512; q=2wGqnqi0HfirK7rrAu; m=JrXL1WwW1n61Dcyt2flk5y1oTOHZdPvW/wTx5bFXYyw= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1111) id 302EwVFx019252 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 2 Jan 2023 23:58:31 +0900 From: venkata.pyla@toshiba-tsip.com To: isar-users@googlegroups.com Cc: venkata pyla , amikan@ilbers.de, jan.kiszka@siemens.com, henning.schild@siemens.com, kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com Subject: [PATCH] image.bbclass: fix non-reproducible file time-stamps inside rootfs image Date: Mon, 2 Jan 2023 20:28:28 +0530 X-TSB-HOP2: ON Message-Id: <20230102145828.32763-1-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 02 Jan 2023 14:58:30.0181 (UTC) FILETIME=[AD258D50:01D91EBA] X-TUID: Ul35HT394BEa From: venkata pyla 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 --- 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