about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2024-08-14 08:14:28 +0300
committeronur-ozkan <work@onurozkan.dev>2024-08-14 18:59:06 +0300
commit4d21c735a27533396da7e8f15bc042ef22b96130 (patch)
tree4e2fdea26ec4488b1ecac254e04f24400cf1e40a
parent43320d5d6c53d506bfedff3abde40a9e26b0441a (diff)
downloadrust-4d21c735a27533396da7e8f15bc042ef22b96130.tar.gz
rust-4d21c735a27533396da7e8f15bc042ef22b96130.zip
create `const BUILDER_CONFIG_FILENAME` for builder-config file
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/core/config/config.rs10
-rw-r--r--src/bootstrap/src/core/download.rs3
-rw-r--r--src/bootstrap/src/utils/tarball.rs3
3 files changed, 13 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index b955593ecf6..5f1d923b3f8 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -36,6 +36,14 @@ macro_rules! check_ci_llvm {
     };
 }
 
+/// This file is embedded in the overlay directory of the tarball sources. It is
+/// useful in scenarios where developers want to see how the tarball sources were
+/// generated.
+///
+/// We also use this file to compare the host's config.toml against the CI rustc builder
+/// configuration to detect any incompatible options.
+pub(crate) const BUILDER_CONFIG_FILENAME: &str = "builder-config";
+
 #[derive(Clone, Default)]
 pub enum DryRun {
     /// This isn't a dry run.
@@ -2322,7 +2330,7 @@ impl Config {
 
                     if let Some(config_path) = &self.config {
                         let builder_config_path =
-                            self.out.join(self.build.triple).join("ci-rustc/builder-config");
+                            self.out.join(self.build.triple).join("ci-rustc").join(BUILDER_CONFIG_FILENAME);
                         let ci_config_toml = Self::get_toml(&builder_config_path);
                         let current_config_toml = Self::get_toml(config_path);
 
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index a88b4a33856..3c4e47bf443 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -9,6 +9,7 @@ use std::sync::OnceLock;
 use build_helper::ci::CiEnv;
 use xz2::bufread::XzDecoder;
 
+use crate::core::config::BUILDER_CONFIG_FILENAME;
 use crate::utils::exec::{command, BootstrapCommand};
 use crate::utils::helpers::{check_run, exe, hex_encode, move_file, program_out_of_date};
 use crate::{t, Config};
@@ -288,7 +289,7 @@ impl Config {
                 continue;
             }
             let mut short_path = t!(original_path.strip_prefix(directory_prefix));
-            let is_builder_config = short_path.to_str() == Some("builder-config");
+            let is_builder_config = short_path.to_str() == Some(BUILDER_CONFIG_FILENAME);
 
             if !short_path.starts_with(pattern) && (is_ci_rustc && !is_builder_config) {
                 continue;
diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs
index 3f7f6214cf6..3c6c7a7fa18 100644
--- a/src/bootstrap/src/utils/tarball.rs
+++ b/src/bootstrap/src/utils/tarball.rs
@@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
 
 use crate::core::build_steps::dist::distdir;
 use crate::core::builder::{Builder, Kind};
+use crate::core::config::BUILDER_CONFIG_FILENAME;
 use crate::utils::exec::BootstrapCommand;
 use crate::utils::helpers::{move_file, t};
 use crate::utils::{channel, helpers};
@@ -320,7 +321,7 @@ impl<'a> Tarball<'a> {
 
         // Add config file if present.
         if let Some(config) = &self.builder.config.config {
-            self.add_renamed_file(config, &self.overlay_dir, "builder-config");
+            self.add_renamed_file(config, &self.overlay_dir, BUILDER_CONFIG_FILENAME);
         }
 
         for file in self.overlay.legal_and_readme() {