This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the META.yml regen code use regen_lib.pl per the request in release_mananger_guide,
authorJesse Vincent <jesse@bestpractical.com>
Sun, 4 Jul 2010 15:40:33 +0000 (11:40 -0400)
committerJesse Vincent <jesse@bestpractical.com>
Sun, 4 Jul 2010 20:43:40 +0000 (21:43 +0100)
Porting/makemeta
Porting/release_managers_guide.pod

index 532ee85..b138ea0 100644 (file)
@@ -10,8 +10,15 @@ use lib "Porting";
 
 use File::Basename qw( dirname );
 
+
+BEGIN {
+    # Get function prototypes
+    require 'regen_lib.pl';
+}
+
+
 my $file = "META.yml";
-die "$0: will not override $file, delete it first.\n" if -e $file;
+my $new_file = "META.yml-new";
 
 use Maintainers qw(%Modules get_module_files get_module_pat);
 
@@ -40,7 +47,7 @@ my $files = join '', map { "    - $_\n" }
 
 my $dirs  = join '', map { "    - $_\n" } sort { lc $a cmp lc $b } @dirs;
 
-open my $fh, ">$file" or die "Can't open $file: $!";
+my $fh = safer_open($new_file);
 
 print $fh <<"EOI";
 name: perl
@@ -62,5 +69,6 @@ $dirs
 $files
 EOI
 
-close $fh;
+safer_close($fh);
+rename_if_different($new_file, $file);
 
index e533228..c4a73b4 100644 (file)
@@ -436,10 +436,6 @@ Rebuild META.yml:
     $ make META.yml
     $ git diff
 
-XXX it would be nice to make Porting/makemeta use regen_lib.pl
-to get the same 'update the file if its changed' functionality
-we get with 'make regen' etc.
-
 Commit META.yml if it has changed:
 
     $ git commit -m 'Update META.yml' META.yml