Fix a couple build and test issues with rustdoc.

This commit is contained in:
Josh Stone 2019-11-12 11:36:54 -08:00
parent 23326e0036
commit 13639c9e59
3 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From 73369f32621f6a844a80a8513ae3ded901e4a406 Mon Sep 17 00:00:00 2001
From: Mark Rousskov <mark.simulacrum@gmail.com>
Date: Tue, 5 Nov 2019 11:16:46 -0500
Subject: [PATCH] Hopefully fix rustdoc build
It's super unclear why this broke when we switched to beta but not
previously -- but at least it's hopefully fixed now.
---
src/bootstrap/builder.rs | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 2748903f2d47..2edcef203ad2 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -886,7 +886,18 @@ impl<'a> Builder<'a> {
// things still build right, please do!
match mode {
Mode::Std => metadata.push_str("std"),
- _ => {},
+ // When we're building rustc tools, they're built with a search path
+ // that contains things built during the rustc build. For example,
+ // bitflags is built during the rustc build, and is a dependency of
+ // rustdoc as well. We're building rustdoc in a different target
+ // directory, though, which means that Cargo will rebuild the
+ // dependency. When we go on to build rustdoc, we'll look for
+ // bitflags, and find two different copies: one built during the
+ // rustc step and one that we just built. This isn't always a
+ // problem, somehow -- not really clear why -- but we know that this
+ // fixes things.
+ Mode::ToolRustc => metadata.push_str("tool-rustc"),
+ _ => {}
}
cargo.env("__CARGO_DEFAULT_LIB_METADATA", &metadata);
--
2.23.0

View File

@ -0,0 +1,39 @@
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 2748903f2d47..10d02d6db829 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1231,7 +1231,8 @@ impl<'a> Builder<'a> {
cargo.arg("--frozen");
}
- cargo.env("RUSTC_INSTALL_BINDIR", &self.config.bindir);
+ // Try to use a sysroot-relative bindir, in case it was configured absolutely.
+ cargo.env("RUSTC_INSTALL_BINDIR", self.config.bindir_relative());
self.ci_env.force_coloring_in_ci(&mut cargo);
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index d1bdfa0a7676..0c03b95c7b25 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -647,6 +647,20 @@ impl Config {
config
}
+ /// Try to find the relative path of `bindir`, otherwise return it in full.
+ pub fn bindir_relative(&self) -> &Path {
+ let bindir = &self.bindir;
+ if bindir.is_absolute() {
+ // Try to make it relative to the prefix.
+ if let Some(prefix) = &self.prefix {
+ if let Ok(stripped) = bindir.strip_prefix(prefix) {
+ return stripped;
+ }
+ }
+ }
+ bindir
+ }
+
/// Try to find the relative path of `libdir`.
pub fn libdir_relative(&self) -> Option<&Path> {
let libdir = self.libdir.as_ref()?;

View File

@ -49,7 +49,7 @@
Name: rust
Version: 1.39.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries)
@ -71,6 +71,14 @@ Patch1: rust-pr57840-llvm7-debuginfo-variants.patch
# https://github.com/rust-lang/rust/pull/65474
Patch2: rust-pr65474-split-rustc-dev.patch
# Fix conflicting libraries of rustc tools
# https://github.com/rust-lang/rust/commit/73369f32621f6a844a80a8513ae3ded901e4a406
Patch3: 0001-Hopefully-fix-rustdoc-build.patch
# Fix the bindir used by rustdoc to find rustc
# https://github.com/rust-lang/rust/pull/66317
Patch4: rust-pr66317-bindir-relative.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
local abi = "gnu"
@ -402,6 +410,8 @@ test -f '%{local_rust_root}/bin/rustc'
%patch1 -p1 -R
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if "%{python}" == "python3"
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
@ -711,6 +721,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%changelog
* Tue Nov 12 2019 Josh Stone <jistone@redhat.com> - 1.39.0-2
- Fix a couple build and test issues with rustdoc.
* Thu Nov 07 2019 Josh Stone <jistone@redhat.com> - 1.39.0-1
- Update to 1.39.0.