create const BUILDER_CONFIG_FILENAME for builder-config file

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-08-14 08:14:28 +03:00
parent 43320d5d6c
commit 4d21c735a2
3 changed files with 13 additions and 3 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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() {