Merge branch 'stable'
[gnulib.git] / debian / clscan / clscan
index 049cb09..1bffdb7 100755 (executable)
@@ -32,7 +32,7 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 EOL
 
-my $lgpl_boilerplate=<<"EOL";
+my $lgpl2_boilerplate=<<"EOL";
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU Library General Public License as published
 by the Free Software Foundation; either version 2, or (at your option)
@@ -49,6 +49,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 USA.
 EOL
 
+my $lgpl3_boilerplate=<<"EOL";
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
+EOL
+
 # license overrides as specified in modules/*
 our $module_licenses = {
     "public domain" => {
@@ -63,11 +78,15 @@ our $module_licenses = {
     },
     "LGPL" => {
        license => "LGPL",
-       license_text => $lgpl_boilerplate,
+       license_text => $lgpl3_boilerplate,
     },
     "LGPLv2+" => {
        license => "LGPL-2+",
-       license_text => $lgpl_boilerplate,
+       license_text => $lgpl2_boilerplate,
+    },
+    "LGPLv3+" => {
+       license => "LGPL-3+",
+       license_text => $lgpl3_boilerplate,
     },
     "unmodifiable license text" => {
        license => "other",
@@ -88,6 +107,7 @@ our @filenames=();
 our %overrides=();
 our $files={};
 our $new={};
+our @deleted_files=();
 
 # actions
 my $scan=0;
@@ -114,8 +134,8 @@ sub scan
     {
        scan_file($file);
     }
-    write_new();
     find_deleted();
+    write_new();
 }
 
 sub merge
@@ -462,7 +482,6 @@ sub write_new
     unless(keys(%$new))
     {
        warn("$me: no new/changed files found\n");
-       return;
     }
     unless(open(NEW,">$NEWFILES"))
     {
@@ -493,6 +512,10 @@ sub write_new
        print NEW join("\n", @headerlines);
        print NEW "\n\n";
     }
+    if(@deleted_files)
+    {
+       print NEW map { "Deleted: $_\n"; } @deleted_files;
+    }
     close NEW;
 }
 
@@ -554,6 +577,13 @@ sub merge_new
            $in_license_text=1;
            $license_text='';
        }
+       elsif(/^Deleted:\s*(.*)/)
+       {
+           if(exists($files->{$1}))
+           {
+               delete($files->{$1});
+           }
+       }
        else
        {
            warn("$me: $NEWFILES: line $line not recognized\n");
@@ -572,19 +602,18 @@ sub merge_new
 
 sub find_deleted
 {
-    my @deleted=();
     my %newnames = map { $_ => 1 } @filenames;
     for my $file (sort keys(%$files))
     {
        unless(exists($newnames{$file}))
        {
-           push(@deleted, $file);
+           push(@deleted_files, $file);
        }
     }
-    if(@deleted)
+    if(@deleted_files)
     {
        print "Removed files:\n";
-       print join("\n", @deleted),"\n";
+       print join("\n", @deleted_files),"\n";
     }
 }