]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
cargo_common.bbclass: add subdir argument to git dependency to let cargo find crate
authorGeorge Refseth <george.refseth@remarkable.no>
Mon, 18 May 2026 13:07:30 +0000 (15:07 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 21 May 2026 10:18:21 +0000 (11:18 +0100)
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>
meta/classes-recipe/cargo_common.bbclass

index 0d3edfe4a7259b47134eed47b09c0e668f7dd732..c1fe6a24ed6699c07b640f0b37d9631b5b9da5d4 100644 (file)
@@ -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)