]> git.proxmox.com Git - debcargo-conf.git/commitdiff
debcargo: cherry-pick fix for sparse crates.io access
authorFabian Grünbichler <debian@fabian.gruenbichler.email>
Tue, 19 Dec 2023 08:11:55 +0000 (09:11 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 19 Dec 2023 08:48:15 +0000 (09:48 +0100)
Signed-off-by: Fabian Grünbichler <debian@fabian.gruenbichler.email>
src/debcargo/debian/changelog
src/debcargo/debian/patches/crates-io-sparse-support.patch [new file with mode: 0644]
src/debcargo/debian/patches/series

index 9d8c614b51174543531a03caf17b285169986253..b4777fbd2c4b738c50e44b575a7d804e17d90888 100644 (file)
@@ -1,3 +1,10 @@
+rust-debcargo (2.6.1-4) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
+
+  * Team upload.
+  * Fix sparse access of crates.io
+
+ -- Fabian Grünbichler <debian@fabian.gruenbichler.email>  Tue, 19 Dec 2023 09:11:32 +0100
+
 rust-debcargo (2.6.1-3~bpo12+pve1) proxmox-rust; urgency=medium
 
   * Rebuild for Debian Bookworm / Proxmox
diff --git a/src/debcargo/debian/patches/crates-io-sparse-support.patch b/src/debcargo/debian/patches/crates-io-sparse-support.patch
new file mode 100644 (file)
index 0000000..2203924
--- /dev/null
@@ -0,0 +1,42 @@
+From c94c3dccacf56a320696f043fcfb6e8424dfcd46 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?=
+ <debian@fabian.gruenbichler.email>
+Date: Tue, 19 Dec 2023 09:08:44 +0100
+Subject: [PATCH] allow crates.io sparse access
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+else, opt-in via the environment variable works with cargo but fails
+debcargo since the cache paths are different.
+
+Signed-off-by: Fabian Grünbichler <debian@fabian.gruenbichler.email>
+---
+ src/crates.rs | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/crates.rs b/src/crates.rs
+index 8865725..3807c0b 100644
+--- a/src/crates.rs
++++ b/src/crates.rs
+@@ -75,7 +75,7 @@ fn fetch_candidates(registry: &mut PackageRegistry, dep: &Dependency) -> Result<
+ pub fn invalidate_crates_io_cache() -> Result<()> {
+     let config = Config::default()?;
+     let _lock = config.acquire_package_cache_lock()?;
+-    let source_id = SourceId::crates_io(&config)?;
++    let source_id = SourceId::crates_io_maybe_sparse_http(&config)?;
+     let yanked_whitelist = HashSet::new();
+     let mut r = RegistrySource::remote(source_id, &yanked_whitelist, &config)?;
+     r.invalidate_cache();
+@@ -85,7 +85,7 @@ pub fn invalidate_crates_io_cache() -> Result<()> {
+ pub fn crate_name_ver_to_dep(crate_name: &str, version: Option<&str>) -> Result<Dependency> {
+     // note: this forces a network call
+     let config = Config::default()?;
+-    let source_id = SourceId::crates_io(&config)?;
++    let source_id = SourceId::crates_io_maybe_sparse_http(&config)?;
+     let version = version.and_then(|v| {
+         if v.is_empty() {
+             None
+-- 
+2.43.0
+
index 4db0935575fd90616822984eaf3afd612795dc32..0946fa1b42f522ca047272c01d407cca5ca6bb6c 100644 (file)
@@ -1,3 +1,4 @@
 update-cargo.patch
 relax-env-logger.diff
 update-git2.patch
+crates-io-sparse-support.patch