Total number of files: 24341
Total number of licensed files: 14367
Total number of NPLed files: 9475
Total number of MPLed files: 4892
Total number of GPLed files: 2043
Total number of LGPLed files: 72
Total number of BSD files: 57
Total number of MIT files: 8
Percent licensed under the NPL: 66%
Percent of MPL files also GPLed: 42%
Notes:
- *CHOKE*! ONE HUNDRED SIXTY-FIVE ***FEWER*** NPLed
FILES!??!?!?!?!?!?!?!?!?!??! CAN THIS POSSIBLY BE CORRECT?!??!?!
- *CACK*!!! ONE HUNDRED THIRTY-NINE ***MORE*** MPLed
FILES?!?!??!?!?!?!??!?!?!?!! MUST BE!
- Four fewer GPLed files?
- Good start on the squeak AOL, but let's keep that grease coming. And
get those GPL numbers up.
- LGPL count is now fixed and catches both "Lesser" and "Library" (new
and old) versions.
- One more BSD file, but according to Gerv this count is bad.
- Updated script attached.
#!/bin/perl
# lstats: A cool Perl script to summarize the licensing status of a project
# Copyright (C) 2000 Gary R. Van Sickle (tiberius at braemarinc dot com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use File::Find;
use Time::localtime;
use Cwd;
$ALL_FILES;
$NUM_FILES=0;
$NUM_NEW_FILES=0;
$NUM_NPL_FILES=0;
$NUM_MPL_FILES=0;
$NUM_GPL_FILES=0;
$NUM_LGPL_FILES=0;
$NUM_BSD_FILES=0;
$NUM_MIT_FILES=0;
$NUM_LICENSED_FILES=0;
$PCT_NPL=0;
$PCT_MPL_GPL=0;
$ELAPSED_TIME=time;
$ROOT_DIR=@ARGV[0];
if(length($ROOT_DIR) == 0)
{
$ROOT_DIR = ".";
}
sub ScanFiles
{
my (@NPL_FILES, @MPL_FILES, @GPL_FILES, @LGPL_FILES, @BSD_FILES, @MIT_FILES);
#%NPLL_FILES = `grep -lisI "Mozilla Public" $_[0]`;
#print "$NPLL_FILES[0]\n";
print "N";
@NPL_FILES = `grep -lisI "Netscape Public" $_[0]`;
$NUM_NPL_FILES += scalar(@NPL_FILES);
print "M";
@MPL_FILES = `grep -lisI "Mozilla Public" $_[0]`;
$NUM_MPL_FILES += scalar(@MPL_FILES);
print "G";
@GPL_FILES = `grep -lisI "GNU General Public License" $_[0]`;
$NUM_GPL_FILES += scalar(@GPL_FILES);
print "L";
@LGPL_FILES = `egrep -lisI "GNU Lesser General Public|GNU Library General
Public" $_[0]`;
$NUM_LGPL_FILES += scalar(@LGPL_FILES);
print "B";
@BSD_FILES = `grep -lisI "Regents of the University of California" $_[0]`;
$NUM_BSD_FILES += scalar(@BSD_FILES);
print "m";
@MIT_FILES = `grep -lisI "Massachusetts Institute of Technology" $_[0]`;
$NUM_MIT_FILES += scalar(@MIT_FILES);
}
sub do_stats
{
unless(grep(/\.obj$|\.exe$|\.dll$|\.jpg$|\.gif$|\.png$/i, $_)
| grep(/\/CVS\/|\/macbuild\//i,$File::Find::name))
{
$NUM_FILES++;
$ALL_FILES=$ALL_FILES."\"".getcwd."/".$_."\" ";
$NUM_NEW_FILES++;
if($NUM_NEW_FILES == 500)
{
ScanFiles($ALL_FILES);
$ALL_FILES = "";
$NUM_NEW_FILES = 0;
}
}
}
find(\&do_stats, $ROOT_DIR);
# Finish up any remainder files
if($NUM_NEW_FILES > 0)
{
ScanFiles($ALL_FILES);
}
print "\n";
$ELAPSED_TIME=time-$ELAPSED_TIME;
$NUM_LICENSED_FILES = $NUM_NPL_FILES + $NUM_MPL_FILES;
if($NUM_LICENSED_FILES > 0)
{
$PCT_NPL = ($NUM_NPL_FILES*100)/$NUM_LICENSED_FILES;
}
else
{
$PCT_NPL = "--";
}
if($NUM_MPL_FILES > 0)
{
$PCT_MPL_GPL = ($NUM_GPL_FILES*100)/$NUM_MPL_FILES;
}
else
{
$PCT_MPL_GPL = "--";
}
printf "\nLicensing Statistics (%d-%.2d-%.2d)\n", localtime->year+1900,
localtime->mon+1, localtime->mday;
print "Elapsed time: ", $ELAPSED_TIME, " seconds\n";
print "Total number of files: ", $NUM_FILES, "\n";
print "Total number of licensed files: ", $NUM_LICENSED_FILES, "\n";
print "Total number of NPLed files: ", $NUM_NPL_FILES, "\n";
print "Total number of MPLed files: ", $NUM_MPL_FILES, "\n";
print "Total number of GPLed files: ", $NUM_GPL_FILES, "\n";
print "Total number of LGPLed files: ", $NUM_LGPL_FILES, "\n";
print "Total number of BSD files: ", $NUM_BSD_FILES, "\n";
print "Total number of MIT files: ", $NUM_MIT_FILES, "\n";
print "\n";
printf("Percent licensed under the NPL: %2.0f%%\n", $PCT_NPL);
printf("Percent of MPL files also GPLed: %2.0f%%\n", $PCT_MPL_GPL);