From patchwork Sat Nov 8 20:15:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Murray X-Patchwork-Id: 74022 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73A0CCCFA18 for ; Sat, 8 Nov 2025 20:16:20 +0000 (UTC) Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.13111.1762632971163557759 for ; Sat, 08 Nov 2025 12:16:11 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=ekcpAL57; spf=pass (domain: konsulko.com, ip: 209.85.219.47, mailfrom: scott.murray@konsulko.com) Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-88246401c9eso1673196d6.1 for ; Sat, 08 Nov 2025 12:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1762632970; x=1763237770; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BWhUp0kiLkflOjZ6KYSsZX9hSQqPHOlZEGEkj6Qktz4=; b=ekcpAL57ggztQvZVf5sS0N8357OTqrjp+JQgcR1Mm8ppGecFSV6a483XxPb83YnTg/ HDmNiO+bymrRsN0UdxPWxBCrTlAybrywR7DlhFCts1NYRCfNXAZHHMu2HXFb+bsOUpKS bmAvw76lujuBlguiGCetq+LCyeEg6MLbEYdIY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762632970; x=1763237770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject: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TV24SZ/y+GmX/kV9BpGtH2Nk4T33ZLssDT/ejnEQsmCQ= X-Google-Smtp-Source: AGHT+IEGAxV8xlrRz6qtourIeXXlefQbKnL/F5FN2cPEyRRFAcaHsf7mYq4o0LBnrbzwQtsDVWMmTg== X-Received: by 2002:ad4:5fc9:0:b0:880:2d04:fa07 with SMTP id 6a1803df08f44-88238689559mr49249226d6.32.1762632969757; Sat, 08 Nov 2025 12:16:09 -0800 (PST) Received: from ghidorah.spiteful.org (107-179-213-3.cpe.teksavvy.com. [107.179.213.3]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-88238b91b22sm20001896d6.53.2025.11.08.12.16.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Nov 2025 12:16:09 -0800 (PST) From: Scott Murray To: yocto-patches@lists.yoctoproject.org Subject: [meta-lts-mixins][kirkstone/rust][PATCH 09/11] classes/cargo_common: ensure B is clean Date: Sat, 8 Nov 2025 15:15:51 -0500 Message-ID: X-Mailer: git-send-email 2.51.0 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 08 Nov 2025 20:16:20 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto-patches/message/2444 From: Ross Burton 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) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie (adapted from oe-core commit 9d9ce457630ea7403ffe7028e3370647db0b83fa) Signed-off-by: Scott Murray --- classes/cargo_common.bbclass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/cargo_common.bbclass b/classes/cargo_common.bbclass index e417214..7e86930 100644 --- a/classes/cargo_common.bbclass +++ b/classes/cargo_common.bbclass @@ -110,6 +110,10 @@ cargo_common_do_configure () { # Put build output in build directory preferred by bitbake instead of # inside source directory unless they are the same if [ "${B}" != "${S}" ]; then + # We should consider mandating out-of-tree builds and just using [cleandirs] + rm -rf ${B}/target + mkdir -p ${B} + cat <<- EOF >> ${CARGO_HOME}/config.toml [build]