Skip to content

Commit

Permalink
Rollup merge of rust-lang#77746 - winnayx:issue-77572-fix, r=jyn514
Browse files Browse the repository at this point in the history
Fix `x.py setup` sets `changelog-seen`

Fixes rust-lang#77572 by setting changelog-seen in setup.rs
  • Loading branch information
JohnTitor authored Oct 12, 2020
2 parents 195e787 + d7494af commit 6ff6fc1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
use std::env;

use bootstrap::{Build, Config, Subcommand};
use bootstrap::{Build, Config, Subcommand, VERSION};

fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
let config = Config::parse(&args);

let changelog_suggestion = check_version(&config);
// check_version warnings are not printed during setup
let changelog_suggestion =
if matches!(config.cmd, Subcommand::Setup {..}) { None } else { check_version(&config) };

// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
// changelog warning, not the `x.py setup` message.
Expand All @@ -40,8 +42,6 @@ fn main() {
}

fn check_version(config: &Config) -> Option<String> {
const VERSION: usize = 2;

let mut msg = String::new();

let suggestion = if let Some(seen) = config.changelog_seen {
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ const LLVM_TOOLS: &[&str] = &[
"llvm-ar", // used for creating and modifying archive files
];

pub const VERSION: usize = 2;

/// A structure representing a Rust compiler.
///
/// Each compiler has a `stage` that it is associated with and a `host` that
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/setup.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::t;
use crate::{t, VERSION};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::{
Expand Down Expand Up @@ -69,8 +69,9 @@ pub fn setup(src_path: &Path, profile: Profile) {
let path = cfg_file.unwrap_or_else(|| src_path.join("config.toml"));
let settings = format!(
"# Includes one of the default files in src/bootstrap/defaults\n\
profile = \"{}\"\n",
profile
profile = \"{}\"\n\
changelog-seen = {}\n",
profile, VERSION
);
t!(fs::write(path, settings));

Expand Down

0 comments on commit 6ff6fc1

Please sign in to comment.