]> git.lizzy.rs Git - rust.git/commitdiff
etc: licenseck: don't hardcode a specific year
authorAdrien Tétar <adri-from-59@hotmail.fr>
Sat, 4 Jan 2014 20:16:57 +0000 (21:16 +0100)
committerAdrien Tétar <adri-from-59@hotmail.fr>
Sat, 4 Jan 2014 20:49:52 +0000 (21:49 +0100)
src/compiletest/common.rs
src/compiletest/header.rs
src/compiletest/runtest.rs
src/etc/licenseck.py
src/libsyntax/ext/source_util.rs

index 6a365ae05dd951b3c262d3d1e87516f27198d3da..b76238ca388bb8ef09c1f25d35d8c5ecdce58b0b 100644 (file)
@@ -1,5 +1,5 @@
-// Copyright 2012-2013 The Rust Project Developers. See the
-// COPYRIGHT file at the top-level directory of this distribution and at
+// Copyright 2012-2013 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
index 98989a2cba29c342074c464d58f73b93cac2e2aa..d4a4f38cc63baca38560f6e610058c5e739374ff 100644 (file)
@@ -1,5 +1,5 @@
-// Copyright 2012-2013 The Rust Project Developers. See the
-// COPYRIGHT file at the top-level directory of this distribution and at
+// Copyright 2012-2013 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
index b22c17fb4387e804bdd24523cfabd3787be60ebc..6136c39bb7390d1faac457d0cd98d9e364fd1334 100644 (file)
@@ -1,5 +1,5 @@
-// Copyright 2012-2013 The Rust Project Developers. See the
-// COPYRIGHT file at the top-level directory of this distribution and at
+// Copyright 2012-2013 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
index 073322b0815a2251abe558383c738555e0b49b7b..b5a721c03ff099149bf22a51c12bb1767f9951d6 100644 (file)
@@ -8,20 +8,8 @@
 # option. This file may not be copied, modified, or distributed
 # except according to those terms.
 
-license0 = """\
-// Copyright 2012-2013 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.
-"""
-
-license1 = """\
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+license1 = """// Copyright """
+license2 = """ The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -32,20 +20,8 @@ license1 = """\
 // except according to those terms.
 """
 
-license2 = """\
-// Copyright 2013 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.
-"""
-
-license3 = """\
-# Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+license3 = """# Copyright """
+license4 = """ The Rust Project Developers. See the COPYRIGHT
 # file at the top-level directory of this distribution and at
 # http://rust-lang.org/COPYRIGHT.
 #
@@ -56,20 +32,6 @@ license3 = """\
 # except according to those terms.
 """
 
-license4 = """\
-// Copyright 2012-2013 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.
-"""
-
-licenses = [license0, license1, license2, license3, license4]
-
 exceptions = [
     "rt/rust_android_dummy.cpp", # BSD, chromium
     "rt/rust_android_dummy.h", # BSD, chromium
@@ -82,20 +44,19 @@ exceptions = [
 ]
 
 def check_license(name, contents):
-    valid_license = False
-    for a_valid_license in licenses:
-        if contents.startswith(a_valid_license):
-            valid_license = True
-            break
-    if valid_license:
-        return True
-
+    # Whitelist check
     for exception in exceptions:
         if name.endswith(exception):
             return True
 
+    # Xfail check
     firstlineish = contents[:100]
     if firstlineish.find("xfail-license") != -1:
         return True
 
-    return False
+    # License check
+    boilerplate = contents[:500]
+    if (boilerplate.find(license1) == -1 or boilerplate.find(license2) == -1) and \
+       (boilerplate.find(license3) == -1 or boilerplate.find(license4) == -1):
+        return False
+    return True
\ No newline at end of file
index 5f634f7f054e27b3f69530baad85601ab721075d..57da01ccad0fe8c42c6f3647917ddf1c14a50853 100644 (file)
@@ -1,5 +1,5 @@
-// Copyright 2012-2013 The Rust Project Developers. See the
-// COPYRIGHT file at the top-level directory of this distribution and at
+// Copyright 2012-2013 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