Skip to content

Commit 81f6e33

Browse files
committed
create const BUILDER_CONFIG_FILENAME for builder-config file
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 43320d5 commit 81f6e33

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/bootstrap/src/core/config/config.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ macro_rules! check_ci_llvm {
3636
};
3737
}
3838

39+
/// This file is embedded in the overlay directory of the tarball sources. It is
40+
/// useful in scenarios where developers want to see how the tarball sources were
41+
// generated.
42+
///
43+
/// We also use this file to compare the host's config.toml against the CI rustc builder
44+
/// configuration to detect any incompatible options.
45+
pub(crate) const BUILDER_CONFIG_FILENAME: &str = "builder-config";
46+
3947
#[derive(Clone, Default)]
4048
pub enum DryRun {
4149
/// This isn't a dry run.
@@ -2322,7 +2330,7 @@ impl Config {
23222330

23232331
if let Some(config_path) = &self.config {
23242332
let builder_config_path =
2325-
self.out.join(self.build.triple).join("ci-rustc/builder-config");
2333+
self.out.join(self.build.triple).join("ci-rustc").join(BUILDER_CONFIG_FILENAME);
23262334
let ci_config_toml = Self::get_toml(&builder_config_path);
23272335
let current_config_toml = Self::get_toml(config_path);
23282336

src/bootstrap/src/core/download.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::sync::OnceLock;
99
use build_helper::ci::CiEnv;
1010
use xz2::bufread::XzDecoder;
1111

12+
use crate::core::config::BUILDER_CONFIG_FILENAME;
1213
use crate::utils::exec::{command, BootstrapCommand};
1314
use crate::utils::helpers::{check_run, exe, hex_encode, move_file, program_out_of_date};
1415
use crate::{t, Config};
@@ -288,7 +289,7 @@ impl Config {
288289
continue;
289290
}
290291
let mut short_path = t!(original_path.strip_prefix(directory_prefix));
291-
let is_builder_config = short_path.to_str() == Some("builder-config");
292+
let is_builder_config = short_path.to_str() == Some(BUILDER_CONFIG_FILENAME);
292293

293294
if !short_path.starts_with(pattern) && (is_ci_rustc && !is_builder_config) {
294295
continue;

src/bootstrap/src/utils/tarball.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
99

1010
use crate::core::build_steps::dist::distdir;
1111
use crate::core::builder::{Builder, Kind};
12+
use crate::core::config::BUILDER_CONFIG_FILENAME;
1213
use crate::utils::exec::BootstrapCommand;
1314
use crate::utils::helpers::{move_file, t};
1415
use crate::utils::{channel, helpers};
@@ -320,7 +321,7 @@ impl<'a> Tarball<'a> {
320321

321322
// Add config file if present.
322323
if let Some(config) = &self.builder.config.config {
323-
self.add_renamed_file(config, &self.overlay_dir, "builder-config");
324+
self.add_renamed_file(config, &self.overlay_dir, BUILDER_CONFIG_FILENAME);
324325
}
325326

326327
for file in self.overlay.legal_and_readme() {

0 commit comments

Comments
 (0)