public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: frederic.martinsons@gmail.com
To: openembedded-core@lists.openembedded.org
Cc: alex.kiernan@gmail.com
Subject: [PATCH 4/5] devtool: add support for multiple git url inside a cargo based recipe
Date: Sat, 25 Mar 2023 10:00:34 +0100	[thread overview]
Message-ID: <b48dd61e593e57d7673b65a34a44cd304cb7b7b8.1679734210.git.frederic.martinsons@gmail.com> (raw)
In-Reply-To: <cover.1679734210.git.frederic.martinsons@gmail.com>

From: Frederic Martinsons <frederic.martinsons@gmail.com>

Without that, the possible git urls that are in SRC_URI of a recipe
are sucked up during a devtool modify on the recipe.

Let's treat these dependency as local ones by using a new
dedicated variable to be set in the recipe and which will
contains the url of such dependencies.

Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
---
 meta/classes-recipe/cargo_common.bbclass               | 7 +++++++
 meta/classes/externalsrc.bbclass                       | 3 +++
 meta/recipes-extended/rust-example/zvariant-crates.inc | 5 +++++
 3 files changed, 15 insertions(+)

diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass
index 82ab25b59c..358c7d7ed2 100644
--- a/meta/classes-recipe/cargo_common.bbclass
+++ b/meta/classes-recipe/cargo_common.bbclass
@@ -33,6 +33,13 @@ CARGO_DISABLE_BITBAKE_VENDORING ?= "0"
 # Used by libstd-rs to point to the vendor dir included in rustc src
 CARGO_VENDORING_DIRECTORY ?= "${CARGO_HOME}/bitbake"
 
+# Contains a list of crate that are fetch on a git
+# repository instead of from crates.io
+# This is useful when devtool'ing a rust recipe
+# and still patch the path of these dependencies
+# to get these dependencies locally
+CARGO_GIT_DEPENDENCIES ?= ""
+
 CARGO_RUST_TARGET_CCLD ?= "${RUST_TARGET_CCLD}"
 cargo_common_do_configure () {
 	mkdir -p ${CARGO_HOME}/bitbake
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 26c5803ee6..b8ffeb8614 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -65,6 +65,7 @@ python () {
 
         local_srcuri = []
         fetch = bb.fetch2.Fetch((d.getVar('SRC_URI') or '').split(), d)
+        cargo_git_deps = (d.getVar('CARGO_GIT_DEPENDENCIES') or '').split()
         for url in fetch.urls:
             url_data = fetch.ud[url]
             parm = url_data.parm
@@ -72,6 +73,8 @@ python () {
                     url_data.type == 'npmsw' or url_data.type == 'crate' or
                     'type' in parm and parm['type'] == 'kmeta'):
                 local_srcuri.append(url)
+            if url in cargo_git_deps:
+                local_srcuri.append(url)
 
         d.setVar('SRC_URI', ' '.join(local_srcuri))
 
diff --git a/meta/recipes-extended/rust-example/zvariant-crates.inc b/meta/recipes-extended/rust-example/zvariant-crates.inc
index 297a784661..074ac1934e 100644
--- a/meta/recipes-extended/rust-example/zvariant-crates.inc
+++ b/meta/recipes-extended/rust-example/zvariant-crates.inc
@@ -125,11 +125,16 @@ SRC_URI += " \
     crate://crates.io/winnow/0.4.0 \
     crate://crates.io/zvariant_derive/3.12.0 \
     crate://crates.io/zvariant_utils/1.0.0 \
+"
+
+CARGO_GIT_DEPENDENCIES = " \
     git://github.com/gtk-rs/glib;protocol=https;nobranch=1;name=glib;destsuffix=glib \
     git://github.com/gtk-rs/sys;protocol=https;nobranch=1;name=glib-sys;destsuffix=glib-sys;subpath=glib-sys \
     git://github.com/gtk-rs/sys;protocol=https;nobranch=1;name=gobject-sys;destsuffix=gobject-sys;subpath=gobject-sys \
 "
 
+SRC_URI += "${CARGO_GIT_DEPENDENCIES}"
+
 SRCREV_FORMAT .= "_glib"
 SRCREV_glib = "c9ee583cea07830c099cdcccd33eda9ef705ea93"
 
-- 
2.34.1



  parent reply	other threads:[~2023-03-25  9:01 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25  9:00 [PATCH 0/5] Extend cargo based recip support frederic.martinsons
2023-03-25  9:00 ` [PATCH 1/5] cargo_common.bbclass: Support local github repos frederic.martinsons
2023-03-25  9:00 ` [PATCH 2/5] cargo_common.bbclass: add support of user in url for patch frederic.martinsons
2023-03-25  9:00 ` [PATCH 3/5] rust-example: provide a recipe for zvariant frederic.martinsons
2023-03-25 18:51   ` [OE-core] " Alexander Kanavin
2023-03-25 20:43     ` Frédéric Martinsons
2023-03-26 16:55       ` Alexander Kanavin
2023-03-27  4:09         ` Frédéric Martinsons
2023-03-27  6:40           ` Alexander Kanavin
2023-03-27  8:18             ` Alex Kiernan
2023-03-27  8:30               ` Frédéric Martinsons
2023-03-27  8:42                 ` Alex Kiernan
2023-03-27  8:52                   ` Frédéric Martinsons
2023-03-27 10:24                     ` Alex Kiernan
2023-03-25  9:00 ` frederic.martinsons [this message]
2023-03-25 18:55   ` [OE-core] [PATCH 4/5] devtool: add support for multiple git url inside a cargo based recipe Alexander Kanavin
2023-03-26  5:15     ` Frédéric Martinsons
2023-03-25 19:02   ` Alexander Kanavin
2023-03-26  5:15     ` Frédéric Martinsons
2023-03-26 14:58       ` Frédéric Martinsons
2023-03-26 18:01         ` Alexander Kanavin
2023-03-27  4:09           ` Frédéric Martinsons
2023-03-25  9:00 ` [PATCH 5/5] patch: support of git patches when the source uri contained subpath param frederic.martinsons
2023-03-27 14:20 ` [OE-core] [PATCH 0/5] Extend cargo based recip support Richard Purdie
2023-03-27 14:25   ` Alexander Kanavin
2023-03-27 15:01     ` Frédéric Martinsons
2023-03-27 17:19       ` Alexander Kanavin
2023-03-27 18:07         ` Frédéric Martinsons
2023-03-27 18:30           ` Alex Kiernan
2023-03-27 18:40             ` Frédéric Martinsons
2023-03-27 18:52               ` Alex Kiernan
2023-03-27 19:00                 ` Alexander Kanavin
2023-03-27 19:20                   ` Frédéric Martinsons
2023-03-27 22:13                     ` Alexander Kanavin
2023-03-28  7:11                       ` Alex Kiernan
2023-03-28  8:37                         ` Alexander Kanavin
2023-03-28  9:01                           ` Alex Kiernan
2023-03-29 12:35                       ` Alex Kiernan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b48dd61e593e57d7673b65a34a44cd304cb7b7b8.1679734210.git.frederic.martinsons@gmail.com \
    --to=frederic.martinsons@gmail.com \
    --cc=alex.kiernan@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox