cargo patch override

Thomas Epperson <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <CAKHbFk2SJ9nGjbVkqG-birNnPzK=Rx9j8b+BJsCOqLT=yRxyMQ@mail.gmail.com>
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.


-- 
Thomas Epperson
Build a man a fire, and he'll be warm for a day. Set a man on fire, and
he'll be warm for the rest of his life. - Terry Pratchett.
0001-cargo-Add-ability-to-override-the-patch-elements.patch (text/x-patch, 1.3 KB)
From c166035ab08faeab3cee79cddaa4ca59b60aec71 Mon Sep 17 00:00:00 2001
From: Thomas Epperson <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.