rev 13508 - people/modax/copyright-helper/trunk

Modestas Vainius modax-guest at alioth.debian.org
Sat Jan 24 20:55:00 UTC 2009


Author: modax-guest
Date: 2009-01-24 20:55:00 +0000 (Sat, 24 Jan 2009)
New Revision: 13508

Modified:
   people/modax/copyright-helper/trunk/CHCore.pm
   people/modax/copyright-helper/trunk/copyright-helper.pl
Log:
Some fixes. Always take files into account which were scanned but license was not recognized

Modified: people/modax/copyright-helper/trunk/CHCore.pm
===================================================================
--- people/modax/copyright-helper/trunk/CHCore.pm	2009-01-24 20:51:02 UTC (rev 13507)
+++ people/modax/copyright-helper/trunk/CHCore.pm	2009-01-24 20:55:00 UTC (rev 13508)
@@ -103,8 +103,10 @@
     my ($self, $field) = @_;
     my $myf = $self->{$field};
     my $parentf = ($self->getDirectory()) ? $self->getDirectory()->{$field} : 0;
+    my $is_array = ref($myf) eq 'ARRAY';
 
-    return (((ref $myf eq 'ARRAY') ? @$myf : $myf) && $parentf && $myf == $parentf);
+    my $ret = (($is_array && !@$myf) || (!$is_array && !$myf) || ($parentf && $myf == $parentf));
+    return $ret;
 }
 
 sub CHCore::File::isInheritedStr($$) {
@@ -216,7 +218,8 @@
         print $self->toStringLicense();
         print "\n";
     } else {
-        print "Copyright-And-License-N/A\n\n";
+        print "Copyright: unspecified\n";
+        print "License: unspecified\n\n";
     }
 }
 
@@ -964,6 +967,8 @@
             push @{$val->[1]}, $f;
             return $count;
         }
+    } else {
+        push @{$self->{unknown_licenses}}, $f;
     }
 
     return 0;
@@ -1034,10 +1039,11 @@
         my $lic_array = $values[0];
         $maxlic = $lic_array->[0];
         $maxfiles = $lic_array->[1];
-        my @files = grep { $_->isScanned() && $_->isInherited("license") } @$maxfiles;
+        my @files = grep { $_->isScanned() && $_->isInherited("license") }
+            ( @$maxfiles, @{$self->{unknown_licenses}} );
 
         $str .= $i_lvl1 . "License for all components is:\n";
-        $str .= $self->__toStringLicense($maxlic, \@files, $i_lvl2, $i_lvl3);
+        $str .= $self->__toStringLicense($maxlic, \@files, $i_lvl2, $i_lvl3, "implicit");
         return $str;
     } else {
         for my $lic_array (values(%{$self->{licenses}})) {
@@ -1050,12 +1056,14 @@
         }
 
         $str .= $i_lvl1 . "License for all components unless stated otherwise:\n";
-        my @files = grep { $_->isScanned() && $_->isInherited("license") } @$maxfiles;
+        my @files = grep { $_->isScanned() && $_->isInherited("license") }
+            ( @$maxfiles, @{$self->{unknown_licenses}} );
         $str .= $self->__toStringLicense($maxlic, \@files, $i_lvl2, $i_lvl3, "implicit");
         $str .= "\n";
 
         $str .= $i_lvl1 . "Other used licenses:\n";
-        for my $lic_array (values(%{$self->{licenses}})) {
+        for my $licid (sort keys %{$self->{licenses}}) {
+            my $lic_array = $self->{licenses}{$licid};
             my $lic = $lic_array->[0];
             my $files = $lic_array->[1];
             if (!$lic->equals($maxlic)) {

Modified: people/modax/copyright-helper/trunk/copyright-helper.pl
===================================================================
--- people/modax/copyright-helper/trunk/copyright-helper.pl	2009-01-24 20:51:02 UTC (rev 13507)
+++ people/modax/copyright-helper/trunk/copyright-helper.pl	2009-01-24 20:55:00 UTC (rev 13508)
@@ -221,7 +221,7 @@
 }
 
 # Entry point
-${main::VERSION}='0.4.8';
+${main::VERSION}='0.4.9';
 print_msg "\n";
 print_msg "Copyright Helper v${main::VERSION}\n";
 print_msg "Extracts copyright and license information from source code\n\n";




More information about the pkg-kde-commits mailing list