Add a license check to tidy. #4018
This commit is contained in:
parent
1244c0b6fd
commit
6b6acde972
37 changed files with 160 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
# this combines all the working run-pass tests into a single large crate so we
|
# this combines all the working run-pass tests into a single large crate so we
|
||||||
# can run it "fast": spawning zillions of windows processes is our major build
|
# can run it "fast": spawning zillions of windows processes is our major build
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
# Script for extracting compilable fragments from markdown
|
# Script for extracting compilable fragments from markdown
|
||||||
# documentation. See prep.js for a description of the format
|
# documentation. See prep.js for a description of the format
|
||||||
# recognized by this tool. Expects a directory fragements/ to exist
|
# recognized by this tool. Expects a directory fragements/ to exist
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
# This script is for extracting the grammar from the rust docs.
|
# This script is for extracting the grammar from the rust docs.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import os, tarfile, re, shutil, sys
|
import os, tarfile, re, shutil, sys
|
||||||
from snapshot import *
|
from snapshot import *
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import os, tarfile, hashlib, re, shutil, sys
|
import os, tarfile, hashlib, re, shutil, sys
|
||||||
from snapshot import *
|
from snapshot import *
|
||||||
|
|
72
src/etc/licenseck.py
Normal file
72
src/etc/licenseck.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
license1 = """// Copyright 2012 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.
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
|
# 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 = [license1, license2, license3]
|
||||||
|
|
||||||
|
exceptions = [
|
||||||
|
"rt/rust_android_dummy.cpp", # BSD, chromium
|
||||||
|
"rt/rust_android_dummy.h", # BSD, chromium
|
||||||
|
"rt/isaac/randport.cpp", # public domain
|
||||||
|
"rt/isaac/rand.h", # public domain
|
||||||
|
"rt/isaac/standard.h", # public domain
|
||||||
|
]
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
for exception in exceptions:
|
||||||
|
if name.endswith(exception):
|
||||||
|
return True
|
||||||
|
|
||||||
|
firstlineish = contents[:100]
|
||||||
|
if firstlineish.find("xfail-license") != -1:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import snapshot, sys
|
import snapshot, sys
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import os, tarfile, hashlib, re, shutil
|
import os, tarfile, hashlib, re, shutil
|
||||||
from snapshot import *
|
from snapshot import *
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import re, os, sys, glob, tarfile, shutil, subprocess, tempfile
|
import re, os, sys, glob, tarfile, shutil, subprocess, tempfile
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
#
|
#
|
||||||
# this script attempts to turn doc comment attributes (#[doc = "..."])
|
# this script attempts to turn doc comment attributes (#[doc = "..."])
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
import sys, fileinput, subprocess, re
|
import sys, fileinput, subprocess, re
|
||||||
|
from licenseck import *
|
||||||
|
|
||||||
err=0
|
err=0
|
||||||
cols=78
|
cols=78
|
||||||
|
@ -13,14 +15,25 @@ result=config_proc.communicate()[0]
|
||||||
true="true".encode('utf8')
|
true="true".encode('utf8')
|
||||||
autocrlf=result.strip() == true if result is not None else False
|
autocrlf=result.strip() == true if result is not None else False
|
||||||
|
|
||||||
def report_err(s):
|
def report_error_name_no(name, no, s):
|
||||||
global err
|
global err
|
||||||
print("%s:%d: %s" % (fileinput.filename(), fileinput.filelineno(), s))
|
print("%s:%d: %s" % (name, no, s))
|
||||||
err=1
|
err=1
|
||||||
|
|
||||||
|
def report_err(s):
|
||||||
|
report_error_name_no(fileinput.filename(), fileinput.filelineno(), s)
|
||||||
|
|
||||||
|
def do_license_check(name, contents):
|
||||||
|
if not check_license(name, contents):
|
||||||
|
report_error_name_no(name, 1, "incorrect license")
|
||||||
|
|
||||||
|
|
||||||
file_names = [s for s in sys.argv[1:] if (not s.endswith("_gen.rs"))
|
file_names = [s for s in sys.argv[1:] if (not s.endswith("_gen.rs"))
|
||||||
and (not ".#" in s)]
|
and (not ".#" in s)]
|
||||||
|
|
||||||
|
current_name = ""
|
||||||
|
current_contents = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
for line in fileinput.input(file_names,
|
for line in fileinput.input(file_names,
|
||||||
openhook=fileinput.hook_encoded("utf-8")):
|
openhook=fileinput.hook_encoded("utf-8")):
|
||||||
|
@ -42,6 +55,19 @@ try:
|
||||||
|
|
||||||
if line_len > cols:
|
if line_len > cols:
|
||||||
report_err("line longer than %d chars" % cols)
|
report_err("line longer than %d chars" % cols)
|
||||||
|
|
||||||
|
if fileinput.isfirstline() and current_name != "":
|
||||||
|
do_license_check(current_name, current_contents)
|
||||||
|
|
||||||
|
if fileinput.isfirstline():
|
||||||
|
current_name = fileinput.filename()
|
||||||
|
current_contents = ""
|
||||||
|
|
||||||
|
current_contents += line
|
||||||
|
|
||||||
|
if current_name != "":
|
||||||
|
do_license_check(current_name, current_contents)
|
||||||
|
|
||||||
except UnicodeDecodeError, e:
|
except UnicodeDecodeError, e:
|
||||||
report_err("UTF-8 decoding error " + str(e))
|
report_err("UTF-8 decoding error " + str(e))
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# xfail-license
|
||||||
|
|
||||||
# This digests UnicodeData.txt and DerivedCoreProperties.txt and emits rust
|
# This digests UnicodeData.txt and DerivedCoreProperties.txt and emits rust
|
||||||
# code covering the core properties. Since this is a pretty rare event we
|
# code covering the core properties. Since this is a pretty rare event we
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- rust -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- rust -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2012 The Rust Project Developers.src/libcore/os.rs
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
// This file is imported into every module by default.
|
// This file is imported into every module by default.
|
||||||
|
|
||||||
/* Reexported core operators */
|
/* Reexported core operators */
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- rust -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- rust -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- rust -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
A Big integer (signed version: BigInt, unsigned version: BigUint).
|
A Big integer (signed version: BigInt, unsigned version: BigUint).
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
||||||
Generic communication channels for things that can be represented as,
|
Generic communication channels for things that can be represented as,
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
//! A priority queue implemented with a binary heap
|
//! A priority queue implemented with a binary heap
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// xfail-license
|
||||||
|
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
#include "../../rust_globals.h"
|
#include "../../rust_globals.h"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// -*- mode: c++ -*-
|
// -*- mode: c++ -*-
|
||||||
|
// xfail-license
|
||||||
|
|
||||||
#ifndef CONTEXT_H
|
#ifndef CONTEXT_H
|
||||||
#define CONTEXT_H
|
#define CONTEXT_H
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-license
|
||||||
|
|
||||||
#include "gpr.h"
|
#include "gpr.h"
|
||||||
|
|
||||||
#define LOAD(rn) do { \
|
#define LOAD(rn) do { \
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// xfail-license
|
||||||
// General-purpose registers. This structure is used during stack crawling.
|
// General-purpose registers. This structure is used during stack crawling.
|
||||||
|
|
||||||
#ifndef GPR_H
|
#ifndef GPR_H
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// xfail-license
|
||||||
|
|
||||||
#define RUSTRT_RBX 0
|
#define RUSTRT_RBX 0
|
||||||
#define RUSTRT_RSP 1
|
#define RUSTRT_RSP 1
|
||||||
#define RUSTRT_RBP 2
|
#define RUSTRT_RBP 2
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- mode: c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- mode: c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// -*- c++ -*-
|
|
||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue