This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove utf8_heavy.pl
[perl5.git] / Porting / makemeta
index 7771ecb..760377e 100644 (file)
@@ -6,14 +6,30 @@
 
 use strict;
 use warnings;
+use Getopt::Std;
+
+# avoid unnecessary churn in x_serialization_backend in META.*
+$ENV{PERL_JSON_BACKEND} = $ENV{CPAN_META_JSON_BACKEND} = 'JSON::PP';
+$ENV{PERL_YAML_BACKEND} = 'CPAN::Meta::YAML';
 
 my $opts = {
   'META.yml'  => { version => '1.4' },
   'META.json' => { version => '2' },
 };
 
-my $file = shift;
-die "Must specify META.yml or META.json" unless $file and defined $opts->{$file};
+my %switches;
+getopts('byj', \%switches);
+
+my @metafiles;
+if ( $switches{y} ) {
+  push @metafiles, 'META.yml';
+}
+elsif ( $switches{j} ) {
+  push @metafiles, 'META.json';
+}
+else {
+  push @metafiles, keys %$opts;
+}
 
 my ($vers, $stat ) = _determine_status();
 
@@ -31,14 +47,14 @@ my $distmeta = {
   'dynamic_config' => 1,
   'resources' => {
     'repository' => {
-      'url' => 'http://perl5.git.perl.org/'
+      'url' => 'https://github.com/Perl/perl5'
     },
-    'homepage' => 'http://www.perl.org/',
+    'homepage' => 'https://www.perl.org/',
     'bugtracker' => {
-      'web' => 'http://rt.perl.org/perlbug/'
+      'web' => 'https://github.com/Perl/perl5/issues'
     },
     'license' => [
-      'http://dev.perl.org/licenses/'
+      'https://dev.perl.org/licenses/'
     ],
   },
 };
@@ -49,7 +65,7 @@ use CPAN::Meta;
 
 BEGIN {
     # Get function prototypes
-    require 'regen/regen_lib.pl';
+    require './regen/regen_lib.pl';
 }
 
 use Maintainers qw(%Modules get_module_files get_module_pat);
@@ -58,7 +74,7 @@ my @CPAN  = grep { $Modules{$_}{CPAN} } keys %Modules;
 my @files = ('autodoc.pl', 'lib/unicore/mktables', 'TestInit.pm',
              'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
              map { get_module_files($_) } @CPAN);
-my @dirs  = ('cpan', 'win32', 'mad', grep { -d $_ && $_  !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
+my @dirs  = ('cpan', 'win32', 'lib/perl5db', grep { -d $_ && $_  !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
 
 my %dirs;
 @dirs{@dirs} = ();
@@ -86,9 +102,11 @@ $distmeta->{no_index}->{file} = \@files;
 $distmeta->{no_index}->{directory} = \@dirs;
 
 my $meta = CPAN::Meta->create( $distmeta );
-my $fh = open_new($file);
-print $fh $meta->as_string( $opts->{$file} );
-close_and_rename($fh);
+foreach my $file ( @metafiles ) {
+  my $fh = open_new($file);
+  print $fh $meta->as_string( $opts->{$file} );
+  close_and_rename($fh);
+}
 exit 0;
 
 sub _determine_status {