diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-03 20:12:26 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-29 14:28:34 +0100 |
commit | 0e6f0e2c6776afde1e9a2f3e3474e4d24dd24f65 (patch) | |
tree | 228cefb11446664fe11319a7d90c8ca6c0f0f375 /meta/classes/reproducible_build.bbclass | |
parent | f706d3a2cbb8231e95b7a5f8f38d75153ff8b474 (diff) | |
download | poky-0e6f0e2c6776afde1e9a2f3e3474e4d24dd24f65.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: 257eb2ee73831afe84600235c967cbb4c2627e26)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 44dc97cd1223e4d2b635669627ec5f796838d42d)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/reproducible_build.bbclass')
-rw-r--r-- | meta/classes/reproducible_build.bbclass | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/classes/reproducible_build.bbclass b/meta/classes/reproducible_build.bbclass index f06e00d70d..43cf9dc894 100644 --- a/meta/classes/reproducible_build.bbclass +++ b/meta/classes/reproducible_build.bbclass | |||
@@ -91,11 +91,14 @@ python create_source_date_epoch_stamp() { | |||
91 | } | 91 | } |
92 | 92 | ||
93 | def get_source_date_epoch_value(d): | 93 | def get_source_date_epoch_value(d): |
94 | cached = d.getVar('__CACHED_SOURCE_DATE_EPOCH') | 94 | epochfile = d.getVar('SDE_FILE') |
95 | if cached: | 95 | cached, efile = d.getVar('__CACHED_SOURCE_DATE_EPOCH') or (None, None) |
96 | if cached and efile == epochfile: | ||
96 | return cached | 97 | return cached |
97 | 98 | ||
98 | epochfile = d.getVar('SDE_FILE') | 99 | if cached and epochfile != efile: |
100 | bb.debug(1, "Epoch file changed from %s to %s" % (efile, epochfile)) | ||
101 | |||
99 | source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) | 102 | source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) |
100 | if os.path.isfile(epochfile): | 103 | if os.path.isfile(epochfile): |
101 | with open(epochfile, 'r') as f: | 104 | with open(epochfile, 'r') as f: |
@@ -113,7 +116,7 @@ def get_source_date_epoch_value(d): | |||
113 | else: | 116 | else: |
114 | bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) | 117 | bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) |
115 | 118 | ||
116 | d.setVar('__CACHED_SOURCE_DATE_EPOCH', str(source_date_epoch)) | 119 | d.setVar('__CACHED_SOURCE_DATE_EPOCH', (str(source_date_epoch), epochfile)) |
117 | return str(source_date_epoch) | 120 | return str(source_date_epoch) |
118 | 121 | ||
119 | export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" | 122 | export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" |