diff mbox series

[1/4] package_manager: pass REPRODUCIBLE_TIMESTAMP_ROOTFS to intercepts

Message ID 20261013-fontcache-reproducible-mtime-v1-1-950f07b80f0f@gmail.com
State Under Review
Headers show
Series fontcache: make the caches built into an image valid | expand

Commit Message

Alex Kiernan Oct. 13, 2026, 10:49 a.m. UTC
do_rootfs marks REPRODUCIBLE_TIMESTAMP_ROOTFS for export, but that only
reaches the shell functions it emits afterwards. The task's environment
is fixed when it starts, so the postinst intercepts, which run from it,
never see the timestamp every file in the image will end up with. Set it
alongside D and STAGING_DIR_NATIVE.

AI-Generated: Claude Opus 5.5 (Claude Code)
---
 meta/lib/oe/package_manager/__init__.py | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index 88bc5ab19520..76289c911b0b 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -223,6 +223,12 @@  class PackageManager(object, metaclass=ABCMeta):
         bb.note("Running intercept scripts:")
         os.environ['D'] = self.target_rootfs
         os.environ['STAGING_DIR_NATIVE'] = self.d.getVar('STAGING_DIR_NATIVE')
+        # The mtime every file in the image will end with; intercepts that
+        # record an mtime need it, and do_rootfs only exports it to shell
+        # functions it emits, not to the environment they run in.
+        timestamp = self.d.getVar('REPRODUCIBLE_TIMESTAMP_ROOTFS')
+        if timestamp:
+            os.environ['REPRODUCIBLE_TIMESTAMP_ROOTFS'] = timestamp
         for script in os.listdir(intercepts_dir):
             script_full = os.path.join(intercepts_dir, script)