All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Khem Raj <raj.khem@gmail.com>, openembedded-core@lists.openembedded.org
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [OE-core][PATCH 1/4] cargo: don't update git submodules in --offline mode
Date: Mon,  6 Jun 2022 15:26:50 +0200	[thread overview]
Message-ID: <20220606132653.60232-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20220606132653.60232-1-brgl@bgdev.pl>

This adds a patch to the cargo recipe that prohibits cargo from trying
to update git submodules when running in --offline mode.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 meta/recipes-devtools/cargo/cargo.inc         |  2 +-
 ...-t-update-submodules-in-offline-mode.patch | 32 +++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/cargo/cargo/0001-git-don-t-update-submodules-in-offline-mode.patch

diff --git a/meta/recipes-devtools/cargo/cargo.inc b/meta/recipes-devtools/cargo/cargo.inc
index 607c51fc3d..6ab4e0a5f7 100644
--- a/meta/recipes-devtools/cargo/cargo.inc
+++ b/meta/recipes-devtools/cargo/cargo.inc
@@ -11,7 +11,7 @@ LIC_FILES_CHKSUM = " \
     file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
 "
 
-
+SRC_URI += "file://0001-git-don-t-update-submodules-in-offline-mode.patch"
 S = "${RUSTSRC}/src/tools/cargo"
 CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 EXCLUDE_FROM_WORLD = "1"
diff --git a/meta/recipes-devtools/cargo/cargo/0001-git-don-t-update-submodules-in-offline-mode.patch b/meta/recipes-devtools/cargo/cargo/0001-git-don-t-update-submodules-in-offline-mode.patch
new file mode 100644
index 0000000000..d138c4b911
--- /dev/null
+++ b/meta/recipes-devtools/cargo/cargo/0001-git-don-t-update-submodules-in-offline-mode.patch
@@ -0,0 +1,32 @@
+From 4768c657905356da417f50d3cbb203c76baf1ab2 Mon Sep 17 00:00:00 2001
+From: Bartosz Golaszewski <brgl@bgdev.pl>
+Date: Mon, 6 Jun 2022 12:13:02 +0200
+Subject: [PATCH] git: don't update submodules in offline mode
+
+When we're running in --offline mode, don't try to update git
+submodules or else we're bail out with a network error if it's actually
+inaccessible.
+---
+Upstream-Status: Submitted [https://github.com/rust-lang/cargo/pull/10730]
+
+ src/tools/cargo/src/cargo/sources/git/utils.rs | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/cargo/sources/git/utils.rs b/src/cargo/sources/git/utils.rs
+index 4eafae1c9..9ed991e36 100644
+--- a/src/cargo/sources/git/utils.rs
++++ b/src/cargo/sources/git/utils.rs
+@@ -177,7 +177,9 @@ impl GitDatabase {
+             Some(c) => c,
+             None => GitCheckout::clone_into(dest, self, rev, cargo_config)?,
+         };
+-        checkout.update_submodules(cargo_config)?;
++        if !cargo_config.offline() {
++            checkout.update_submodules(cargo_config)?;
++        }
+         Ok(checkout)
+     }
+ 
+-- 
+2.34.1
+
-- 
2.34.1



  reply	other threads:[~2022-06-06 13:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 13:26 [OE-core][PATCH 0/4] cargo: improve the build process and add a new recipe Bartosz Golaszewski
2022-06-06 13:26 ` Bartosz Golaszewski [this message]
2022-06-06 15:20   ` [OE-core][PATCH 1/4] cargo: don't update git submodules in --offline mode Alexander Kanavin
2022-06-06 13:26 ` [OE-core][PATCH 2/4] cargo: run " Bartosz Golaszewski
2022-06-06 13:26 ` [OE-core][PATCH 3/4] cargo: pass PACKAGECONFIG_CONFARGS to cargo build Bartosz Golaszewski
2022-06-06 13:26 ` [OE-core][PATCH 4/4] gstreamer1.0-plugins-rs: new package Bartosz Golaszewski
2022-06-06 15:22   ` Alexander Kanavin
2022-06-06 15:36     ` Bartosz Golaszewski

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=20220606132653.60232-2-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.