From patchwork Thu Dec 7 15:41:13 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: 3230 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Thu, 07 Dec 2023 16:41:34 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-qv1-f57.google.com (mail-qv1-f57.google.com [209.85.219.57]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 3B7FfXHs030726 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 7 Dec 2023 16:41:34 +0100 Received: by mail-qv1-f57.google.com with SMTP id 6a1803df08f44-67add991c9bsf12040836d6.1 for ; Thu, 07 Dec 2023 07:41:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701963688; cv=pass; d=google.com; s=arc-20160816; b=kROX4Ooq7S4dj38SYFuHAxneDg9t66oUxUhWk7MIQImx2rGQW1gSG8qkX6hXBXG5Vd zL/2rw3peB1K+tUQleEW68HmYcKNdHzQIwg+PqV7tEjGCYYhHKkEh9pWL72Q7AXFnEZc A2286Zfvc3Aba/eWO/JFXoVZoit95Sayj9XJXdvS6W3FtzLMxySgF6eU9Je+ab4MwPnH +CQ7bxaTA4SWSfQ2tgpwlf/8htOLGY20OEQA7x/y9F/JV31AZIgcxF4XvGF49Qvn6Jhx MhuRyd10TY8ui9LeNvdjE9ZSsuVzDiXZ9w5+cFCZ5B/F1/LDrakiYxtzwIqT4GKiZdbK Z/2g== 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=SSTDvyQDGiyXoERjMmCP9DY3rQn60h61OZknFc025jo=; fh=0lUGB2344BCNlOMKgxbVcIhrk5SvZVfMXmxQVZJT4o8=; b=KTnjO4gYWuc05WE49+fn+/JFzHYzHcffsB60K7PTuZhr4tBLA62i/hyxiQYEwuvoS5 8QopeT9BQjT1YQ/5wv5E4Lm2Z2QwZ2C1Zf5bIrIBi97304F02XTx/OWZnDk+7YWGOGxW rvqOQNvnWXb5tcWDlWTTlrLGEdo1ZsuY7VbVKpBf0kUXxeXKT4zs8/4a69vie/Ip6ifY 3Yvemtm35wrJgT8r6jZcy1gM+kyYWmdgTYYYLq3He3sL5eC2HpOVLK0jsSb9/X6QqMvr P9J18YuYU27BS2AQzDzJRDpXhj7LzX1IhC8MN69FOVJR1P4cDd4todtKIcT5tt1KKVe8 iQNw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.134 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1701963688; x=1702568488; darn=isar-build.org; 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=SSTDvyQDGiyXoERjMmCP9DY3rQn60h61OZknFc025jo=; b=R91XpLH4NeRu023j4MWGu4kR/W8O9YiTIiPwBicp/mLVP5U6nepEZO30dwjo+KpoXW 7CMF37eYYsbqVpP+4TlXnPK+hgE9dMGRyWUuTc9/4PL2lvu3qUkROz9h4yQTyEef6j+o KlY4wsLZwVi2iueYyfRfG27DjWs8j8jwEF4ZC+BULskWoCOacD6U5brKLLNyTsrhGj9Z scPCZxZIzKTNppKb3COka1DBG1XoY0nbCByAJN+imGQwHebW92wXgBlqP+hfCpetGL6c yG9bgvdsX75ZI/Q5QxgGnPAv6Zb7CX67FqaRCnvgPDinOAHgN+ymyYGneG5yCpU+4J9X vetA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701963688; x=1702568488; 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-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=SSTDvyQDGiyXoERjMmCP9DY3rQn60h61OZknFc025jo=; b=CMJkE8VL4uX57Vlw26itwzLJ9hY8bIMAGe05PbZ4EFR5YK7NmYv0M45XyGUy8Prtts SJPl+cesXuCcKTptYDA6FBQoAI0cgBsXMyNPRZhCEqhZ3vAmGc1npchF4MJOYmEUF4y2 IiQ4iDmWcCo0KlIXlGtiisloqRRltApL31plfnnrGe2t+eRuXidaxA9W/j8TWq4BYYjm EQga70pIoNv89zUuyrTT6YalURTwkiDs3W+owWd2dKvN100QQ7CJ6ikBVsV3EKPn815u BuIz0fy5hJdJHUwSCbk1AZsMZy2OOK0BO4jJepLSiPJW6r81qnOKpHkY+CeZmZF7sIMo GE2A== Sender: isar-users@googlegroups.com X-Gm-Message-State: AOJu0YwLauH2/NhT/p12EtIVDtbhmm1uMiGn+w33AJDuqNnPBUCSvVzm tHOsBcCN9mz8UnqicrA6L8M= X-Google-Smtp-Source: AGHT+IGaLZLZCnWUmXf1KGcdseT4OLtOOl+5NRvNwLKXbS2OoOfkdRzlzIroTptEWwA8aTRihAbdzg== X-Received: by 2002:a0c:ed34:0:b0:67a:9cd1:6b18 with SMTP id u20-20020a0ced34000000b0067a9cd16b18mr2585821qvq.48.1701963687944; Thu, 07 Dec 2023 07:41:27 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6214:1242:b0:67a:bf7a:7ba6 with SMTP id r2-20020a056214124200b0067abf7a7ba6ls1190020qvv.1.-pod-prod-01-us; Thu, 07 Dec 2023 07:41:26 -0800 (PST) X-Received: by 2002:a05:6102:511e:b0:464:7c56:d827 with SMTP id bm30-20020a056102511e00b004647c56d827mr3017380vsb.60.1701963686620; Thu, 07 Dec 2023 07:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701963686; cv=none; d=google.com; s=arc-20160816; b=YxHiQtSx4pocU6XpMNmbZlhA0bVuzxs8PFC1CWpy+cOSbtR4FdhsSO9IFleKeEMNpM DksOXGgKuN4QSLr4b6Aov9ggExa3eIAHbkqxZSzDusGDiriZQSs8fqWf1w0klGy/9cfL kjTPVRW2yxhgWB1fbX83lxYWrJ9v9gmzAIsB25fgllVDbLAdSI3redaBIaICYECYwD6+ uXU97YX9+l55P2y8bSmLuhPvp9sT4eNQkpKWnfeNqoC3mADWqmReW0ogBwFcBcI344pH 4Wa2ix8wZvqoOpaxzA77NfVLJ3WNcNKtzpTVFaPZIJkRUYV7l/SMUbtnqMi1RV6BsP0T LBlQ== 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=3Jno3Dgkk5+HWp0gRTwL9FCy3cqK4loaRFpvMQkRfK4=; fh=0lUGB2344BCNlOMKgxbVcIhrk5SvZVfMXmxQVZJT4o8=; b=oGvEpfAhkYZBl14nwfrwgw14bCB/3lfmB/75SF8i3Vr8Zle+mjQIX/So2N+rBHhUes RhuVU+gbbemYjgXclHuhSRZj7tiZp+0oETvN6UnjVPx99MEudWdT9SgFD3u6+kkaKIco lE6VMR3lbh7apX9/s/JbDngbHUFFnBi8MFQme/ZPJ8X5V+Ov8i+c0pVP06uoi3Lea681 wXFKkUplpxFI7ow4Z6qjXWXy/NwoMd05NYyNf7/8moRNm1vCW1A1y7AID3o6bsbvY0eu IWOZCCJHvygAB0C87KgaZ0OKJMTQh8BJCWXSZgIQPI+Wu/EUzNYQsbGOZsO26eZHT2JE dXgA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.134 as permitted sender) smtp.mailfrom=venkata.pyla@toshiba-tsip.com Received: from mo-csw.securemx.jp (mo-csw1800.securemx.jp. [210.130.202.134]) by gmr-mx.google.com with ESMTPS id bq17-20020ab03e11000000b007c56697eaefsi122830uab.1.2023.12.07.07.41.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 07:41:25 -0800 (PST) Received-SPF: pass (google.com: domain of venkata.pyla@toshiba-tsip.com designates 210.130.202.134 as permitted sender) client-ip=210.130.202.134; Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 3B7FfMd34084148; Fri, 8 Dec 2023 00:41:23 +0900 X-Iguazu-Qid: 2yAbPDmovHUXRs1X5E X-Iguazu-QSIG: v=2; s=0; t=1701963682; q=2yAbPDmovHUXRs1X5E; m=mp+9d9LxgmiyUI6KWA8JFKwGK6pFtuaH5nb3zg8QN+U= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1801) id 3B7FfM1a668078 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 8 Dec 2023 00:41:22 +0900 From: venkata.pyla@toshiba-tsip.com To: isar-users@googlegroups.com Cc: venkata pyla , jan.kiszka@siemens.com, kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com, felix.moessbauer@siemens.com Subject: [PATCH 4/5] wic: honor the SOURCE_DATE_EPOCH in case of updated fstab Date: Thu, 7 Dec 2023 21:11:13 +0530 X-TSB-HOP2: ON Message-Id: <20231207154114.20400-5-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231207154114.20400-1-venkata.pyla@toshiba-tsip.com> References: <20231207154114.20400-1-venkata.pyla@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 07 Dec 2023 15:41:14.0667 (UTC) FILETIME=[CFBC4FB0:01DA2923] 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.134 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,RCVD_IN_MSPIKE_H2,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 In case user requested to build a binary repeatable package, it's required to honor the SOURCE_DATE_EPOCH environment variable. So forcefully set mtime inside all the routines which modify fstab in case it is updated. Taken from openembedded-core: 99719a3712a88dce8450994d995803e126e49115 Signed-off-by: venkata pyla --- scripts/lib/wic/partition.py | 7 ++++++- scripts/lib/wic/plugins/imager/direct.py | 3 +++ scripts/lib/wic/plugins/source/rootfs.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 90b2c037..44b1277e 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -305,6 +305,11 @@ class Partition(): f.write("cd etc\n") f.write("rm fstab\n") f.write("write %s fstab\n" % (self.updated_fstab_path)) + if os.getenv('SOURCE_DATE_EPOCH'): + fstab_time = int(os.getenv('SOURCE_DATE_EPOCH')) + for time in ["atime", "mtime", "ctime"]: + f.write("set_inode_field fstab %s %s\n" % (time, hex(fstab_time))) + f.write("set_inode_field fstab %s_extra 0\n" % (time)) debugfs_cmd = "debugfs -w -f %s %s" % (debugfs_script_path, rootfs) exec_native_cmd(debugfs_cmd, native_sysroot) @@ -364,7 +369,7 @@ class Partition(): exec_native_cmd(mcopy_cmd, native_sysroot) if self.updated_fstab_path and self.has_fstab and not self.no_fstab_update: - mcopy_cmd = "mcopy -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path) + mcopy_cmd = "mcopy -m -i %s %s ::/etc/fstab" % (rootfs, self.updated_fstab_path) exec_native_cmd(mcopy_cmd, native_sysroot) chmod_cmd = "chmod 644 %s" % rootfs diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index c44159b2..4d8f9216 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -149,6 +149,9 @@ class DirectPlugin(ImagerPlugin): self.updated_fstab_path = os.path.join(self.workdir, "fstab") with open(self.updated_fstab_path, "w") as f: f.writelines(fstab_lines) + if os.getenv('SOURCE_DATE_EPOCH'): + fstab_time = int(os.getenv('SOURCE_DATE_EPOCH')) + os.utime(self.updated_fstab_path, (fstab_time, fstab_time)) def _full_path(self, path, name, extention): """ Construct full file path to a file we generate. """ diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index fc06312e..e29f3a4c 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -224,7 +224,7 @@ class RootfsPlugin(SourcePlugin): if part.update_fstab_in_rootfs and part.has_fstab and not part.no_fstab_update: fstab_path = os.path.join(new_rootfs, "etc/fstab") # Assume that fstab should always be owned by root with fixed permissions - install_cmd = "install -m 0644 %s %s" % (part.updated_fstab_path, fstab_path) + install_cmd = "install -m 0644 -p %s %s" % (part.updated_fstab_path, fstab_path) if new_pseudo: pseudo = cls.__get_pseudo(native_sysroot, new_rootfs, new_pseudo) else: