public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Gyorgy Sarvari <skandigraun@gmail.com>
To: Tom Geelen <t.f.g.geelen@gmail.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] How to have multiple rust cargo vendors
Date: Fri, 3 Oct 2025 23:40:32 +0200	[thread overview]
Message-ID: <74071025-691b-48ff-8b3a-b982b735adac@gmail.com> (raw)
In-Reply-To: <CAJo0Az68Swx2Fh54fW6KhihnQRVfUJ8OE_dquQGhyJc86cC2hQ@mail.gmail.com>

On 10/3/25 21:38, Tom Geelen wrote:
> I've trying some items as well now. I've updated the recipe to the
> version in the patch.
>
> Now all the sources are in CARGO_VENDORING_DIRECTORY as needed.
> Then it still tried to fetch sources via the network, but I tackled
> that by commenting out the following in the source Cargo.toml:
>
> #[patch.crates-io]
> #reqwest-middleware = { git =
> "https://github.com/astral-sh/reqwest-middleware", rev =
> "7650ed76215a962a96d94a79be71c27bffde7ab2" }
> #reqwest-retry = { git =
> "https://github.com/astral-sh/reqwest-middleware", rev =
> "7650ed76215a962a96d94a79be71c27bffde7ab2" }
>
> However it does not compile yet. Stuck on a rust compile error about
> the sources fetched via git:
> - found a virtual manifest at
> `/home/tom/projects/meta-sanctum/build/tmp/work/x86-64-v3-oe-linux/python3-uv/0.8.22/sources/cargo_home/bitbake/reqwest-middleware-0.4.2/Cargo.toml`
> instead of a package manifest

