diff mbox series

[v6,1/3] oe/reproducible: exclude __CACHED_SOURCE_DATE_EPOCH from task hash

Message ID 20261016105611.330514-2-daniel.turull@ericsson.com
State New
Headers show
Series spdx: add support to include releaseTime | expand

Commit Message

Daniel Turull Oct. 16, 2026, 10:56 a.m. UTC
From: Daniel Turull <daniel.turull@ericsson.com>

epochfile_read() memoizes its result into __CACHED_SOURCE_DATE_EPOCH
via d.setVar(), so its runtime value leaks into the basehash of any
task that calls it, causing a "metadata is not deterministic" error
once SDE_FILE is populated.

Exclude it, since it is not meaningful build metadata, using the
bb.parse.vardepsexclude decorator on the function itself.

AI-Generated: Uses Kiro with Claude Sonnet 5
Signed-off-by: Daniel Turull <daniel.turull@ericsson.com>
---
This should fix the selftest errors reported by Mathieu

v6: use bb.parse.vardepsexclude as requested by Richard
---
 meta/lib/oe/reproducible.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py
index a80376010a..d8e1dc825f 100644
--- a/meta/lib/oe/reproducible.py
+++ b/meta/lib/oe/reproducible.py
@@ -156,6 +156,9 @@  def get_source_date_epoch(d, sourcedir):
         fixed_source_date_epoch(d)       # Last resort
     )
 
+# epochfile_read() memoizes into __CACHED_SOURCE_DATE_EPOCH via d.setVar(), so
+# its runtime value must not leak into any task's hash.
+@bb.parse.vardepsexclude("__CACHED_SOURCE_DATE_EPOCH")
 def epochfile_read(epochfile, d):
     cached, efile = d.getVar('__CACHED_SOURCE_DATE_EPOCH') or (None, None)
     if cached and efile == epochfile: