summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-10-17 14:27:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-10-27 11:37:42 +0000
commitcdcd128aae02ee6edb051ea92ba7f4ccf091bbad (patch)
tree413e4d1b0b932121fba9ef07ee55a1b687473432
parent487588813871b716b7d02f7e9b4d457af6b56851 (diff)
downloadpoky-cdcd128aae02ee6edb051ea92ba7f4ccf091bbad.tar.gz
classes/cargo_common: ensure B is clean
The cargo class defaults to out-of-tree builds in WORKDIR/build, but at no point was that directory cleaned. This causes problems with the rust standard library recipe (libstd-rs) which installs manually with cp, so rebuilds can be contaminated with the contents of previous builds. I believe that post-release we should switch cargo.bbclass to mandating out-of-tree builds to reduce the complexity, but for now in out-of-tree builds we can just delete the ${B}/target directory. Note that we use ${B}/target because there at least were reasons to use that name[1], it is unclear if these limitations still hold. We can't simply clean ${B} because that will break recipes that use cargo and something else to build, for example librsvg. [1] https://github.com/rust-lang/cargo/pull/1657 (From OE-Core rev: 1452ac7a44196454a52f3f6d883290ddcccfd3f8) (From OE-Core rev: 9d9ce457630ea7403ffe7028e3370647db0b83fa) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-recipe/cargo_common.bbclass4
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
index c9eb2d09a5..bc44ad7918 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -110,6 +110,10 @@ cargo_common_do_configure () {
110 # Put build output in build directory preferred by bitbake instead of 110 # Put build output in build directory preferred by bitbake instead of
111 # inside source directory unless they are the same 111 # inside source directory unless they are the same
112 if [ "${B}" != "${S}" ]; then 112 if [ "${B}" != "${S}" ]; then
113 # We should consider mandating out-of-tree builds and just using [cleandirs]
114 rm -rf ${B}/target
115 mkdir -p ${B}
116
113 cat <<- EOF >> ${CARGO_HOME}/config.toml 117 cat <<- EOF >> ${CARGO_HOME}/config.toml
114 118
115 [build] 119 [build]