From c32c076f346cdc8a4adbd72ac55b64a636b08b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Mon, 24 Mar 2025 09:11:54 +0100 Subject: [PATCH] Return `PathFreshness::MissingUpstream` from `detect_[gcc|llvm]_freshness` functions --- src/bootstrap/src/core/build_steps/gcc.rs | 11 +++++------ src/bootstrap/src/core/build_steps/llvm.rs | 6 +----- src/bootstrap/src/core/download.rs | 5 ++++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/gcc.rs b/src/bootstrap/src/core/build_steps/gcc.rs index 339eec184069..ee8bd8286dae 100644 --- a/src/bootstrap/src/core/build_steps/gcc.rs +++ b/src/bootstrap/src/core/build_steps/gcc.rs @@ -133,7 +133,10 @@ fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option { - eprintln!("No upstream commit found, GCC will *not* be downloaded"); + eprintln!("error: could not find commit hash for downloading GCC"); + eprintln!("HELP: maybe your repository history is too shallow?"); + eprintln!("HELP: consider disabling `download-ci-gcc`"); + eprintln!("HELP: or fetch enough history to include one upstream commit"); None } } @@ -295,10 +298,6 @@ fn detect_gcc_freshness(config: &crate::Config, is_git: bool) -> build_helper::g } else if let Some(info) = crate::utils::channel::read_commit_info_file(&config.src) { PathFreshness::LastModifiedUpstream { upstream: info.sha.trim().to_owned() } } else { - eprintln!("error: could not find commit hash for downloading GCC"); - eprintln!("HELP: maybe your repository history is too shallow?"); - eprintln!("HELP: consider disabling `download-ci-gcc`"); - eprintln!("HELP: or fetch enough history to include one upstream commit"); - crate::exit!(1); + PathFreshness::MissingUpstream } } diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 1a6247c42d70..86af956535e5 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -188,11 +188,7 @@ pub(crate) fn detect_llvm_freshness(config: &Config, is_git: bool) -> PathFreshn } else if let Some(info) = crate::utils::channel::read_commit_info_file(&config.src) { PathFreshness::LastModifiedUpstream { upstream: info.sha.trim().to_owned() } } else { - eprintln!("error: could not find commit hash for downloading LLVM"); - eprintln!("HELP: maybe your repository history is too shallow?"); - eprintln!("HELP: consider disabling `download-ci-llvm`"); - eprintln!("HELP: or fetch enough history to include one upstream commit"); - crate::exit!(1); + PathFreshness::MissingUpstream } } diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index 57a674c1dd7e..b95d07356c1b 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -739,7 +739,10 @@ download-rustc = false PathFreshness::LastModifiedUpstream { upstream } => upstream, PathFreshness::HasLocalModifications { upstream } => upstream, PathFreshness::MissingUpstream => { - eprintln!("No upstream commit for downloading LLVM found"); + eprintln!("error: could not find commit hash for downloading LLVM"); + eprintln!("HELP: maybe your repository history is too shallow?"); + eprintln!("HELP: consider disabling `download-ci-llvm`"); + eprintln!("HELP: or fetch enough history to include one upstream commit"); crate::exit!(1); } };