From patchwork Mon Jan 9 16:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: venkata.pyla@toshiba-tsip.com X-Patchwork-Id: 2435 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 09 Jan 2023 17:05:47 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-pl1-f187.google.com (mail-pl1-f187.google.com [209.85.214.187]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 309G5jZr005692 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 9 Jan 2023 17:05:46 +0100 Received: by mail-pl1-f187.google.com with SMTP id c17-20020a170902d49100b00192be705f76sf6605660plg.13; Mon, 09 Jan 2023 08:05:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673280340; cv=pass; d=google.com; s=arc-20160816; b=ObrS2qvHelxpG/MPuiwuYbg6cASYn7aUnJrgFxRVmIN8XrpyQqn5Auqeh2CQk80oeH SclyOVPH9jqjWEh2VPFXkGsA0/NVZIK8/hVAcW138JK2Yzc/87aQy9NzU1aF6QR0Q/DN ZnVKj09Sjyd7A1iSIR5e8e2J1YTIcc5U64XEaFIYamJr/rGv4EVP1yBPNDBvFI6IEawI 7kRkgoKSlA9PE3XldFU0zRbEhYYC6HqLtsdJHL39ys12P+N+RH6e8wyZATG0PaVuTOGQ K87VLqcPDeCmipFzmaiTlgswKKc7SMz/7yKp00N+XPPDdZFsOmeHpId2SDzUey1Sc3SW luBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=7pJGv7DrZHdtl44srfy1+XjX3Kn9xWNLft6piJpxUTg=; b=MyWiyCEBBoWWM9b1YniHJ2WwOOovtXGC920en+f6Fmx3KgbDMKJtHzC/9nRW7Uyk50 m6ldx6iLUPMseRK+/7xE2/DaNkRAdxfg/SIhE0Cz6zjnXygpTxpS/nZiBuA/QIz8vX/y lw/c5Wm5wk7s4tcp87RI72+bnzGGd8R2GHuUW977npXwij7nfYBtCetdc4KjbwRx2ESs PWYb0lQ4AoRkgDFJjgD91Gf/fHMsZgAafNoVlaCnut8Q4MZiGms4jlxWjPgoHjyyUfag xYPDoB8rdDjp0hrtg7Y+XvU++fY3Rs4AORwhfr1UB0KQl8cGea8JnzwWzMvuSwIssUol zbDA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=7pJGv7DrZHdtl44srfy1+XjX3Kn9xWNLft6piJpxUTg=; b=Vb8CGVoaU28WJoJdYi7QlJtR4NkPdLV1zMJJaKRm5vGc4m5E9Gc67CqCAq2lthLTeb R4FSxyoh4SUK1uIkG6d0VW+hw/ZQ/ez8XnoE8j5KfBWFG8Nlz0DOdr0W6G8YQVp1zYQ5 GOsf5fxT1wMh3yyfaXTkvQNvpVSN0aA9VgpR1HTJXpU13VuoyI/7H5c34hK5YevFzhSO 0dk5bi8l+Pl0vHXm/4JM0MUeKe/bn0hymjJ6f3vOUa71lwitF93h4weXHzWkalvdm2ET 5JTMA2i64qJ4+HFTbeI+CfemsnP5QM/lPYTpviz4C+8Ew042bs+5Evtpkg5E0uI+jceZ lKxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=7pJGv7DrZHdtl44srfy1+XjX3Kn9xWNLft6piJpxUTg=; b=pjUQSrQw92jJCbwjLMah1ZGtEKePem6SM2UzNyp4UZBI6RYITTpDzshXaiBcr12iDz tD9UKl/KEvg8qQWvsp14kHxq38I3bC49nQCU44QKVY1PJ2ZwchlWh1Aw/DJDiNx0op0V ARYGyut3Zqlpo0HyyZpPsxUE2DaNGc182HGU11fJuaBPha5A4xWaGJ1dTnLjge8bV6rl hy94mDmJG86G9YLi14PU01Q6Xhp19tK3BXi3Kt+G+uxdS/WLU3MQvA6dErnSGF9xUzXp nTaGsGwjPoq4LLIQn63kGqJnA8YbvlX3dgP9+B9ViRaARp2XXULVtRtbzlCVuFZgRkkb eA2g== Sender: isar-users@googlegroups.com X-Gm-Message-State: AFqh2kri2cR8fLEeflbBkTs4ksprN8YzCYIh+oCqULZZPiVBo8Efa3gs coNKery7wNNzmuZg1jZ2I0M= X-Google-Smtp-Source: AMrXdXuRjOFnZstVAlWvBwRN8WCUyr3NZhKryvIJrhDPmgkRBAMarp+RdiqzS1JVWqBJCs5R+Ankig== X-Received: by 2002:a17:902:9e05:b0:193:39bf:5a27 with SMTP id d5-20020a1709029e0500b0019339bf5a27mr134987plq.86.1673280340301; Mon, 09 Jan 2023 08:05:40 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:90a:4d0a:b0:219:84d6:9802 with SMTP id c10-20020a17090a4d0a00b0021984d69802ls9578749pjg.3.-pod-canary-gmail; Mon, 09 Jan 2023 08:05:39 -0800 (PST) X-Received: by 2002:a17:902:7c8a:b0:192:835d:c861 with SMTP id y10-20020a1709027c8a00b00192835dc861mr46288407pll.68.1673280339604; Mon, 09 Jan 2023 08:05:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673280339; cv=none; d=google.com; s=arc-20160816; b=BMAh2D9aQZydl6ZfJV3R/hrUA/Hy4sdlhar817LjJNGJxO0gbGzy3+We+z/vGtoHLy i1+bHUa61MxE73HVNUACN8DaMFq6Kmwrj17sUjQpSnHQHASO4cmUkaWjvWVa2L7yf4ek owi4xSEWgOshenrkdtG2QKSCTd2sKfZYZMdZcUp8+IV+7EfKKjESK+XE5kR8bGWJUcmf kNnkQvS4Rbo6MJcuLfrt1vYKgfDyc02NgsOeUHH3lEoqL/L+DvX6w9O5B6pGQhUJyifW xgiLQ9fL6WpEVecE9YRyHhIc+G8U7ilW4C+bMIR8ug4Bx5VFKk7o11R41F8YaJpT+GXA o/zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=vTXoYftK/VLF/Yq8s/N2kdcLVbD3mn5qe2lX0D+JQHo=; b=RirV+V6BkkxE0gY0M49su7aXPXTqnL5tBZGVYglHeGrLHYom7jd6DaRCBbqbRx129r K+ouDD1fXZuuzO+P5zz+r2K7RtRrJHG5vbtgF5I6MG/MBD5RGC9EwmaSN6lVamSdscQN FpVSFBF4+q82VzRt0pAiK4yHAp7UT39JBzfynDtAmiuCF7/Aq8VR4kD0rNZQ6jFmU8ee UtOW76kHJP89BFSC9zVFf9r89aYxspKc9YAVvW4Qy0a9zSVcQBUUwWe2ekg6ZZQp3hRU mQD3Ht1eYYgWyHMNO0gQeg2mEx0nMdi6D13ZpjHB7FTzo7J1/VCyIKPSpBYRHZ/qercz wuUg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: from mo-csw.securemx.jp (mo-csw1116.securemx.jp. [210.130.202.158]) by gmr-mx.google.com with ESMTPS id m3-20020a170902db0300b00188a88cc62fsi600487plx.12.2023.01.09.08.05.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Jan 2023 08:05:39 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) client-ip=210.130.202.158; Received: by mo-csw.securemx.jp (mx-mo-csw1116) id 309G5bbF021317; Tue, 10 Jan 2023 01:05:37 +0900 X-Iguazu-Qid: 2wGr5g72QFIOA7j8jo X-Iguazu-QSIG: v=2; s=0; t=1673280337; q=2wGr5g72QFIOA7j8jo; m=xYw5E6WH/XyikziDTjp/OmiYwpx5HMGHNHQey3R+u9M= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1112) id 309G5apk017289 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 10 Jan 2023 01:05:36 +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 v4 1/1] image.bbclass: fix non-reproducible file time-stamps inside rootfs Date: Mon, 9 Jan 2023 21:35:46 +0530 X-TSB-HOP2: ON Message-Id: <20230109160546.26339-2-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230109160546.26339-1-venkata.pyla@toshiba-tsip.com> References: <20230109160546.26339-1-venkata.pyla@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 09 Jan 2023 16:05:32.0705 (UTC) FILETIME=[33A64110:01D92444] X-Original-Sender: venkata.pyla@toshiba-tsip.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.158 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= 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 image.bbclass Signed-off-by: venkata pyla --- meta-isar/conf/local.conf.sample | 10 ++++++++++ meta/classes/image.bbclass | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample index 57d0620..3c4a473 100644 --- a/meta-isar/conf/local.conf.sample +++ b/meta-isar/conf/local.conf.sample @@ -255,3 +255,13 @@ USER_isar[flags] += "clear-text-password" #CCACHE_TOP_DIR ?= "${TMPDIR}/ccache" # Enable ccache debug mode #CCACHE_DEBUG = "1" + +# Uncommnet and add value to it to build images reproducibly +# +# The value for `SOURCE_DATE_EPOCH` should be latest source change time in +# seconds since the Epoch. +# Git repository users can use value from 'git log -1 --pretty=%ct' +# Non git repository users can use value from 'stat -c%Y ChangeLog' +# To know more details about this variable and how to set the value refer below +# https://reproducible-builds.org/docs/source-date-epoch/ +#SOURCE_DATE_EPOCH = diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 813e1f3..38a8609 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -431,6 +431,16 @@ do_rootfs_finalize() { rm -f "${ROOTFSDIR}/etc/apt/sources-list" EOSUDO + + # 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}" && \ + sudo 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} ';' > ${DEPLOY_DIR_IMAGE}/files.modified_timestamps && \ + bbwarn "$(grep ^f ${DEPLOY_DIR_IMAGE}/files.modified_timestamps) \nModified above file timestamps to build image reproducibly" + } addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess