[packages/rust] upstream fix for network access during build

atler atler at pld-linux.org
Wed Sep 25 13:51:20 CEST 2024


commit 718b9918e0642073a5376af8400bcfb324d45a93
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Sep 25 13:49:04 2024 +0200

    upstream fix for network access during build
    
    see https://github.com/rust-lang/rust/issues/130099
    from https://github.com/rust-lang/rust/pull/130110

 no-network.patch | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 rust.spec        |  5 +++-
 2 files changed, 74 insertions(+), 1 deletion(-)
---
diff --git a/rust.spec b/rust.spec
index 15a1217..4cd7ceb 100644
--- a/rust.spec
+++ b/rust.spec
@@ -53,6 +53,7 @@ Source4:	https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_ru
 # Source4-md5:	cef3379a5232e29c54ccc07dc9fb8f5d
 Source5:	https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-armv7-unknown-linux-gnueabihf.tar.xz
 # Source5-md5:	3b3e9945f3ffdf50226f14a818faf84d
+Patch0:		no-network.patch
 URL:		https://www.rust-lang.org/
 # for src/compiler-rt
 BuildRequires:	cmake >= 3.4.3
@@ -332,6 +333,7 @@ Dopełnianie parametrów polecenia cargo w powłoce Zsh.
 
 %prep
 %setup -q -n %{rustc_package}
+%patch0 -p1
 
 %if %{with bootstrap}
 %ifarch %{x8664} x32
@@ -414,7 +416,8 @@ export AR="%{__ar}"
 	--llvm-root=%{_prefix} \
 	--release-channel=%{channel} \
 	--set=llvm.static-libstdcpp=false \
-	--set=build.optimized-compiler-builtins=false
+	--set=build.optimized-compiler-builtins=false \
+	--set dist.vendor=false
 
 export RUST_BACKTRACE=full
 %x_py dist --verbose
diff --git a/no-network.patch b/no-network.patch
new file mode 100644
index 0000000..ad2af30
--- /dev/null
+++ b/no-network.patch
@@ -0,0 +1,70 @@
+From 741b3164d874ef95ab40d4aca7536265f84e1155 Mon Sep 17 00:00:00 2001
+From: onur-ozkan <work at onurozkan.dev>
+Date: Sun, 8 Sep 2024 20:14:50 +0300
+Subject: [PATCH 1/3] make dist vendoring configurable
+
+Signed-off-by: onur-ozkan <work at onurozkan.dev>
+---
+ src/bootstrap/src/core/build_steps/dist.rs |  6 +-----
+ src/bootstrap/src/core/config/config.rs    | 10 +++++++++-
+ 2 files changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
+index b0bd18792beb2..294a56b3e976a 100644
+--- a/src/bootstrap/src/core/build_steps/dist.rs
++++ b/src/bootstrap/src/core/build_steps/dist.rs
+@@ -1011,11 +1011,7 @@ impl Step for PlainSourceTarball {
+         write_git_info(builder.rust_info().info(), plain_dst_src);
+         write_git_info(builder.cargo_info.info(), &plain_dst_src.join("./src/tools/cargo"));
+ 
+-        // If we're building from git or tarball sources, we need to vendor
+-        // a complete distribution.
+-        if builder.rust_info().is_managed_git_subrepository()
+-            || builder.rust_info().is_from_tarball()
+-        {
++        if builder.config.dist_vendor {
+             // FIXME: This code looks _very_ similar to what we have in `src/core/build_steps/vendor.rs`
+             // perhaps it should be removed in favor of making `dist` perform the `vendor` step?
+ 
+diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
+index 79c2f73161e48..555a6a7f8bdeb 100644
+--- a/src/bootstrap/src/core/config/config.rs
++++ b/src/bootstrap/src/core/config/config.rs
+@@ -308,6 +308,7 @@ pub struct Config {
+     pub dist_compression_formats: Option<Vec<String>>,
+     pub dist_compression_profile: String,
+     pub dist_include_mingw_linker: bool,
++    pub dist_vendor: bool,
+ 
+     // libstd features
+     pub backtrace: bool, // support for RUST_BACKTRACE
+@@ -933,6 +934,7 @@ define_config! {
+         compression_formats: Option<Vec<String>> = "compression-formats",
+         compression_profile: Option<String> = "compression-profile",
+         include_mingw_linker: Option<bool> = "include-mingw-linker",
++        vendor: Option<bool> = "vendor",
+     }
+ }
+ 
+@@ -2028,13 +2030,19 @@ impl Config {
+                 compression_formats,
+                 compression_profile,
+                 include_mingw_linker,
++                vendor,
+             } = dist;
+             config.dist_sign_folder = sign_folder.map(PathBuf::from);
+             config.dist_upload_addr = upload_addr;
+             config.dist_compression_formats = compression_formats;
+             set(&mut config.dist_compression_profile, compression_profile);
+             set(&mut config.rust_dist_src, src_tarball);
+-            set(&mut config.dist_include_mingw_linker, include_mingw_linker)
++            set(&mut config.dist_include_mingw_linker, include_mingw_linker);
++            config.dist_vendor = vendor.unwrap_or_else(|| {
++                // If we're building from git or tarball sources, enable it by default.
++                config.rust_info.is_managed_git_subrepository()
++                    || config.rust_info.is_from_tarball()
++            });
+         }
+ 
+         if let Some(r) = rustfmt {
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rust.git/commitdiff/718b9918e0642073a5376af8400bcfb324d45a93



More information about the pld-cvs-commit mailing list