root/buildtools/license-audit

Revision d0a64b649e4eac288431ac20d986830b57fb044d, 18.0 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 10 months ago)

Add support for riemann as the IEP subsystem.
Remove all traces of Esper.
Change the license on all our bits to simply match reconnoiter.
Cleanup copyrights and embelish auditing script.
Updated test 108 to check riemann iep results.

  • Property mode set to 100755
Line 
1 #!/usr/bin/perl
2
3 use Getopt::Long;
4 use File::Find;
5 use strict;
6
7 my $include_re = undef;
8 my $exclude_re = undef;
9
10 GetOptions("i=s" => \$include_re,
11            "x=s" => \$exclude_re);
12 die "-i or -x, not both\n", if(defined($include_re) && defined($exclude_re));
13 $exclude_re = qr/$exclude_re/ if defined($exclude_re);
14 $include_re ||= 'unknown' unless defined($exclude_re);
15 $include_re = qr/$include_re/ if defined($include_re);
16
17 my %licenses = (
18   'perl' => normalize(q%
19     This code may be used and distributed under the same license as any
20     version of Perl
21 %),
22   'openevidence-BSD' => normalize(q%
23  * Redistribution and use in source and binary forms, with or without
24  * modification, are permitted provided that the following conditions
25  * are met:
26  *
27  * 1. Redistributions of source code must retain the above copyright
28  *    notice, this list of conditions, the following disclaimer,
29  *    and the original OpenSSL and SSLeay Licences below.
30  *
31  * 2. Redistributions in binary form must reproduce the above copyright
32  *    notice, this list of conditions, the following disclaimer
33  *    and the original OpenSSL and SSLeay Licences below in
34  *    the documentation and/or other materials provided with the
35  *    distribution.
36  *
37  * 3. All advertising materials mentioning features or use of this
38  *    software must display the following acknowledgments:
39  *    "This product includes software developed by the Openevidence Project
40  *    for use in the OpenEvidence Toolkit. (http://www.openevidence.org/)"
41  *    This product includes software developed by the OpenSSL Project
42  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
43  *    This product includes cryptographic software written by Eric Young
44  *    (eay@cryptsoft.com).  This product includes software written by Tim
45  *    Hudson (tjh@cryptsoft.com)."
46  *
47  * 4. The names "OpenEvidence Toolkit" and "OpenEvidence Project" must not be
48  *    used to endorse or promote products derived from this software without
49  *    prior written permission. For written permission, please contact
50  *    openevidence-core@openevidence.org.
51  *
52  * 5. Products derived from this software may not be called "OpenEvidence"
53  *    nor may "OpenEvidence" appear in their names without prior written
54  *    permission of the OpenEvidence Project.
55  *
56  * 6. Redistributions of any form whatsoever must retain the following
57  *    acknowledgments:
58  *    "This product includes software developed by the OpenEvidence Project
59  *    for use in the OpenEvidence Toolkit (http://www.openevidence.org/)
60  *    This product includes software developed by the OpenSSL Project
61  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
62  *    This product includes cryptographic software written by Eric Young
63  *    (eay@cryptsoft.com).  This product includes software written by Tim
64  *    Hudson (tjh@cryptsoft.com)."
65  *
66  * THIS SOFTWARE IS PROVIDED BY THE OpenEvidence PROJECT ``AS IS'' AND ANY
67  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
69  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenEvidence PROJECT OR
70  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
71  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
72  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
73  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
74  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
75  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
76  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
77  * OF THE POSSIBILITY OF SUCH DAMAGE.
78 %),
79   'labs-omni-BSD' => normalize(q%
80 Redistribution and use in source and binary forms, with or without
81 modification, are permitted provided that the following conditions are
82 met:
83
84     * Redistributions of source code must retain the above copyright
85       notice, this list of conditions and the following disclaimer.
86     * Redistributions in binary form must reproduce the above
87       copyright notice, this list of conditions and the following
88       disclaimer in the documentation and/or other materials provided
89       with the distribution.
90     * Neither the name OmniTI Computer Consulting, Inc. nor the names
91       of its contributors may be used to endorse or promote products
92       derived from this software without specific prior written
93       permission.
94
95 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
96 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
97 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
98 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
99 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
100 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
101 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
102 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
103 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
104 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
105 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
106 %),
107   'labs-msys-BSD' => normalize(q%
108 Redistribution and use in source and binary forms, with or without
109 modification, are permitted provided that the following conditions are
110 met:
111
112     * Redistributions of source code must retain the above copyright
113       notice, this list of conditions and the following disclaimer.
114     * Redistributions in binary form must reproduce the above
115       copyright notice, this list of conditions and the following
116       disclaimer in the documentation and/or other materials provided
117       with the distribution.
118     * Neither the name Message Systems, Inc. nor the names
119       of its contributors may be used to endorse or promote products
120       derived from this software without specific prior written
121       permission.
122
123 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
124 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
125 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
126 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
127 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
128 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
129 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
130 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
131 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
132 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
133 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134 %),
135   'labs-circonus-BSD' => normalize(q%
136 Redistribution and use in source and binary forms, with or without
137 modification, are permitted provided that the following conditions are
138 met:
139
140     * Redistributions of source code must retain the above copyright
141       notice, this list of conditions and the following disclaimer.
142     * Redistributions in binary form must reproduce the above
143       copyright notice, this list of conditions and the following
144       disclaimer in the documentation and/or other materials provided
145       with the distribution.
146     * Neither the name Circonus, Inc. nor the names
147       of its contributors may be used to endorse or promote products
148       derived from this software without specific prior written
149       permission.
150
151 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
152 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
153 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
154 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
155 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
156 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
157 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
158 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
159 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
160 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
161 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
162 %),
163   'Apache-2.0' => normalize(q%
164  Licensed under the Apache License, Version 2.0 (the "License");
165  you may not use this file except in compliance with the License.
166  You may obtain a copy of the License at
167
168      http://www.apache.org/licenses/LICENSE-2.0
169
170  Unless required by applicable law or agreed to in writing, software
171  distributed under the License is distributed on an "AS IS" BASIS,
172  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
173  See the License for the specific language governing permissions and
174  limitations under the License.
175 %),
176   'LGPL' => normalize(q%
177    This library is free software; you can redistribute it and/or
178    modify it under the terms of the GNU Lesser General Public
179    License as published by the Free Software Foundation; either
180    version 2.1 of the License, or (at your option) any later version.
181
182    This library is distributed in the hope that it will be useful,
183    but WITHOUT ANY WARRANTY; without even the implied warranty of
184    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
185    Lesser General Public License for more details.
186 %),
187   'BSDish-cu' => normalize(q%
188   This software is provided 'as-is', without any express or implied
189   warranty. In no event will the authors be held liable for any
190   damages arising from the use of this software.
191  
192   Permission is granted to anyone to use this software for any
193   purpose, including commercial applications, and to alter it and
194   redistribute it freely, subject to the following restrictions:
195  
196   1. The origin of this software must not be misrepresented; you
197   must not claim that you wrote the original software. If you use
198   this software in a product, an acknowledgment in the product
199   documentation would be appreciated but is not required.
200  
201   2. Altered source versions must be plainly marked as such, and
202   must not be misrepresented as being the original software.
203  
204   3. This notice may not be removed or altered from any source
205   distribution.
206 %),
207   'BSD' => [
208     normalize(q%
209  Redistribution and use in source and binary forms, with or without
210  modification, are permitted provided that the following conditions
211  are met:
212  1. Redistributions of source code must retain the above copyright
213     notice, this list of conditions and the following disclaimer.
214  2. Redistributions in binary form must reproduce the above copyright
215     notice, this list of conditions and the following disclaimer in the
216     documentation and/or other materials provided with the distribution.
217  3. All advertising materials mentioning features or use of this software
218     must display the following acknowledgement:
219       This product includes software developed by the University of
220       California, Berkeley and its contributors.
221  4. Neither the name of the University nor the names of its contributors
222     may be used to endorse or promote products derived from this software
223     without specific prior written permission.
224  
225  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
226  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
227  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
228  ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
229  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
230  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
232  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
233  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
234  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
235  SUCH DAMAGE.
236 %),
237     normalize(q%
238  Redistribution and use in source and binary forms, with or without
239  modification, are permitted provided that the following conditions
240  are met:
241  1. Redistributions of source code must retain the above copyright
242     notice, this list of conditions and the following disclaimer.
243  2. Redistributions in binary form must reproduce the above copyright
244     notice, this list of conditions and the following disclaimer in the
245     documentation and/or other materials provided with the distribution.
246  3. All advertising materials mentioning features or use of this software
247     must display the following acknowledgement:
248       This product includes software developed by the NetBSD
249       Foundation, Inc. and its contributors.
250  4. Neither the name of The NetBSD Foundation nor the names of its
251     contributors may be used to endorse or promote products derived
252     from this software without specific prior written permission.
253
254  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
255  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
256  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
257  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
258  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
259  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
260  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
262  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
263  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
264  POSSIBILITY OF SUCH DAMAGE.
265 %)],
266   'MPL' => [
267     normalize(q%see LICENSE-MPL-RabbitMQ%),
268   ],
269   'MIT' => [
270     normalize(q%released under the MIT License%),
271     normalize(q%
272 This library is free software; you can redistribute it and/or modify
273 it under the terms of the MIT license. See COPYING for details.
274 %),
275     normalize(q%
276 Permission to use, copy, modify, and/or distribute this software for any
277 purpose with or without fee is hereby granted, provided that the above
278 copyright notice and this permission notice appear in all copies.
279
280 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
281 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
282 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
283 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
284 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
285 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
286 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
287 %),
288     normalize(q%See dynasm.lua for full copyright%),
289     normalize(q%See Copyright Notice in luajit.h%),
290     normalize(q%
291 Permission is hereby granted, free of charge, to any person obtaining
292 a copy of this software and associated documentation files (the
293 "Software"), to deal in the Software without restriction, including
294 without limitation the rights to use, copy, modify, merge, publish,
295 distribute, sublicense, and/or sell copies of the Software, and to
296 permit persons to whom the Software is furnished to do so, subject to
297 the following conditions:
298
299 The above copyright notice and this permission notice shall be
300 included in all copies or substantial portions of the Software.
301
302 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
303 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
304 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
305 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
306 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
307 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
308 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
309 %),
310     normalize(q%See Copyright Notice in lua.h%),
311     normalize(q%
312  Permission is hereby granted, free of charge, to any person obtaining
313  a copy of this software and associated documentation files (the
314  "Software"), to deal in the Software without restriction, including
315  without limitation the rights to use, copy, modify, merge, publish,
316  distribute, sublicense, and/or sell copies of the Software, and to
317  permit persons to whom the Software is furnished to do so, subject to
318  the following conditions:
319
320  The above copyright notice and this permission notice shall be
321  included in all copies or substantial portions of the Software.
322
323  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
324  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
325  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
326  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
327  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
328  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
329  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
330 %)
331            ],
332   'modified-bsd' => normalize(q%this file may be licensed under the new BSD license%),
333   'public-domain' => [
334     normalize(q%Public domain%),
335     normalize(q%Donated to the public domain%),
336     normalize(q%placed in the public domain%),
337     normalize(q%released to the public domain%),
338   ],
339   'N/A' => [
340     normalize(q%Automatically generated%),
341     normalize(q%Generated by the protocol buffer compiler.%),
342   ]
343 );
344
345 find( {
346         'wanted' => \&liccheck,
347         'no_chdir' => 1,
348       }, '.');
349
350 sub liccheck {
351   if($_ eq '.svn') {
352     $File::Find::prune = 1;
353     return 0;
354   }
355   my $fname = $File::Find::name;
356   if($fname =~ /\.(?:c|h|java|cpp|hpp|C|s|lua)$/) {
357     next if $fname =~ /^\.\/src\/lua\/(?:test|etc)\//;
358     my $license = detect_license($fname);
359     if(($include_re && $license =~ $include_re) ||
360        ($exclude_re && $license !~ $exclude_re)) {
361       print "$fname -> ($license)\n";
362     }
363   }
364   return 1;
365 }
366
367 sub normalize($) {
368   my $c = shift;
369   $c =~ s/[^a-zA-Z\s]/ /g;
370   $c =~ s/\s+/ /sg;
371   $c;
372 }
373 sub detect_license {
374   my $license = 'unknown';
375   my $fname = shift;
376   open(F, "<$fname") || return $license;
377   local $/ = undef;
378   my $c = <F>;
379   close(F);
380   $c = normalize($c);
381   foreach my $l (keys %licenses) {
382     my $sa = $licenses{$l};
383     $sa = [$sa] unless ref $sa eq 'ARRAY';
384     foreach my $s (@$sa) {
385       if(index($c, $s) >= 0) {
386         return $l;
387       }
388     }
389   }
390   chomp(my $st = `git ls-tree HEAD -- $fname`);
391   return 'ignored' unless(length($st));
392   return $license;
393 }
Note: See TracBrowser for help on using the browser.