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

