Skip to content

Commit

Permalink
Don't check cargo version
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Sep 1, 2024
1 parent 34978cc commit b24b9b3
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2390,47 +2390,47 @@ impl Config {
}
}

#[cfg(feature = "bootstrap-self-test")]
// #[cfg(feature = "bootstrap-self-test")]
pub fn check_stage0_version(&self, _program_path: &Path, _component_name: &'static str) {}

/// check rustc/cargo version is same or lower with 1 apart from the building one
#[cfg(not(feature = "bootstrap-self-test"))]
pub fn check_stage0_version(&self, program_path: &Path, component_name: &'static str) {
use build_helper::util::fail;

if self.dry_run() {
return;
}

let stage0_output = output(Command::new(program_path).arg("--version"));
let mut stage0_output = stage0_output.lines().next().unwrap().split(' ');

let stage0_name = stage0_output.next().unwrap();
if stage0_name != component_name {
fail(&format!(
"Expected to find {component_name} at {} but it claims to be {stage0_name}",
program_path.display()
));
}

let stage0_version =
semver::Version::parse(stage0_output.next().unwrap().split('-').next().unwrap().trim())
.unwrap();
let source_version = semver::Version::parse(
fs::read_to_string(self.src.join("src/version")).unwrap().trim(),
)
.unwrap();
if !(source_version == stage0_version
|| (source_version.major == stage0_version.major
&& (source_version.minor == stage0_version.minor
|| source_version.minor == stage0_version.minor + 1)))
{
let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1);
fail(&format!(
"Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}"
));
}
}
// /// check rustc/cargo version is same or lower with 1 apart from the building one
// #[cfg(not(feature = "bootstrap-self-test"))]
// pub fn check_stage0_version(&self, program_path: &Path, component_name: &'static str) {
// use build_helper::util::fail;

// if self.dry_run() {
// return;
// }

// let stage0_output = output(Command::new(program_path).arg("--version"));
// let mut stage0_output = stage0_output.lines().next().unwrap().split(' ');

// let stage0_name = stage0_output.next().unwrap();
// if stage0_name != component_name {
// fail(&format!(
// "Expected to find {component_name} at {} but it claims to be {stage0_name}",
// program_path.display()
// ));
// }

// let stage0_version =
// semver::Version::parse(stage0_output.next().unwrap().split('-').next().unwrap().trim())
// .unwrap();
// let source_version = semver::Version::parse(
// fs::read_to_string(self.src.join("src/version")).unwrap().trim(),
// )
// .unwrap();
// if !(source_version == stage0_version
// || (source_version.major == stage0_version.major
// && (source_version.minor == stage0_version.minor
// || source_version.minor == stage0_version.minor + 1)))
// {
// let prev_version = format!("{}.{}.x", source_version.major, source_version.minor - 1);
// fail(&format!(
// "Unexpected {component_name} version: {stage0_version}, we should use {prev_version}/{source_version} to build source with {source_version}"
// ));
// }
// }

/// Returns the commit to download, or `None` if we shouldn't download CI artifacts.
fn download_ci_rustc_commit(&self, download_rustc: Option<StringOrBool>) -> Option<String> {
Expand Down

0 comments on commit b24b9b3

Please sign in to comment.