Skip to content

Commit

Permalink
upstream fix for network access during build
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalus committed Sep 25, 2024
1 parent b310222 commit 718b991
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
70 changes: 70 additions & 0 deletions no-network.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
From 741b3164d874ef95ab40d4aca7536265f84e1155 Mon Sep 17 00:00:00 2001
From: onur-ozkan <work@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@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 {

5 changes: 4 additions & 1 deletion rust.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 718b991

Please sign in to comment.