summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-03 20:12:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-29 11:17:21 +0100
commit6282790b4ce177c96fa295dc4699ffbb3e4b314b (patch)
tree271074bc76945e27743928892303e3d8e0bfcbf9 /meta
parent6769bb83f9629997be369a985aba322e03d8d0c3 (diff)
downloadpoky-6282790b4ce177c96fa295dc4699ffbb3e4b314b.tar.gz
reproducible_build: Work around caching issues
SOURCE_DATE_EPOCH can be expanded early in the parsing process before the class extensions are applied. This can mean the directory pointed to for the SDE can be incorrect until later in parsing. Cache the file name in the cached value and allow it to dynamically update. This isn't ideal but avoding expansion of the variable likely isn't possible and I'm not sure how else to handle this. This works around the issue until a better solution can be found. (From OE-Core rev: 7e3752dcce2236a4d1ad046b1df2edf8ee5619b4) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 44dc97cd1223e4d2b635669627ec5f796838d42d) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/reproducible_build.bbclass11
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/classes/reproducible_build.bbclass b/meta/classes/reproducible_build.bbclass
index 1277764fab..62655c2a5b 100644
--- a/meta/classes/reproducible_build.bbclass
+++ b/meta/classes/reproducible_build.bbclass
@@ -90,11 +90,14 @@ python create_source_date_epoch_stamp() {
90} 90}
91 91
92def get_source_date_epoch_value(d): 92def get_source_date_epoch_value(d):
93 cached = d.getVar('__CACHED_SOURCE_DATE_EPOCH') 93 epochfile = d.getVar('SDE_FILE')
94 if cached: 94 cached, efile = d.getVar('__CACHED_SOURCE_DATE_EPOCH') or (None, None)
95 if cached and efile == epochfile:
95 return cached 96 return cached
96 97
97 epochfile = d.getVar('SDE_FILE') 98 if cached and epochfile != efile:
99 bb.debug(1, "Epoch file changed from %s to %s" % (efile, epochfile))
100
98 source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) 101 source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK'))
99 try: 102 try:
100 with open(epochfile, 'r') as f: 103 with open(epochfile, 'r') as f:
@@ -112,7 +115,7 @@ def get_source_date_epoch_value(d):
112 except FileNotFoundError: 115 except FileNotFoundError:
113 bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) 116 bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch))
114 117
115 d.setVar('__CACHED_SOURCE_DATE_EPOCH', str(source_date_epoch)) 118 d.setVar('__CACHED_SOURCE_DATE_EPOCH', (str(source_date_epoch), epochfile))
116 return str(source_date_epoch) 119 return str(source_date_epoch)
117 120
118export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" 121export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}"