Revert "warn newer available version of the x tool"
This commit is contained in:
parent
b22c152958
commit
1a993611d2
7 changed files with 13 additions and 90 deletions
21
Cargo.lock
21
Cargo.lock
|
@ -5034,18 +5034,18 @@ checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "1.0.14"
|
version = "1.0.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
|
checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.152"
|
version = "1.0.147"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
@ -5062,9 +5062,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.152"
|
version = "1.0.147"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
|
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -5082,9 +5082,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.91"
|
version = "1.0.85"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
|
checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"itoa",
|
"itoa",
|
||||||
|
@ -5400,9 +5400,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.107"
|
version = "1.0.102"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
|
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -5576,7 +5576,6 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"miropt-test-tools",
|
"miropt-test-tools",
|
||||||
"regex",
|
"regex",
|
||||||
"semver",
|
|
||||||
"termcolor",
|
"termcolor",
|
||||||
"walkdir",
|
"walkdir",
|
||||||
]
|
]
|
||||||
|
|
|
@ -934,7 +934,8 @@ def main():
|
||||||
if len(sys.argv) > 1 and sys.argv[1] == 'help':
|
if len(sys.argv) > 1 and sys.argv[1] == 'help':
|
||||||
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
|
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
|
||||||
|
|
||||||
help_triggered = len(sys.argv) == 1 or any(x in ["-h", "--help", "--version"] for x in sys.argv)
|
help_triggered = (
|
||||||
|
'-h' in sys.argv) or ('--help' in sys.argv) or (len(sys.argv) == 1)
|
||||||
try:
|
try:
|
||||||
bootstrap(help_triggered)
|
bootstrap(help_triggered)
|
||||||
if not help_triggered:
|
if not help_triggered:
|
||||||
|
|
|
@ -11,7 +11,6 @@ miropt-test-tools = { path = "../miropt-test-tools" }
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
ignore = "0.4.18"
|
ignore = "0.4.18"
|
||||||
semver = "1.0.14"
|
|
||||||
termcolor = "1.1.3"
|
termcolor = "1.1.3"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|
|
@ -68,4 +68,3 @@ pub mod ui_tests;
|
||||||
pub mod unit_tests;
|
pub mod unit_tests;
|
||||||
pub mod unstable_book;
|
pub mod unstable_book;
|
||||||
pub mod walk;
|
pub mod walk;
|
||||||
pub mod x_version;
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ fn main() {
|
||||||
|
|
||||||
let handle = s.spawn(|| {
|
let handle = s.spawn(|| {
|
||||||
let mut flag = false;
|
let mut flag = false;
|
||||||
$p::check($($args, )* &mut flag);
|
$p::check($($args),* , &mut flag);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bad.store(true, Ordering::Relaxed);
|
bad.store(true, Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
|
@ -112,8 +112,6 @@ fn main() {
|
||||||
check!(alphabetical, &compiler_path);
|
check!(alphabetical, &compiler_path);
|
||||||
check!(alphabetical, &library_path);
|
check!(alphabetical, &library_path);
|
||||||
|
|
||||||
check!(x_version, &root_path, &cargo);
|
|
||||||
|
|
||||||
let collected = {
|
let collected = {
|
||||||
drain_handles(&mut handles);
|
drain_handles(&mut handles);
|
||||||
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
use semver::Version;
|
|
||||||
use std::io::ErrorKind;
|
|
||||||
use std::path::Path;
|
|
||||||
use std::process::{Command, Stdio};
|
|
||||||
|
|
||||||
pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
|
|
||||||
let result = Command::new("x").arg("--wrapper-version").stdout(Stdio::piped()).spawn();
|
|
||||||
// This runs the command inside a temporary directory.
|
|
||||||
// This allows us to compare output of result to see if `--wrapper-version` is not a recognized argument to x.
|
|
||||||
let temp_result = Command::new("x")
|
|
||||||
.arg("--wrapper-version")
|
|
||||||
.current_dir(std::env::temp_dir())
|
|
||||||
.stdout(Stdio::piped())
|
|
||||||
.spawn();
|
|
||||||
|
|
||||||
let (child, temp_child) = match (result, temp_result) {
|
|
||||||
(Ok(child), Ok(temp_child)) => (child, temp_child),
|
|
||||||
(Err(e), _) | (_, Err(e)) => match e.kind() {
|
|
||||||
ErrorKind::NotFound => return,
|
|
||||||
_ => return tidy_error!(bad, "failed to run `x`: {}", e),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let output = child.wait_with_output().unwrap();
|
|
||||||
let temp_output = temp_child.wait_with_output().unwrap();
|
|
||||||
|
|
||||||
if output != temp_output {
|
|
||||||
return tidy_error!(
|
|
||||||
bad,
|
|
||||||
"Current version of x does not support the `--wrapper-version` argument\nConsider updating to the newer version of x by running `cargo install --path src/tools/x`"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if output.status.success() {
|
|
||||||
let version = String::from_utf8_lossy(&output.stdout);
|
|
||||||
let version = Version::parse(version.trim_end()).unwrap();
|
|
||||||
|
|
||||||
if let Some(expected) = get_x_wrapper_version(root, cargo) {
|
|
||||||
if version < expected {
|
|
||||||
return tidy_error!(
|
|
||||||
bad,
|
|
||||||
"Current version of x is {version}, but the latest version is {expected}\nConsider updating to the newer version of x by running `cargo install --path src/tools/x`"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return tidy_error!(
|
|
||||||
bad,
|
|
||||||
"Unable to parse the latest version of `x` at `src/tools/x/Cargo.toml`"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return tidy_error!(bad, "failed to check version of `x`: {}", output.status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse latest version out of `x` Cargo.toml
|
|
||||||
fn get_x_wrapper_version(root: &Path, cargo: &Path) -> Option<Version> {
|
|
||||||
let mut cmd = cargo_metadata::MetadataCommand::new();
|
|
||||||
cmd.cargo_path(cargo)
|
|
||||||
.manifest_path(root.join("src/tools/x/Cargo.toml"))
|
|
||||||
.no_deps()
|
|
||||||
.features(cargo_metadata::CargoOpt::AllFeatures);
|
|
||||||
let mut metadata = t!(cmd.exec());
|
|
||||||
metadata.packages.pop().map(|x| x.version)
|
|
||||||
}
|
|
|
@ -52,14 +52,6 @@ fn exec_or_status(command: &mut Command) -> io::Result<ExitStatus> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match env::args().skip(1).next().as_deref() {
|
|
||||||
Some("--wrapper-version") => {
|
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
|
||||||
println!("{}", version);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
let current = match env::current_dir() {
|
let current = match env::current_dir() {
|
||||||
Ok(dir) => dir,
|
Ok(dir) => dir,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue