diff mbox series

[meta-lts-mixins,scarthgap/rust,26/35] cargo_common.bbclass: add subdir argument to git dependency to let cargo find crate

Message ID 7a7dc78d2a9e44ad487246222cd19eaffe42c237.1785496469.git.scott.murray@konsulko.com
State New
Headers show
Series Update to 1.96.1 | expand

Commit Message

Scott Murray July 31, 2026, 11:32 a.m. UTC
From: George Refseth <george.refseth@remarkable.no>

When git referenced crate dependency dependens on (root) workspace virtual
manifest, when patching path the path to the folder containing the crate
within the referenced repo need to be added to the patching process.
A subdir argument is added to address this need.

Example usage when repo contains an api crate defining the api for org/repo:
SRC_URI:append = "git://git@github.com/<org>/<repo>.git;name=api;destsuffix=repo-api;subdir=crates/api;type=git-dependency"

Cc: Erik Wierich <erik@riscstar.com>
Signed-off-by: George Refseth <george.refseth@remarkable.no>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(adapted from oe-core commit e955099a2eeff111709de180b127db866b217600)
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
---
 classes-recipe/cargo_common.bbclass | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/classes-recipe/cargo_common.bbclass b/classes-recipe/cargo_common.bbclass
index db050ca..34fd1e7 100644
--- a/classes-recipe/cargo_common.bbclass
+++ b/classes-recipe/cargo_common.bbclass
@@ -154,6 +154,9 @@  python cargo_common_do_patch_paths() {
                     repo = '%s://%s@%s%s' % (ud.proto, ud.user, ud.host, ud.path)
                 else:
                     repo = '%s://%s%s' % (ud.proto, ud.host, ud.path)
+                subdir = ud.parm.get('subdir')
+                if subdir is not None:
+                    destsuffix = os.path.join(destsuffix, subdir)
                 path = '%s = { path = "%s" }' % (name, os.path.join(workdir, destsuffix))
                 patches.setdefault(repo, []).append(path)