diff mbox series

cargo patch override

Message ID CAKHbFk2SJ9nGjbVkqG-birNnPzK=Rx9j8b+BJsCOqLT=yRxyMQ@mail.gmail.com (mailing list archive)
State New
Headers show
Series cargo patch override | expand

Commit Message

Thomas Epperson Sept. 23, 2024, 3:08 p.m. UTC
Some crates when built from git require additional handling in the
cargo_common bbclass because there is more than one crate in the git
repository (egui and related crates in my case).

I'm open to the special variable being a different name if something else
makes more sense.

I wanted to get initial thoughts before I added the documentation updates
for the class change.

Comments

Emmanuel_Jee@trimble.com Sept. 23, 2024, 8:54 p.m. UTC | #1
Running into the same issue when using bitbake with a repo with multiple crates.  We had to add a 'cratedir' parameter to temporarily work around this problem.  We can try your patch

- Emmanuel Jee
Alexander Kanavin Sept. 24, 2024, 8:06 a.m. UTC | #2
Hello,

sending patches as attachments to poky list will not get the needed
attention to the problem/solution. The correct way is to use
openembedded-core list, and send patches as emails (e.g. git
send-email).

Alex

On Mon, 23 Sept 2024 at 22:54, Emmanuel_Jee via lists.yoctoproject.org
<Emmanuel_Jee=trimble.com@lists.yoctoproject.org> wrote:
>
> Running into the same issue when using bitbake with a repo with multiple crates.  We had to add a 'cratedir' parameter to temporarily work around this problem.  We can try your patch
>
> - Emmanuel Jee
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13444): https://lists.yoctoproject.org/g/poky/message/13444
> Mute This Topic: https://lists.yoctoproject.org/mt/108609661/1686489
> Group Owner: poky+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

From c166035ab08faeab3cee79cddaa4ca59b60aec71 Mon Sep 17 00:00:00 2001
From: Thomas Epperson <thomas.epperson@gmail.com>
Date: Mon, 23 Sep 2024 09:58:06 -0500
Subject: [PATCH] cargo: Add ability to override the patch elements

---
 meta/classes-recipe/cargo_common.bbclass | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
index c528ae7f39..c9d1811d35 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -156,8 +156,15 @@  python cargo_common_do_patch_paths() {
     with open(cargo_config, "a+") as config:
         for k, v in patches.items():
             print('\n[patch."%s"]' % k, file=config)
-            for name in v:
-                print(name, file=config)
+            special = d.getVar('RUSTSPECIALCRATES_%s' % k)
+            if special is not None:
+                specials = special.split(',')
+                for s in specials:
+                	ss = s.split(':')
+                	print('%s = { path = "%s" }' % (ss[0], os.path.join(workdir, destsuffix, ss[1])), file=config)
+            else:
+                for name in v:
+                    print(name, file=config)
 
     if not patches:
         return
-- 
2.34.1