diff options
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 89f645b858..7571c116c8 100644 --- a/meta/classes/reproducible_build.bbclass +++ b/meta/classes/reproducible_build.bbclass | |||
@@ -115,11 +115,14 @@ EPOCHTASK = "do_deploy_source_date_epoch" | |||
115 | do_unpack[postfuncs] += "create_source_date_epoch_stamp" | 115 | do_unpack[postfuncs] += "create_source_date_epoch_stamp" |
116 | 116 | ||
117 | def get_source_date_epoch_value(d): | 117 | def get_source_date_epoch_value(d): |
118 | cached = d.getVar('__CACHED_SOURCE_DATE_EPOCH') | 118 | epochfile = d.getVar('SDE_FILE') |
119 | if cached: | 119 | cached, efile = d.getVar('__CACHED_SOURCE_DATE_EPOCH') or (None, None) |
120 | if cached and efile == epochfile: | ||
120 | return cached | 121 | return cached |
121 | 122 | ||
122 | epochfile = d.getVar('SDE_FILE') | 123 | if cached and epochfile != efile: |
124 | bb.debug(1, "Epoch file changed from %s to %s" % (efile, epochfile)) | ||
125 | |||
123 | source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) | 126 | source_date_epoch = int(d.getVar('SOURCE_DATE_EPOCH_FALLBACK')) |
124 | try: | 127 | try: |
125 | with open(epochfile, 'r') as f: | 128 | with open(epochfile, 'r') as f: |
@@ -137,7 +140,7 @@ def get_source_date_epoch_value(d): | |||
137 | except FileNotFoundError: | 140 | except FileNotFoundError: |
138 | bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) | 141 | bb.debug(1, "Cannot find %s. SOURCE_DATE_EPOCH will default to %d" % (epochfile, source_date_epoch)) |
139 | 142 | ||
140 | d.setVar('__CACHED_SOURCE_DATE_EPOCH', str(source_date_epoch)) | 143 | d.setVar('__CACHED_SOURCE_DATE_EPOCH', (str(source_date_epoch), epochfile)) |
141 | return str(source_date_epoch) | 144 | return str(source_date_epoch) |
142 | 145 | ||
143 | export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" | 146 | export SOURCE_DATE_EPOCH ?= "${@get_source_date_epoch_value(d)}" |