]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
tabify CHANGES/CHANGES.SE/EXCLUDED
authorMark Andrews <marka@isc.org>
Wed, 18 Sep 2013 00:35:34 +0000 (10:35 +1000)
committerMark Andrews <marka@isc.org>
Wed, 18 Sep 2013 00:36:28 +0000 (10:36 +1000)
(cherry picked from commit 1229ebb09be38dd7070d75ee4755b3399cb8296c)

util/update_copyrights

index 14faf3d79ce0bc0847dd3df98156405137eb7994..c07043915c8d5c2c44214d4211bec30182d570dd 100644 (file)
@@ -141,6 +141,38 @@ foreach $file (keys %file_types) {
                 next;
         }
 
+       if ($file eq "./CHANGES" || $file eq "./EXCLUDED" ||
+           $file eq "./CHANGES.SE")
+       {
+               open(SOURCE, "<$file") || die "can't open $file: $!";
+               my $body = "";
+               while (<SOURCE>) {
+               # Process leading white space.
+               # Remove 1-7 spaces followed by a tab into a single
+               # tab if at start of line or proceeded by tabs.
+               s/^(\t*) {1,7}\t/$1\t/ while (/^\t* {1,7}\t/);
+               s/^(\s{0,3}\d*\.)\s(\[\w{1,5}\])\s+(\S+)/\1\t\2\t\t\3/;
+               s/^(\s{0,3}\d*\.)\s(\[\w{6,}\])\s+(\S+)/\1\t\2\t\3/;
+               # Convert 8 spaces into tabs if at start of line
+               # or preceeded by tabs.
+               s/^(\t*)        /$1\t/ while (/^\t*        /);
+               # Remove trailing white space.
+               s/[ \t]*$//;
+                       $body = "$body$_";
+               }
+               $_ = $body;
+               open(TARGET, ">$file.new") || die "can't open $file.new: $!";
+               print TARGET $_;
+               close(TARGET);
+               close(SOURCE);
+               if (system("cmp -s $file.new $file") == 0) {
+                       unlink("$file.new");
+               } else {
+                       rename("$file.new", "$file")
+                         or die "rename($file.new, $file): $!";
+               }
+       }
+
         next if $type eq "X" or $type eq "BAT";
 
         $before_copyright = "";