clscan merge tweaks
[gnulib.git] / debian / clscan / clscan
index 37cbe36..bd93ae0 100755 (executable)
@@ -78,7 +78,7 @@ sub write_copyright
        push(@{$licenses->{$license}->{$license_text}->{$copyright}}, $file);
     }
     my %refs=();
-    my $refnum=0;
+    my $refnum="00";
     for my $license (sort keys(%$licenses))
     {
        for my $license_text (sort keys(%{$licenses->{$license}}))
@@ -87,7 +87,7 @@ sub write_copyright
            if(length($license_text))
            {
                $refnum++;
-               $licensestr .= " (REF$refnum)";
+               $licensestr .= " [REF$refnum]";
                $refs{$licensestr}=$license_text;
            }
            for my $copyright (sort keys(%{$licenses->{$license}->{$license_text}}))
@@ -101,7 +101,7 @@ sub write_copyright
            }
        }
     }
-    for my $ref (keys(%refs))
+    for my $ref (sort keys(%refs))
     {
        print COPYRIGHT "License: $ref\n";
        my @text=split(/\n/, $refs{$ref});
@@ -239,7 +239,7 @@ sub filechanged
 
 sub wanted
 {
-    if(/^\.git/ || /^\.cvs/ || /^debian/)
+    if(/^\.git/ || /^\.cvs/ || /^debian/ || /^modules$/)
     {
        $File::Find::prune=1;
     }
@@ -298,9 +298,9 @@ sub write_new
     {
        print NEW "File: $file\n";
        print NEW "Hash: ", $new->{$file}->{hash}, "\n";
-       print NEW "License: ", $new->{$file}->{license}, "\n";
        print NEW "Copyright: ", $new->{$file}->{copyright}, "\n";
-       print NEW "Licence-Text: \n";
+       print NEW "License: ", $new->{$file}->{license}, "\n";
+       print NEW "License_Text: \n";
        if($new->{$file}->{license_old})
        {
            print NEW "#License_old: ", $new->{$file}->{license_old}, "\n";
@@ -339,11 +339,14 @@ sub merge_new
     {
        $line++;
        chomp;
-       next if(/^\s*$/);
        next if(/^\s*\#/);
        if($in_license_text && /^\s+(.*)/)
        {
-           $license_text .= "\n" . $1;
+           $license_text .= $1 . "\n";
+       }
+       elsif(/^\s*$/)
+       {
+           next;
        }
        elsif(/^File:\s*(.*)/)
        {
@@ -361,6 +364,7 @@ sub merge_new
            $copyright='';
            $hash='';
            $license_text='';
+           $in_license_text = 0;
        }
        elsif(/^Hash:\s*(.*)/)
        {
@@ -373,19 +377,12 @@ sub merge_new
        elsif(/^License:\s*(.*)/)
        {
            $license=$1;
-       }
-       elsif(/^License_text:\s*(.*)/)
-       {
            $in_license_text=1;
-           $license_text=$1;
-       }
-       elsif($in_license_text && /^\s+(.*)/)
-       {
-           $license_text .= "\n" . $1;
+           $license_text='';
        }
        else
        {
-           warn("$me: $file: line $line not recognized: $_\n");
+           warn("$me: $NEWFILES: line $line not recognized\n");
        }
     }
     close(NEW);