From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a8-smtp.messagingengine.com (fout-a8-smtp.messagingengine.com [103.168.172.151]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.43175.1796073885579323791 for ; Mon, 30 Nov 2026 13:24:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@pbarker.dev header.s=fm2 header.b=eVhrg3R+; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=f9rDK9aB; spf=pass (domain: pbarker.dev, ip: 103.168.172.151, mailfrom: paul@pbarker.dev) Received: from phl-compute-10.internal (phl-compute-10.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id 7FDD9EC719E for ; Mon, 30 Nov 2026 16:24:44 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Mon, 30 Nov 2026 16:24:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pbarker.dev; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1796073884; x=1796160284; bh=NXBsKCN9auXMKAooaTTIeWGHZtFp2A+UEMbQ6KSnLhY=; b= eVhrg3R+lv9lXpy7FzCciqyN82mjPEITG+/sh+MU/owUECVv/OqJyUvg7rFUWNbP YM3SqCh9AZROOCyWYUr83ADN0yHS7ugiwM4XUhYbiEwnznlqf0I0jJdRujLenoFs zuVaRqm3NUjZUIopJ/jpzBu0T3/UUcKZTN+fuBBXo5KnX4aQTRvumHsRRE9MlDmf dkqe/k6SZbVcXQonLwjaH/rhEhTFkaaDBkyau5ODRSKNBmGk1C4h8QUNwvrmsoy1 F7VMje4ZvfX9f45FUNewgT0epD4MKXI9HNyqlCfYT19Iu6OzFnvP6qCjCNvbtX3S Nn4sfB5+7GT29NvQ2l3ZPQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1796073884; x= 1796160284; bh=NXBsKCN9auXMKAooaTTIeWGHZtFp2A+UEMbQ6KSnLhY=; b=f 9rDK9aBdpiFtMeBDZg+jQCvXWUmgVG3zGQlOP47S715turnsXiAvKGy8FYTVN1OU HcPFpBaduvkf9G2JqV6yI9nmle5xpv+Ub1BwlGn3/X90Arlyi7VbRkEiz+LiXycl hYA00N8T0xWQSrxDz4/kKMdV+e7hj4fYXT4rHXN6aY4JI/UTNDJsqivmg7W5v1HZ zVIRCJST7jWn9tj6c+ZzbX2zQD2UDTtC8O+hr17Me1loRjDVX3RL1NioUnoWZdfX kiEv2VYI+XQUfzm0LScQHS8WyYkJo+kPANSvk74jHYJri/wKQ5OboolV+PEXdp17 edpqu0pfzTKCmV7J1Zq3g== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pbarker.dev a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796073884; d=pbarker.dev; mf=PHBhdWxAcGJhcmtlci5kZXY+; rt=PG9wZW5lbWJlZGRlZC1jb3JlQGxpc3RzLm9wZW5lbWJlZGRlZC5vcmc+; s=fm2:rsa-sha256:W6cVDtscDWtAaW5nT5L7Eku6u0WHs8SNMk0LFgFKLIoFiTo ZImmbOnRhPZV4YAxtSbtTCaxWSsPGZfrfsJGHtlaZpM9ellSois6CBdgwjNSgi4A /FDfiIWiTWEGFPeU+3mF+yiJrf3HZ0xAVKAEpDz2jYHWcmnFATwyZpiZxdt5bNkq NxWasFWYyT15oTqrN1Z462vOcIudBxYpuTtaMzfqdVQIasPqOGGrTr1drWjgM0WY uVchRs+Iu0qd/raClLsojSRr4fQw0gXQndEVG1jd6knv1lh1J/+iac+wCqfLEbCB l+YrvQuEYwZhCFqFCYt7BX6K5Ehsydyhzw4h1Hw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-transfer-encoding,content-type,date,feedback-id, from,in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:3HDpcOwQwqPKaGtMCzGA8WWoebI6cD+vo/vm7SWW3qc=:CsifiSKvl8zooruWEHG6zogFMMcPEDPAGVHLqif5+Kk=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGh+2cbUGjiw1gTHmjV7k5Rb8NLxX4XcB6cAdnleFziSMhcIUg7hb1xPAZ5SpxQAg Y4k2nuYMHyVSyA2B/L7a0RV0Q4Hm+7PGjh3VhBz5ZKxCDzen/TpFT2ePWA0tTaGpQwoi6n PgwokXXzlAMkagCJtlexaZ69EtkQh/JwYhhrTjpmQNCsnjWPK7f3Z3sSt1Z5n0Az2iNYLO 9Jsdy4eBLKqz2hDva80JhlTRg3IuIyQlafDiA9Ea8CzjMYzcLTSmOSUZOQe2jzVNJraX6m +NZZkxuVP6++VnLkw3t5MVtagknPxcMFbM0Rc5iiq2cWCrnlNYviYkxno1RE5ZVlw1Ukav F8ap1ratx9DNMfrY+8AHC7TCQFy4pD3hWLk0xmo7Ws7cXMqcZHZsuDcIPMapNjX8WE5/oe GH8vwXIEcwXqI2++2Cetvupu7xonXe9biCPZ30HgjXpmp/vJxDCzALMCjNTVOvEPPpNPWs NfQUO6DnL+WM62uKzVqjMbIXThJit2fRYno/+SNr7uobO6W9vXIgMWaT3rbAdOOh73tw3M QvqnMVLEZwK8C+P5DzMHAk6o2OG8/VzMib7DCLBXoO7FP5P2CJpA/NE5BfB0gsucWviK+L wtOi+Ksz6oAmgK2MUv2+9il9y2LeNyXWFf//zFl7mnWCu8VAsNpBsI2nPl+A X-ME-Proxy: Feedback-ID: i51494658:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Nov 2026 16:24:43 -0500 (EST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 30 Nov 2026 21:24:42 +0000 Message-Id: Cc: , Subject: Re: [PATCH v4 3/3] classes/cargo-update-recipe-crates: support multiple Cargo.lock search directories From: "Paul Barker" To: "Marco Felsch" , X-Mailer: aerc 0.22.0 References: <20261130-mfe-multi-cargo-lock-files-v4-0-a3ebce5cc283@pengutronix.de> <20261130-mfe-multi-cargo-lock-files-v4-3-a3ebce5cc283@pengutronix.de> In-Reply-To: <20261130-mfe-multi-cargo-lock-files-v4-3-a3ebce5cc283@pengutronix.de> List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Mon, 30 Nov 2026 21:24:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/251650 Hi Marco, Thanks for the v4 series, patches 1/3 & 2/3 are good, I have a couple of comments on this one. On Mon Nov 30, 2026 at 8:40 PM GMT, Marco Felsch wrote: > Recipes using cargo's -Z build-std must also vendor the standard > library's dependencies. The std sources staged by rust-native > (.../rustlib/src/rust/library) ship a Cargo.lock but no vendor > directory, so those crates need crate:// entries in SRC_URI as well. > Until now only a single directory could be scanned (CARGO_LOCK_SRC_DIR), > which forced the std crate list to be maintained by hand and go stale on > toolchain upgrades, breaking do_compile with: > > error: failed to select a version for the requirement > `cfg-if =3D "^1.0"` (locked to 1.0.4) > > Keep the existing CARGO_LOCK_SRC_DIR and extend it to support a > space-separated list of directories, to allow: > > CARGO_LOCK_SRC_DIR =3D "${S} ${STAGING_LIBDIR_NATIVE}/rustlib/src/rust/= library" In this example you'd need to ensure ${STAGING_LIBDIR_NATIVE} is populated before do_update_crates runs. It's probably worth modifying the `addtask` line so do_update_crates always runs after do_prepare_recipe_sysroot. We should also consider what should happen if one of these directories is missing or doesn't contain a Cargo.lock file. Should that cause an error? > > This way the behavior can be backported. > > Crates found in multiple lockfiles are listed only once, in the section > of the first Cargo.lock containing them; conflicting checksums for the > same crate version now fail the task. The crates.io warning now names the > lockfile it came from. Output for recipes with a single lockfile is > unchanged. The "first" Cargo.lock file mentioning a particular crate will depend on the order in which Cargo.lock files are parsed. I don't think os.walk() explores subdirectories in a deterministic order, can we modify this so that the output is deterministic? > > Signed-off-by: Marco Felsch > --- > .../cargo-update-recipe-crates.bbclass | 53 ++++++++++++++--= ------ > 1 file changed, 33 insertions(+), 20 deletions(-) > > diff --git a/meta/classes-recipe/cargo-update-recipe-crates.bbclass b/met= a/classes-recipe/cargo-update-recipe-crates.bbclass > index 9f92f0a522979fde8f0b88abdefb9a03c0c651ee..449a1c5d81b92c686e9aea766= 48a55e88ec77efc 100644 > --- a/meta/classes-recipe/cargo-update-recipe-crates.bbclass > +++ b/meta/classes-recipe/cargo-update-recipe-crates.bbclass > @@ -23,12 +23,12 @@ do_update_crates[doc] =3D "Update the recipe by readi= ng Cargo.lock and write in ${ > =20 > RECIPE_UPGRADE_EXTRA_TASKS +=3D "do_update_crates" > =20 > -# The directory where to search for Cargo.lock files > +# Space-separated list of directories where to search for Cargo.lock fil= es. > +# Crates found in multiple Cargo.lock files are listed only once, in the > +# section of the first Cargo.lock file that contains them. > CARGO_LOCK_SRC_DIR ??=3D "${S}" > =20 > python do_update_crates() { > - cargo_lock_src_dir =3D d.getVar("CARGO_LOCK_SRC_DIR") > - > def get_legacy_checksums(crates, filename): > # Old (v1) Cargo.lock files do not carry a 'checksum' field per > # [[package]]; instead they are collected in the [metadata] tabl= e: > @@ -48,13 +48,13 @@ python do_update_crates() { > checksums[(name, version, source)] =3D value > return checksums > =20 > - def get_crates(filename): > + def get_crates(filename, src_dir, seen): > try: > import tomllib > except ImportError: > import bb._vendor.tomli as tomllib > =20 > - c_list =3D '# from %s' % os.path.relpath(filename, cargo_lock_sr= c_dir) > + c_list =3D '# from %s' % os.path.relpath(filename, src_dir) If there are two entries in CARGO_LOCK_SRC_DIR, each path containing a Cargo.toml file, this will just say `# from Cargo.lock` for each. Is there a better way to differentiate them without embedding absolute paths in the output? Best regards, --=20 Paul Barker