Yes, that's the workspace-not-supported issue. When patching the
dependencies, the patch needs to point to the crate folder, not to the
parent workspace. You need to do two things:
1. Make cargo_common not to add these dependency patches. You can find
an example here[1] (not my proudest thing, but that's why I worked on
workspace support). You can limit it only to workspace crates.
2. You need to patch the dependencies in Cargo.toml (or in cargo's
config.toml, similar to what cargo_common does currently, but with the
crate paths.
For example: https://github.com/astral-sh/reqwest-middleware - this has
3 subfolders, reqwest-middleware, -retry and -tracing. Each of this is a
crate. To make them visible for cargo, you need add something like this
to one of the configs:

[patch."https://github.com/astral-sh/reqwest-middleware"]
request-middleware = {path = "$UNPACKDIR/reqwest/reqwest-middleware"}
request-retry = {path = "$UNPACKDIR/reqwest/reqwest-retry"}
request-tracing = {path = "$UNPACKDIR/reqwest/reqwest-tracing"}

(Make sure to set the correct paths to the checked out repos, without
variables, the above is just example. The path can be relative also)

Regarding the patch I just sent:
- I have sent a v1 patch, which refactors the cargo_common class'
dependency patching behavior. It works on my machine, and did some
testing, but it can always use more. If you would like to, feel free to
try it - I'd be happy to get any feedback.
- That patch will change for sure, I already know that if it won't be
shot down, there will be at least a v2 (and probably more).
- It won't be merged into Whinlatter though most likely in any case, it
is already too late for that.

A note regarding uv 0.8.22: it seems to use some detached orphan
commits, which is not easy to fetch in any case, but I think it's not
possible to do so with Bitbake fetcher at all (without changing it). The
last where I could find all revisions was 0.8.19.

[1]:
https://github.com/OSSystems/meta-browser/blob/master/meta-firefox/recipes-browser/firefox/firefox.inc#L155

>
> On Fri, Oct 3, 2025 at 2:39 PM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
>> On 10/2/25 22:39, Tom Geelen wrote:
>>> Ah that would be great. Actually I had seen the firefox recipes and
>>> did notice something which looked like something what I would be
>>> needing. So if you could send an RFC that would be awesome.
>> I found it my patch... but for some reason it doesn't work with your
>> recipe :D
>> I think that my change does what I intended it to do, but maturin still
>> tries to fetch the workspace crate from the network, just like without
>> my patch. Going look into this a bit deeper, if I can... will get back.
>>
>>> On Thu, Oct 2, 2025 at 10:33 PM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
>>>> On 10/2/25 22:17, Gyorgy Sarvari via lists.openembedded.org wrote:
>>>>> You can add those in the SRC_URI, as regular git repos, with +=. Make
>>>>> sure to set the "name" parameter to the crate name, and set the
>>>>> "destsuffix" to ensure the sources won't mix. After do_configure step
>>>>> one of the cargo/rust classes will go through the SRC_URI content, and
>>>>> add these git-crates to the cargo config as local patches.
>>>> Oh, now I see that this is a workspace - sorry for not looking closer
>>>> before.
>>>>
>>>> At this time cargo_common doesn't support workspaces from git crates...
>>>>
>>>> I find it interesting on a personal level, because I just implemented
>>>> workspace support like 2 weeks ago, but couldn't find any project using
>>>> workspace crates from git beside Firefox, and didn't want to submit it
>>>> only for that. (And since Firefox recipe switched away too)
>>>>
>>>> If I find my implementation again, will submit it tomorrow as an RFC.
>>>>
>>>>> On 10/2/25 21:40, Tom Geelen via lists.openembedded.org wrote:
>>>>>> I'm trying to create a recipe for uv (https://docs.astral.sh/uv/) to
>>>>>> be added to meta-python.
>>>>>> Problem I currently cannot seem to resolve is that I need multiple
>>>>>> cargo vendor support.
>>>>>>
>>>>>> I have created the draft recipe and added the inc file with the crates
>>>>>> using the update-crates command.
>>>>>> However it missed several crates as they are not from crates.io but
>>>>>> via git (see below).
>>>>>>
>>>>>> How would I add this to the recipe below?
>>>>>>
>>>>>> SUMMARY = "An extremely fast Python package and project manager,
>>>>>> written in Rust."
>>>>>> HOMEPAGE = "https://pypi.org/project/uv/"
>>>>>> LICENSE = "Apache-2.0 & BSD-2-Clause & MIT"
>>>>>> LIC_FILES_CHKSUM = "file://LICENSE-APACHE;md5=86d3f3a95c324c9479bd8986968f4327 \
>>>>>>                     file://LICENSE-MIT;md5=45674e482567aa99fe883d3270b11184"
>>>>>> RECIPE_MAINTAINER = "Tom Geelen <t.f.g.geelen@gmail.com>"
>>>>>>
>>>>>> SRC_URI[sha256sum] =
>>>>>> "e6e1289c411d43e0ca245f46e76457f3807de646d90b656591b6cf46348bed5c"
>>>>>>
>>>>>> inherit pypi python_maturin cargo-update-recipe-crates
>>>>>>
>>>>>> require ${BPN}-crates.inc
>>>>>>
>>>>>> SRCREV = "d8efd77673c9a90792da9da31b6c0da7ea8a324b"
>>>>>>
>>>>>> PYPI_PACKAGE = "uv"
>>>>>>
>>>>>>
>>>>>> [[package]]
>>>>>> name = "version-ranges"
>>>>>> version = "0.1.1"
>>>>>> source = "git+https://github.com/astral-sh/pubgrub?rev=d8efd77673c9a90792da9da31b6c0da7ea8a324b#d8efd77673c9a90792da9da31b6c0da7ea8a324b"
>>>>>> dependencies = [
>>>>>>  "smallvec",
>>>>>> ]
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Tom
>>>>>>
>>>>>>
>>>>>>
>>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>> Links: You receive all messages sent to this group.
>>>>> View/Reply Online (#224380): https://lists.openembedded.org/g/openembedded-core/message/224380
>>>>> Mute This Topic: https://lists.openembedded.org/mt/115558933/6084445
>>>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [skandigraun@gmail.com]
>>>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>>>



      reply	other threads:[~2025-10-03 21:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 19:40 How to have multiple rust cargo vendors Tom Geelen
2025-10-02 20:17 ` [OE-core] " Gyorgy Sarvari
     [not found] ` <186AC5F2410FD5FD.16131@lists.openembedded.org>
2025-10-02 20:33   ` Gyorgy Sarvari
2025-10-02 20:39     ` Tom Geelen
2025-10-03 12:39       ` Gyorgy Sarvari
2025-10-03 19:38         ` Tom Geelen
2025-10-03 21:40           ` Gyorgy Sarvari [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74071025-691b-48ff-8b3a-b982b735adac@gmail.com \
    --to=skandigraun@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=t.f.g.geelen@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox