about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2017-02-09 14:44:39 -0500
committerSteve Klabnik <steve@steveklabnik.com>2017-02-13 13:41:20 -0500
commit775726092eaa4d0e0e397e9032467c2d1d06ed37 (patch)
tree0c8aa6f12a7300a9669a261bf2f0cbae1e55a1ce
parent626cf3a263dcac94c88910a6a67018e82b564c75 (diff)
downloadrust-775726092eaa4d0e0e397e9032467c2d1d06ed37.tar.gz
rust-775726092eaa4d0e0e397e9032467c2d1d06ed37.zip
Add exceptions to tidy
We've decided that these deps are okay.
-rw-r--r--src/tools/rustbook/src/main.rs25
-rw-r--r--src/tools/tidy/src/deps.rs26
2 files changed, 42 insertions, 9 deletions
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index 837c934934a..b77baed5326 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -1,3 +1,13 @@
+// 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.
+//
 extern crate mdbook;
 #[macro_use]
 extern crate clap;
@@ -11,19 +21,21 @@ use clap::{App, ArgMatches, SubCommand, AppSettings};
 
 use mdbook::MDBook;
 
-const NAME: &'static str = "rustbook";
-
 fn main() {
-    // Create a list of valid arguments and sub-commands
-    let matches = App::new(NAME)
+    let d_message = "-d, --dest-dir=[dest-dir]
+'The output directory for your book{n}(Defaults to ./book when omitted)'";
+    let dir_message = "[dir]
+'A directory for your book{n}(Defaults to Current Directory when omitted)'";
+
+    let matches = App::new("rustbook")
                     .about("Build a book with mdBook")
                     .author("Steve Klabnik <steve@steveklabnik.com>")
                     .version(&*format!("v{}", crate_version!()))
                     .setting(AppSettings::SubcommandRequired)
                     .subcommand(SubCommand::with_name("build")
                         .about("Build the book from the markdown files")
-                        .arg_from_usage("-d, --dest-dir=[dest-dir] 'The output directory for your book{n}(Defaults to ./book when omitted)'")
-                        .arg_from_usage("[dir] 'A directory for your book{n}(Defaults to Current Directory when omitted)'"))
+                        .arg_from_usage(d_message)
+                        .arg_from_usage(dir_message))
                     .get_matches();
 
     // Check which subcomamnd the user ran...
@@ -76,4 +88,3 @@ fn get_book_dir(args: &ArgMatches) -> PathBuf {
         env::current_dir().unwrap()
     }
 }
-
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 7592c09a913..e1c44a20e97 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -15,16 +15,38 @@ use std::io::Read;
 use std::path::Path;
 
 static LICENSES: &'static [&'static str] = &[
-    "MIT/Apache-2.0"
+    "MIT/Apache-2.0",
+    "Apache-2.0/MIT",
+    "MIT OR Apache-2.0",
+    "MIT",
+    "Unlicense/MIT",
+];
+
+/// These MPL licensed projects are acceptable, but only these.
+static EXCEPTIONS: &'static [&'static str] = &[
+    "mdbook",
+    "pest",
+    "thread-id",
 ];
 
 pub fn check(path: &Path, bad: &mut bool) {
     let path = path.join("vendor");
     assert!(path.exists(), "vendor directory missing");
     let mut saw_dir = false;
-    for dir in t!(path.read_dir()) {
+    'next_path: for dir in t!(path.read_dir()) {
         saw_dir = true;
         let dir = t!(dir);
+
+        // skip our exceptions
+        for exception in EXCEPTIONS {
+            if dir.path()
+                .to_str()
+                .unwrap()
+                .contains(&format!("src/vendor/{}", exception)) {
+                continue 'next_path;
+            }
+        }
+
         let toml = dir.path().join("Cargo.toml");
         if !check_license(&toml) {
             *bad = true;