You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-lang/rust/files/1.35.0-revert-commits-trigg...

118 lines
4.8 KiB

From d6bd0a479ceaf6abdd696c3b955a56f66275c562 Mon Sep 17 00:00:00 2001
From: Georgy Yakovlev <gyakovlev@gentoo.org>
Date: Sat, 25 May 2019 22:21:16 -0700
Subject: [PATCH] revert commits triggering multiple llvm rebuilds
this reverts the following commits
https://github.com/rust-lang/rust/commit/105692c3ad281c63bf0f75a26a66bb9cff5b4553
https://github.com/rust-lang/rust/commit/975ba58f42b34ff07cd7c2bd73350daed2057186
https://github.com/rust-lang/rust/commit/e1daa36ba7df88788c2684bbe5ff6eb37f1cda69
---
src/bootstrap/llvm-rebuild-trigger | 4 +++
src/bootstrap/native.rs | 46 +++++++++++++-----------------
2 files changed, 24 insertions(+), 26 deletions(-)
create mode 100644 src/bootstrap/llvm-rebuild-trigger
diff --git a/src/bootstrap/llvm-rebuild-trigger b/src/bootstrap/llvm-rebuild-trigger
new file mode 100644
index 0000000000..0f18c6a4ac
--- /dev/null
+++ b/src/rustllvm/llvm-rebuild-trigger
@@ -0,0 +1,4 @@
+# If this file is modified, then llvm will be (optionally) cleaned and then rebuilt.
+# The actual contents of this file do not matter, but to trigger a change on the
+# build bots then the contents should be changed so git updates the mtime.
+2019-03-18
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index fde40b0d1b..3babbc9e10 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -67,40 +67,30 @@ impl Step for Llvm {
}
}
- let (llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
- let info = &builder.emscripten_llvm_info;
+ let rebuild_trigger = builder.src.join("src/rustllvm/llvm-rebuild-trigger");
+ let rebuild_trigger_contents = t!(fs::read_to_string(&rebuild_trigger));
+
+ let (out_dir, llvm_config_ret_dir) = if emscripten {
let dir = builder.emscripten_llvm_out(target);
let config_dir = dir.join("bin");
- (info, "src/llvm-emscripten", dir, config_dir)
+ (dir, config_dir)
} else {
- let info = &builder.in_tree_llvm_info;
let mut dir = builder.llvm_out(builder.config.build);
if !builder.config.build.contains("msvc") || builder.config.ninja {
dir.push("build");
}
- (info, "src/llvm-project/llvm", builder.llvm_out(target), dir.join("bin"))
+ (builder.llvm_out(target), dir.join("bin"))
};
-
- if !llvm_info.is_git() {
- println!(
- "git could not determine the LLVM submodule commit hash. \
- Assuming that an LLVM build is necessary.",
- );
- }
-
+ let done_stamp = out_dir.join("llvm-finished-building");
let build_llvm_config = llvm_config_ret_dir
.join(exe("llvm-config", &*builder.config.build));
- let done_stamp = out_dir.join("llvm-finished-building");
-
- if let Some(llvm_commit) = llvm_info.sha() {
- if done_stamp.exists() {
- let done_contents = t!(fs::read(&done_stamp));
+ if done_stamp.exists() {
+ let done_contents = t!(fs::read_to_string(&done_stamp));
- // If LLVM was already built previously and the submodule's commit didn't change
- // from the previous build, then no action is required.
- if done_contents == llvm_commit.as_bytes() {
- return build_llvm_config
- }
+ // If LLVM was already built previously and contents of the rebuild-trigger file
+ // didn't change from the previous build, then no action is required.
+ if done_contents == rebuild_trigger_contents {
+ return build_llvm_config
}
}
@@ -111,6 +101,7 @@ impl Step for Llvm {
t!(fs::create_dir_all(&out_dir));
// http://llvm.org/docs/CMake.html
+ let root = if self.emscripten { "src/llvm-emscripten" } else { "src/llvm-project/llvm" };
let mut cfg = cmake::Config::new(builder.src.join(root));
let profile = match (builder.config.llvm_optimize, builder.config.llvm_release_debuginfo) {
@@ -251,6 +242,11 @@ impl Step for Llvm {
channel::CFG_RELEASE_NUM,
builder.config.channel,
);
+ let llvm_info = if self.emscripten {
+ &builder.emscripten_llvm_info
+ } else {
+ &builder.in_tree_llvm_info
+ };
if let Some(sha) = llvm_info.sha_short() {
default_suffix.push_str("-");
default_suffix.push_str(sha);
@@ -283,9 +279,7 @@ impl Step for Llvm {
cfg.build();
- if let Some(llvm_commit) = llvm_info.sha() {
- t!(fs::write(&done_stamp, llvm_commit));
- }
+ t!(fs::write(&done_stamp, &rebuild_trigger_contents));
build_llvm_config
}
--
2.21.0