summaryrefslogtreecommitdiffstats
path: root/meta/classes/native.bbclass
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2022-01-14 11:12:22 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-17 11:49:11 +0000
commit85b520587c127d39386d9c32f8cdf5cf70c42eeb (patch)
treef3a6e10e69ae3216ff71ae9d44fcd1904821509e /meta/classes/native.bbclass
parent02f87fc04ee982cd7ccd3690d0aee29cc5fa7e4e (diff)
downloadpoky-85b520587c127d39386d9c32f8cdf5cf70c42eeb.tar.gz
classes/native: Propagate dependencies to outhash
Native task outputs are directly run on the build system during the build after being built. Even if the output of a native recipe doesn't change, a change in one of its dependencies may cause a change in the output it generates (e.g. rpm output depends on the output of its dependent zstd library). This can cause poor interactions with hash equivalence, since this recipe's output-changing dependency is "hidden" and downstream tasks only see that this recipe has the same outhash and therefore is equivalent. This can result in different output in different cases and issues with reproducible builds in parcular (e.g. rpm compression changes for the same content). To resolve this, unhide the output-changing dependency by adding it's unihash to this tasks outhash calculation. Unfortunately, we don't know specifically know which dependencies are output-changing, so we have to add all of them. [YOCTO #14685] (From OE-Core rev: d6c7b9f4f0e61fa6546d3644e27abe3e96f597e2) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/native.bbclass')
-rw-r--r--meta/classes/native.bbclass31
1 files changed, 31 insertions, 0 deletions
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index 76a599bc15..fc7422c5d7 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -195,3 +195,34 @@ USE_NLS = "no"
195 195
196RECIPERDEPTASK = "do_populate_sysroot" 196RECIPERDEPTASK = "do_populate_sysroot"
197do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}" 197do_populate_sysroot[rdeptask] = "${RECIPERDEPTASK}"
198
199#
200# Native task outputs are directly run on the target (host) system after being
201# built. Even if the output of this recipe doesn't change, a change in one of
202# its dependencies may cause a change in the output it generates (e.g. rpm
203# output depends on the output of its dependent zstd library).
204#
205# This can cause poor interactions with hash equivalence, since this recipes
206# output-changing dependency is "hidden" and downstream task only see that this
207# recipe has the same outhash and therefore is equivalent. This can result in
208# different output in different cases.
209#
210# To resolve this, unhide the output-changing dependency by adding its unihash
211# to this tasks outhash calculation. Unfortunately, don't know specifically
212# know which dependencies are output-changing, so we have to add all of them.
213#
214python native_add_do_populate_sysroot_deps () {
215 current_task = "do_" + d.getVar("BB_CURRENTTASK")
216 if current_task != "do_populate_sysroot":
217 return
218
219 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
220 pn = d.getVar("PN")
221 deps = {
222 dep[0]:dep[6] for dep in taskdepdata.values() if
223 dep[1] == current_task and dep[0] != pn
224 }
225
226 d.setVar("HASHEQUIV_EXTRA_SIGDATA", "\n".join("%s: %s" % (k, deps[k]) for k in sorted(deps.keys())))
227}
228SSTATECREATEFUNCS += "native_add_do_populate_sysroot_deps"