From patchwork Thu Jan 5 06:18:57 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: 2405 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Thu, 05 Jan 2023 07:19:11 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-il1-f185.google.com (mail-il1-f185.google.com [209.85.166.185]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 3056JAGq006460 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 Jan 2023 07:19:11 +0100 Received: by mail-il1-f185.google.com with SMTP id y11-20020a056e02178b00b0030c048d64a7sf16675485ilu.1; Wed, 04 Jan 2023 22:19:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672899545; cv=pass; d=google.com; s=arc-20160816; b=JlLpINF78lflmLhKCtuXegsE+GaP3DrRH4xHnkZiCH+ZwmXpQ6t+TAgnNY42OHnK/H vAQV08qcnoe7v6ZIhdpy+LKHLF+2klfy5xKOtJIuWDRTAj/7TmJe7iaDJwQShw+or4HT uoqNBeyWUcowQW5S/8Cqz3vPwhT8+jMi1sQ2Ekl+Sm2QkYbw451Pv9NmyYu3AboA4E1M 8ikB27bz4X71FFXrOpONL+iXwkebQyiBVVzAv8nhXXDHC/Nvs+6rFlC/FH68/9xiyT37 uTQzpVjRFmChsdeWXQgxH3FLIzt0XCJEXMJUh9eoQZ0KR1mSNx/4bMhkfirNRNl6Lrs9 IFZg== 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=89adOvssrq536bso8/S/4iHv6U4guTEmKNlJZD/HI9A=; b=c1OCavH851Wk7+J1tV9PTj4UTKNMPo4UH/Z5jccYEXx67asSNJUT5qAqCP9jZQzRTl JjNvdKIDyEiSE6e/HTXpSg3L4rhgsKCmE/lsLyyQj0z90Sq2NAGQ+kKJfDkT4uq2QvKk 7SYIMB9fQjuwLJbkxvLiislEPyOcXJxQUPEnR8lnJXyV58kaXr/oWMRD3FiWreEF2+np 6cTM8oz6KcRJhrpPiLssG8DtibXTbP9vSTcUuUaCpNYOH46AuzkOsUihdWdd3kSmPqXx qgc+TjRKCfhgSbZv3CdawnvvhCpatWKhFl9WnON5Yl19Zd7ciAc7ve49jwrSEd5xa71a R43w== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.156 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=89adOvssrq536bso8/S/4iHv6U4guTEmKNlJZD/HI9A=; b=Ixu5L+3GddwtbjJLlG4aKgN1ry9hvCWhKL6oCA3CTYUIxkyoA1etV5bOKdjYNmVU8n JGqfXVK7xEwP2RpbEgCKulS345/Rzviqkr3YW3vaiJCPZIiUTJWsdPgEvURAsBM1GDrY kiHBa7qRcWVTe/2/oQh7mw9OvvTFQkZRsd6jQjSoLkpiw4TLThK73rV6XOTE2YK3C6bO CvqO39pLC+QHRi84C3U7mUtZECCmhW6RaElEkOyC2maPwbESXpIVcTKENstBtdIkhtmA AN88DqvRLTd8IXQkN1FgxBvTFBGbeVKF77dYJoPXDv3V1sQQ28iMvQnXa+BJOa01eeEu jXnA== 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=89adOvssrq536bso8/S/4iHv6U4guTEmKNlJZD/HI9A=; b=uCf3yPwR3+F3qiiOb89GDgwJWlcpr/DwNAaYrJM1IyNJ3OOLids2L8LcS3qEp7dvLr B/FMoqSz9LJ5cYa0JcgqpG0aKtOsAzxy1Qh8y2O9p9hDKBY9LszO2MJWbtREdJj2hbBw Md5A8d8Wb/mi4tFtsv5ZLMJeCke1vsC+JLmjUaRosrV4t0A3dgOvFrDYBrZZeu7Wgsfa u9657fCVgILmNOHYqpuUZssS3nH3UOThV0OsMCRIk+s4BuXlGHuhTT4VSGlXbezi50rd HKBQGju3qLwMWaGOzD+n8pvSkFcOR0qed9RrLB4DGHCaOjsaP6kxDoOmoR9H5RTFptkv 0ujg== Sender: isar-users@googlegroups.com X-Gm-Message-State: AFqh2krzlqDGfPpS4hUlp3XnymAI6QxhM457grAHjWGyHDKEV7OCfUig eEL0yvdyJn+YVixTMIwVMgc= X-Google-Smtp-Source: AMrXdXvlsqsE2LOOdCv2xby3pwa0wm5pHhA3NzX+taBUPdM3i8OnMPIIXKag7GeUTTxcenL9Wo0a7w== X-Received: by 2002:a92:c54f:0:b0:303:3119:420e with SMTP id a15-20020a92c54f000000b003033119420emr4824880ilj.320.1672899544942; Wed, 04 Jan 2023 22:19:04 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a92:c7c7:0:b0:305:c221:5e07 with SMTP id g7-20020a92c7c7000000b00305c2215e07ls2393901ilk.0.-pod-prod-gmail; Wed, 04 Jan 2023 22:19:04 -0800 (PST) X-Received: by 2002:a92:c748:0:b0:30b:f2a7:92c2 with SMTP id y8-20020a92c748000000b0030bf2a792c2mr27147830ilp.7.1672899544420; Wed, 04 Jan 2023 22:19:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672899544; cv=none; d=google.com; s=arc-20160816; b=qtTdIe3Mcr7fGgnKhPxnlFWVURMYUtTzYzGLS93Er6D22ebKKePaNqGxdYaRj8YPSl 1EcH7muUWuI6kGg7D2B3oEVMoGte4vEf2fOk8k2O7RUZkDisqSwu6gic9QutpnlUYdeF /SY3auN+xBZYj38fCoGZSN4dWiHaAPJuv7hjABlXZk7Tko9vVDitMfnOZUxIviXBw3oY ODPw5rXqiQfTF4HJpmx0hb2AzVqtA3aWYDjo0enTS4yQAyuwHntVqiycEmyMzv+lbHm/ 7SzMfs3pJx22boh+qWs7lMWlA54WHEJHC2pvh9XUtz6efQJRjW+eKXRVaZnx+78WFOeH YJXw== 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=yL5iG7iItA8n4tun7JDcutls5VY3sAV9NLsLcsSqFpg=; b=Sg2YcfS74muNpzrXXd7OQ5xmcbs8aHACNelSAK0ypX/Fb6JoI1ufhZYsf2UK8rKxBL NAWxKDMhQotHHRBM1HAaqqt4fxCcazgHdy3X7NYDNh6NbpKIuzxLelryA8zhAeURgN6y yj0LwrljSAGvqDy7iWk9XIzWnVig0poDsBs0/mfBhcvYkCSbag8OeHVjNjQW+c6uryee oT+qtrhSzBUQE41SW0fnvq4h9WhMXKzy/s/K2zBG7AQkOmdPdtVs0xltpJv14fIyvaO4 WJHkbtmYL4j64i2ug5XlfHpuey0xGfIcNNCstjvKOA8GKt1Cf7CIE9ruEF4Npc0LXR5z oduA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.156 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: from mo-csw.securemx.jp (mo-csw1114.securemx.jp. [210.130.202.156]) by gmr-mx.google.com with ESMTPS id b3-20020a056e020c8300b00300ee6fc286si3638908ile.3.2023.01.04.22.19.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jan 2023 22:19:03 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.156 as permitted sender) client-ip=210.130.202.156; Received: by mo-csw.securemx.jp (mx-mo-csw1114) id 3056J101009732; Thu, 5 Jan 2023 15:19:02 +0900 X-Iguazu-Qid: 2wGqiQJF0gksTyQJrE X-Iguazu-QSIG: v=2; s=0; t=1672899541; q=2wGqiQJF0gksTyQJrE; m=mXhz1HCsbzqlsTaDMKKWsf9U0s4TYs29YOjaHNMk5yM= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1110) id 3056J01h012411 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 5 Jan 2023 15:19:01 +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 v2 1/1] image.bbclass: fix non-reproducible file time-stamps inside rootfs Date: Thu, 5 Jan 2023 11:48:57 +0530 X-TSB-HOP2: ON Message-Id: <20230105061857.14993-2-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 05 Jan 2023 06:18:58.0999 (UTC) FILETIME=[98E9E470:01D920CD] 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.156 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.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 --- meta-isar/conf/local.conf.sample | 10 ++++++++++ meta/classes/image.bbclass | 9 +++++++++ 2 files changed, 19 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..38a9adf 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} ';' > ${DEPLOY_DIR_IMAGE}/files.modified_timestamps + EOSUDO } addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess