From 7a31cf96eb47049f4cefe6e7f1eaaad32db8730c Mon Sep 17 00:00:00 2001 From: Sergei Zhmylev Date: Fri, 21 Oct 2022 17:56:22 +0300 Subject: wic: honor the SOURCE_DATE_EPOCH in case of updated fstab 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. (From OE-Core rev: 2671667f33d0eac1425db3fc4dff56d4eed1eb3c) Signed-off-by: Sergei Zhmylev Signed-off-by: Alexandre Belloni (cherry picked from commit 99719a3712a88dce8450994d995803e126e49115) Signed-off-by: Steve Sakoman Signed-off-by: Richard Purdie --- scripts/lib/wic/plugins/imager/direct.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts/lib/wic/plugins/imager/direct.py') diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py index 4d0b836ef6..685d19b30f 100644 --- a/scripts/lib/wic/plugins/imager/direct.py +++ b/scripts/lib/wic/plugins/imager/direct.py @@ -148,6 +148,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. """ -- cgit v1.2.3-54-g00ecf