Skip to content

Commit b871156

Browse files
committed
backport fixes to disable miri and analyzer; rel 2
miri fails if there's no git repository anywhere in directory tree however miri and rust-analyzer were not supposed to be built on stable channel in the first place: rust-lang/rust#86568 rust-lang/rust#87007
1 parent cdc531f commit b871156

File tree

2 files changed

+168
-19
lines changed

2 files changed

+168
-19
lines changed

disable_miri.patch

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
From 601d24810e89efd42f7cd69d4a7ccecd4e35364d Mon Sep 17 00:00:00 2001
2+
From: Eric Huss <[email protected]>
3+
Date: Tue, 22 Jun 2021 22:10:25 -0700
4+
Subject: [PATCH 1/2] Don't dist miri on stable or beta.
5+
6+
---
7+
src/bootstrap/dist.rs | 3 +++
8+
1 file changed, 3 insertions(+)
9+
10+
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
11+
index 71ed0af4a7c04..e0c33f7357741 100644
12+
--- a/src/bootstrap/dist.rs
13+
+++ b/src/bootstrap/dist.rs
14+
@@ -1171,6 +1171,9 @@ impl Step for Miri {
15+
}
16+
17+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
18+
+ if !builder.build.unstable_features() {
19+
+ return None;
20+
+ }
21+
let compiler = self.compiler;
22+
let target = self.target;
23+
assert!(builder.config.extended);
24+
25+
From 6aa79a34d87252deaae11e75663e5740a22f14ea Mon Sep 17 00:00:00 2001
26+
From: Eric Huss <[email protected]>
27+
Date: Wed, 23 Jun 2021 07:03:42 -0700
28+
Subject: [PATCH 2/2] Comment and include rust-analyzer.
29+
30+
---
31+
src/bootstrap/dist.rs | 9 +++++++++
32+
1 file changed, 9 insertions(+)
33+
34+
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
35+
index e0c33f7357741..19895baf08f16 100644
36+
--- a/src/bootstrap/dist.rs
37+
+++ b/src/bootstrap/dist.rs
38+
@@ -1072,6 +1072,12 @@ impl Step for RustAnalyzer {
39+
}
40+
41+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
42+
+ // This prevents rust-analyzer from being built for "dist" or "install"
43+
+ // on the stable/beta channels. It is a nightly-only tool and should
44+
+ // not be included.
45+
+ if !builder.build.unstable_features() {
46+
+ return None;
47+
+ }
48+
let compiler = self.compiler;
49+
let target = self.target;
50+
assert!(builder.config.extended);
51+
@@ -1171,6 +1177,9 @@ impl Step for Miri {
52+
}
53+
54+
fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
55+
+ // This prevents miri from being built for "dist" or "install"
56+
+ // on the stable/beta channels. It is a nightly-only tool and should
57+
+ // not be included.
58+
if !builder.build.unstable_features() {
59+
return None;
60+
}
61+
From f698cacc33f0c9148bb3bb7501087b0d37e837ec Mon Sep 17 00:00:00 2001
62+
From: Eric Huss <[email protected]>
63+
Date: Fri, 9 Jul 2021 10:01:23 -0700
64+
Subject: [PATCH 1/3] Fix rust-analyzer install when not available.
65+
66+
---
67+
src/bootstrap/install.rs | 13 +++++++++----
68+
1 file changed, 9 insertions(+), 4 deletions(-)
69+
70+
diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs
71+
index 13ee909afd5e4..6f3054538a898 100644
72+
--- a/src/bootstrap/install.rs
73+
+++ b/src/bootstrap/install.rs
74+
@@ -165,10 +165,15 @@ install!((self, builder, _config),
75+
}
76+
};
77+
RustAnalyzer, "rust-analyzer", Self::should_build(_config), only_hosts: true, {
78+
- let tarball = builder
79+
- .ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target })
80+
- .expect("missing rust-analyzer");
81+
- install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball);
82+
+ if let Some(tarball) =
83+
+ builder.ensure(dist::RustAnalyzer { compiler: self.compiler, target: self.target })
84+
+ {
85+
+ install_sh(builder, "rust-analyzer", self.compiler.stage, Some(self.target), &tarball);
86+
+ } else {
87+
+ builder.info(
88+
+ &format!("skipping Install rust-analyzer stage{} ({})", self.compiler.stage, self.target),
89+
+ );
90+
+ }
91+
};
92+
Clippy, "clippy", Self::should_build(_config), only_hosts: true, {
93+
let tarball = builder.ensure(dist::Clippy { compiler: self.compiler, target: self.target });
94+
95+
From 60ff731110815349dbc052c36e9cc50b9f12f32a Mon Sep 17 00:00:00 2001
96+
From: Eric Huss <[email protected]>
97+
Date: Sun, 11 Jul 2021 09:01:31 -0700
98+
Subject: [PATCH 2/3] Add comments why install steps should never fail.
99+
100+
---
101+
src/bootstrap/install.rs | 6 ++++++
102+
1 file changed, 6 insertions(+)
103+
104+
diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs
105+
index 6f3054538a898..2ac9d3dda206f 100644
106+
--- a/src/bootstrap/install.rs
107+
+++ b/src/bootstrap/install.rs
108+
@@ -139,11 +139,15 @@ macro_rules! install {
109+
110+
install!((self, builder, _config),
111+
Docs, "src/doc", _config.docs, only_hosts: false, {
112+
+ // `expect` should be safe, only None when config.docs is false,
113+
+ // which is guarded in `should_run`
114+
let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
115+
install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
116+
};
117+
Std, "library/std", true, only_hosts: false, {
118+
for target in &builder.targets {
119+
+ // `expect` should be safe, only None when host != build, but this
120+
+ // only runs when host == build
121+
let tarball = builder.ensure(dist::Std {
122+
compiler: self.compiler,
123+
target: *target
124+
@@ -217,6 +221,8 @@ install!((self, builder, _config),
125+
}
126+
};
127+
Analysis, "analysis", Self::should_build(_config), only_hosts: false, {
128+
+ // `expect` should be safe, only None with host != build, but this
129+
+ // only uses the `build` compiler
130+
let tarball = builder.ensure(dist::Analysis {
131+
// Find the actual compiler (handling the full bootstrap option) which
132+
// produced the save-analysis data because that data isn't copied
133+
134+
From 166c147c2727cd6d6ad4d39c40c51273b8a63c96 Mon Sep 17 00:00:00 2001
135+
From: Eric Huss <[email protected]>
136+
Date: Mon, 12 Jul 2021 13:29:47 -0700
137+
Subject: [PATCH 3/3] Provide a better error when `x.py install src/doc`
138+
doesn't work.
139+
140+
---
141+
src/bootstrap/install.rs | 10 ++++++----
142+
1 file changed, 6 insertions(+), 4 deletions(-)
143+
144+
diff --git a/src/bootstrap/install.rs b/src/bootstrap/install.rs
145+
index 2ac9d3dda206f..8a1b6df0dafe3 100644
146+
--- a/src/bootstrap/install.rs
147+
+++ b/src/bootstrap/install.rs
148+
@@ -139,10 +139,12 @@ macro_rules! install {
149+
150+
install!((self, builder, _config),
151+
Docs, "src/doc", _config.docs, only_hosts: false, {
152+
- // `expect` should be safe, only None when config.docs is false,
153+
- // which is guarded in `should_run`
154+
- let tarball = builder.ensure(dist::Docs { host: self.target }).expect("missing docs");
155+
- install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
156+
+ if let Some(tarball) = builder.ensure(dist::Docs { host: self.target }) {
157+
+ install_sh(builder, "docs", self.compiler.stage, Some(self.target), &tarball);
158+
+ } else {
159+
+ panic!("docs are not available to install, \
160+
+ check that `build.docs` is true in `config.toml`");
161+
+ }
162+
};
163+
Std, "library/std", true, only_hosts: false, {
164+
for target in &builder.targets {

rust.spec

+4-19
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Summary: The Rust Programming Language
3737
Summary(pl.UTF-8): Język programowania Rust
3838
Name: rust
3939
Version: 1.53.0
40-
Release: 1
40+
Release: 2
4141
# Licenses: (rust itself) and (bundled libraries)
4242
License: (Apache v2.0 or MIT) and (BSD and ISC and MIT)
4343
Group: Development/Languages
@@ -53,6 +53,7 @@ Source4: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_ru
5353
# Source4-md5: e36ad0e20aef949b4335cf2599a136bb
5454
Source5: https://static.rust-lang.org/dist/%{bootstrap_date}/rust-%{bootstrap_rust}-armv7-unknown-linux-gnueabihf.tar.xz
5555
# Source5-md5: 77d28773b9fa07979a075e5232b23ac7
56+
Patch0: disable_miri.patch
5657
URL: https://www.rust-lang.org/
5758
# for src/compiler-rt
5859
BuildRequires: cmake >= 3.4.3
@@ -114,6 +115,7 @@ Requires: %{name}-std%{?_isa} = %{version}-%{release}
114115
%ifarch x32
115116
Requires: %{name}-std(x86-64) = %{version}-%{release}
116117
%endif
118+
Obsoletes: rust-analyzer < 1.53.0
117119
# Only x86_64 and i686 are Tier 1 platforms at this time.
118120
# x32 is Tier 2, only rust-std is available (no rustc or cargo).
119121
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
@@ -210,18 +212,6 @@ Standard library for Rust.
210212
%description std -l pl.UTF-8
211213
Standardowa biblioteka Rusta.
212214

213-
%package analyzer
214-
Summary: Implementation of Language Server Protocol for Rust
215-
Summary(pl.UTF-8): Implementacja Language Server Protocol dla Rusta
216-
Group: Development/Tools
217-
Requires: %{name} = %{version}-%{release}
218-
219-
%description analyzer
220-
Implementation of Language Server Protocol for Rust.
221-
222-
%description analyzer -l pl.UTF-8
223-
Implementacja Language Server Protocol dla Rusta.
224-
225215
%package debugger-common
226216
Summary: Common debugger pretty printers for Rust
227217
Summary(pl.UTF-8): Narzędzia wypisujące struktury Rusa wspólne dla różnych debuggerów
@@ -336,6 +326,7 @@ Dopełnianie parametrów polecenia cargo w powłoce Zsh.
336326

337327
%prep
338328
%setup -q -n %{rustc_package}
329+
%patch0 -p1
339330

340331
%if %{with bootstrap}
341332
%ifarch %{x8664} x32
@@ -476,7 +467,6 @@ rm -rf $RPM_BUILD_ROOT
476467
%files
477468
%defattr(644,root,root,755)
478469
%doc COPYRIGHT LICENSE-APACHE LICENSE-MIT README.md library/backtrace/crates/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
479-
%attr(755,root,root) %{_bindir}/miri
480470
%attr(755,root,root) %{_bindir}/rustc
481471
%attr(755,root,root) %{_bindir}/rustdoc
482472
%attr(755,root,root) %{_bindir}/rustfmt
@@ -498,10 +488,6 @@ rm -rf $RPM_BUILD_ROOT
498488
%attr(755,root,root) %{rustlibdir}/%{rust_triple}/lib/*.so
499489
%{rustlibdir}/%{rust_triple}/lib/*.rlib
500490

501-
%files analyzer
502-
%defattr(644,root,root,755)
503-
%attr(755,root,root) %{_bindir}/rust-analyzer
504-
505491
%files debugger-common
506492
%defattr(644,root,root,755)
507493
%dir %{_datadir}/%{name}
@@ -534,7 +520,6 @@ rm -rf $RPM_BUILD_ROOT
534520
%attr(755,root,root) %{_bindir}/cargo
535521
%attr(755,root,root) %{_bindir}/cargo-clippy
536522
%attr(755,root,root) %{_bindir}/cargo-fmt
537-
%attr(755,root,root) %{_bindir}/cargo-miri
538523
%attr(755,root,root) %{_bindir}/clippy-driver
539524
%attr(755,root,root) %{_libexecdir}/cargo-credential-1password
540525
%{_mandir}/man1/cargo*.1*

0 commit comments

Comments
 (0)