diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bd9e6617827818fd043452c08c606f07b78014a0 (patch) | |
tree | 425bb4c3168f9c02f10150f235d2cb998dcc6108 /scripts/check_licenses | |
download | tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.tar.gz tdesdk-bd9e6617827818fd043452c08c606f07b78014a0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'scripts/check_licenses')
-rwxr-xr-x | scripts/check_licenses | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/scripts/check_licenses b/scripts/check_licenses new file mode 100755 index 00000000..6accd259 --- /dev/null +++ b/scripts/check_licenses @@ -0,0 +1,88 @@ +#!/usr/bin/perl -w + +unless (scalar(@ARGV) == 1) +{ + die "Usage: check_licenses directory"; +} + +my $gpl = 'General Public License'; +my $gp2 = 'This is free software; it comes under the GNU'; +my $gp3 = 'License: GPL with the following explicit clarification'; +my $x11 = 'TORT OR OTHERWISE'; +my $bsd = 'INCLUDING NEGLIGENCE OR OTHERWISE'; +my $gen = 'generated'; + +sub nameok() +{ + my $f = shift; + + if ($f =~ /\.C$/ or $f =~ /\.cpp$/ or $f =~ /\.c$/ or $f =~ /\.h$/) + { + if ($f =~ /\.cpp$/) + { + if + ( + $f !~ /meta_unload\.cpp$/ + and $f !~ /_stub\.cpp/ + and $f !~ /_skel.cpp/ + and $f !~ /_closure\.cpp/ + and $f !~ /moc\.cpp/ + ) + { + return 1; + } + else + { + return 0; + } + } + else + { + return 1; + } + } + else + { + return 0; + } +} + +sub recursive_check() +{ + my $dir = shift; + + opendir (DIR, $dir) or die "Can't open $dir"; + + my @filenames = grep { /^[^\.]/ } readdir(DIR); + + for my $f (@filenames) + { + my $filename = "$dir/$f"; + + if (-d $filename) + { + &recursive_check($filename); + } + elsif (-f $filename and &nameok($filename)) + { + open (IN, "<$filename") or die "Can't open $filename"; + + my $license = "!"; + + while (<IN>) + { + if (/$gpl/) { $license = "G"; last; } + if (/$gp2/) { $license = "G"; last; } + if (/$gp3/) { $license = "G"; last; } + if (/$x11/) { $license = "X"; last; } + if (/$bsd/) { $license = "B"; last; } + if (/$gen/) { $license = "g"; last; } + } + + print "$license $filename\n"; + } + } +} + +&recursive_check($ARGV[0]); + |