about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorGarrett Squire <garrettsquire@gmail.com>2016-05-04 10:25:17 -0700
committerGarrett Squire <garrettsquire@gmail.com>2016-05-04 10:25:17 -0700
commitb3de04214646a33fa5a14fbb2e8ba55e7ee5a707 (patch)
treef771350a8d5272406e885068c3731af2aa1db058 /src
parent3157691f963a86776cb7e6a7842f566032890aba (diff)
downloadrust-b3de04214646a33fa5a14fbb2e8ba55e7ee5a707.tar.gz
rust-b3de04214646a33fa5a14fbb2e8ba55e7ee5a707.zip
add a check to make tidy to ensure cargo lock file is updated
Diffstat (limited to 'src')
-rw-r--r--src/rustc/Cargo.lock33
-rw-r--r--src/tools/tidy/src/cargo_lock.rs43
-rw-r--r--src/tools/tidy/src/main.rs2
3 files changed, 51 insertions, 27 deletions
diff --git a/src/rustc/Cargo.lock b/src/rustc/Cargo.lock
index 1fa4d5398f4..b4c2e21651e 100644
--- a/src/rustc/Cargo.lock
+++ b/src/rustc/Cargo.lock
@@ -8,15 +8,6 @@ dependencies = [
 ]
 
 [[package]]
-name = "advapi32-sys"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
 name = "arena"
 version = "0.0.0"
 
@@ -29,7 +20,7 @@ name = "flate"
 version = "0.0.0"
 dependencies = [
  "build_helper 0.1.0",
- "gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -38,12 +29,8 @@ version = "0.0.0"
 
 [[package]]
 name = "gcc"
-version = "0.3.17"
+version = "0.3.28"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
-]
 
 [[package]]
 name = "graphviz"
@@ -192,7 +179,7 @@ name = "rustc_llvm"
 version = "0.0.0"
 dependencies = [
  "build_helper 0.1.0",
- "gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc_bitflags 0.0.0",
 ]
 
@@ -233,6 +220,7 @@ dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
  "rustc_const_eval 0.0.0",
+ "rustc_const_math 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -278,6 +266,7 @@ version = "0.0.0"
 dependencies = [
  "log 0.0.0",
  "rustc 0.0.0",
+ "serialize 0.0.0",
  "syntax 0.0.0",
 ]
 
@@ -323,7 +312,7 @@ version = "0.0.0"
 dependencies = [
  "arena 0.0.0",
  "build_helper 0.1.0",
- "gcc 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.28 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.0.0",
  "rustc 0.0.0",
  "rustc_back 0.0.0",
@@ -362,13 +351,3 @@ dependencies = [
  "syntax 0.0.0",
 ]
 
-[[package]]
-name = "winapi"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
diff --git a/src/tools/tidy/src/cargo_lock.rs b/src/tools/tidy/src/cargo_lock.rs
new file mode 100644
index 00000000000..4324db489b7
--- /dev/null
+++ b/src/tools/tidy/src/cargo_lock.rs
@@ -0,0 +1,43 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::path::Path;
+
+const CARGO_LOCK: &'static str = "Cargo.lock";
+
+pub fn check(path: &Path, bad: &mut bool) {
+    use std::process::Command;
+
+    super::walk(path,
+                &mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
+                &mut |file| {
+        let name = file.file_name().unwrap().to_string_lossy();
+        if name == CARGO_LOCK {
+            let rel_path = file.strip_prefix(path).unwrap();
+            let ret_code = Command::new("git")
+                                        .arg("diff-index")
+                                        .arg("--quiet")
+                                        .arg("HEAD")
+                                        .arg(rel_path)
+                                        .current_dir(path)
+                                        .status()
+                                        .unwrap_or_else(|e| {
+                                            panic!("could not run git diff-index: {}", e);
+                                        });
+            if !ret_code.success() {
+                let parent_path = file.parent().unwrap().join("Cargo.toml");
+                print!("dirty lock file found at {} ", rel_path.display());
+                println!("please commit your changes or update the lock file by running:");
+                println!("\n\tcargo update --manifest-path {}", parent_path.display());
+                *bad = true;
+            }
+        }
+    });
+}
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index e9e2508aba9..2839bbded1a 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -35,6 +35,7 @@ mod style;
 mod errors;
 mod features;
 mod cargo;
+mod cargo_lock;
 
 fn main() {
     let path = env::args_os().skip(1).next().expect("need an argument");
@@ -46,6 +47,7 @@ fn main() {
     errors::check(&path, &mut bad);
     cargo::check(&path, &mut bad);
     features::check(&path, &mut bad);
+    cargo_lock::check(&path, &mut bad);
 
     if bad {
         panic!("some tidy checks failed");