[Rt-commit] r11701 - rt/branches/3.7-RTIR-RELENG/sbin

ruz at bestpractical.com ruz at bestpractical.com
Fri Apr 11 17:29:58 EDT 2008


Author: ruz
Date: Fri Apr 11 17:29:58 2008
New Revision: 11701

Modified:
   rt/branches/3.7-RTIR-RELENG/sbin/license_tag

Log:
* sync tagger

Modified: rt/branches/3.7-RTIR-RELENG/sbin/license_tag
==============================================================================
--- rt/branches/3.7-RTIR-RELENG/sbin/license_tag	(original)
+++ rt/branches/3.7-RTIR-RELENG/sbin/license_tag	Fri Apr 11 17:29:58 2008
@@ -110,16 +110,16 @@
 
 sub tag_mason {
         my $pm = $_;
-        next unless (-f $pm);
-        next if ($pm =~ /images/);
+        return unless (-f $pm);
+        return if $pm =~ /images/ || $pm =~ /\.(?:png|jpe?g|gif)$/;
         open(FILE,"<$pm") || die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
+        print "$pm - ";
+        return if another_license($file) && print "has different license\n";
+
         my $pmlic = $LICENSE;
         $pmlic =~ s/^/%# /mg;
-
-
-        print "$pm - ";
         if ($file =~ /^%# BEGIN BPS TAGGED BLOCK {{{/ms) {
                 print "has license section";
              $file =~ s/^%# BEGIN BPS TAGGED BLOCK {{{(.*?)%# END BPS TAGGED BLOCK }}}/%# BEGIN BPS TAGGED BLOCK {{{\n$pmlic%# END BPS TAGGED BLOCK }}}/ms;
@@ -147,11 +147,11 @@
         open(FILE,"<$pm") || die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
+        print "$pm - ";
+        return if another_license($file) && print "has different license\n";
+
         my $pmlic = $LICENSE;
         $pmlic =~ s/^/# /mg;
-
-
-        print "$pm - ";
         if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
                 print "has license section";
              $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic# END BPS TAGGED BLOCK }}}/ms;
@@ -180,11 +180,11 @@
         open(FILE,"<$pm") || die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
+        print "$pm - ";
+        return if another_license($file) && print "has different license\n";
+
         my $pmlic = $LICENSE;
         $pmlic =~ s/^/# /mg;
-
-
-        print "$pm - ";
         if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
                 print "has license section";
              $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic# END BPS TAGGED BLOCK }}}/ms;
@@ -213,10 +213,11 @@
         open(FILE,"<$pm") || die "Failed to open $pm";
         my $file = (join "", <FILE>); 
         close (FILE);
+        print "$pm - ";
+        return if another_license($file) && print "has different license\n";
+
         my $pmlic = $LICENSE;
         $pmlic =~ s/^/# /msg;
-
-        print "$pm - ";
         if ($file =~ /^# BEGIN BPS TAGGED BLOCK {{{/ms) {
                 print "has license section";
              $file =~ s/^# BEGIN BPS TAGGED BLOCK {{{(.*?)# END BPS TAGGED BLOCK }}}/# BEGIN BPS TAGGED BLOCK {{{\n$pmlic# END BPS TAGGED BLOCK }}}/ms;
@@ -241,3 +242,11 @@
 
 }
 
+sub another_license {
+    my $file = shift;
+    return 0 if $file =~ /Copyright\s+\(c\)\s+\d\d\d\d-\d\d\d\d Best Practical Solutions/i;
+    return 1 if $file =~ /\bcopyright\b/i; # common
+    return 1 if $file =~ /\(c\)\s+\d\d\d\d(?:-\d\d\d\d)?/i; # prototype
+    return 0;
+}
+


More information about the Rt-commit mailing list