This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
teach sync-with-cpan how to update Maintainers.pl
authorJesse Luehrs <doy@tozt.net>
Mon, 18 Jun 2012 21:39:25 +0000 (16:39 -0500)
committerJesse Luehrs <doy@tozt.net>
Mon, 18 Jun 2012 22:10:26 +0000 (17:10 -0500)
Porting/sync-with-cpan

index e3bbc68..e6f59b1 100755 (executable)
@@ -430,10 +430,48 @@ print "\n";
 say "Failed tests: @failed" if @failed;
 
 
-print "Now you ought to run a make; make test ...\n";
+say "Attempting to update Maintainers.pl";
+chdir '..';
+
+open my $Maintainers_pl, '<', 'Porting/Maintainers.pl';
+open my $new_Maintainers_pl, '>', 'Maintainers.pl';
+
+my $found;
+my $in_mod_section;
+while (<$Maintainers_pl>) {
+    if (!$found) {
+        if ($in_mod_section) {
+            if (/DISTRIBUTION/) {
+                if (s/\Q$old_version/$version/) {
+                    $found = 1;
+                }
+            }
+
+            if (/^    }/) {
+                $in_mod_section = 0;
+            }
+        }
+
+        if (/\Q$cpan_mod/) {
+            $in_mod_section = 1;
+        }
+    }
+
+    print $new_Maintainers_pl $_;
+}
+
+if ($found) {
+    unlink 'Porting/Maintainers.pl';
+    rename 'Maintainers.pl' => 'Porting/Maintainers.pl';
+    system chmod => 'a+x', 'Porting/Maintainers.pl';
+}
+else {
+    say "Could not update Porting/Maintainers.pl.";
+    say "Make sure you update this by hand before committing.";
+}
 
-say "Do not forget to update Porting/Maintainers.pl before committing";
 say "$o_module is now version $new_version";
+say "Now you ought to run a make; make test ...";
 
 
 __END__