2 # this script must be run by the current perl to get perl's version right
4 # Create META.yml and META.json files in the current directory. Must be run from the
5 # root directory of a perl source tree.
11 'META.yml' => { version => '1.4' },
12 'META.json' => { version => '2' },
16 die "Must specify META.yml or META.json" unless $file and defined $opts->{$file};
18 my $status = _determine_status();
24 'perl5-porters@perl.org'
29 'abstract' => 'The Perl 5 language interpreter',
30 'release_status' => $status,
31 'dynamic_config' => 1,
34 'url' => 'http://perl5.git.perl.org/'
36 'homepage' => 'http://www.perl.org/',
38 'web' => 'http://rt.perl.org/perlbug/'
41 'http://dev.perl.org/licenses/'
47 use File::Basename qw( dirname );
51 # Get function prototypes
52 require 'regen/regen_lib.pl';
55 use Maintainers qw(%Modules get_module_files get_module_pat);
57 my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules;
58 my @files = ('autodoc.pl', 'lib/unicore/mktables', 'TestInit.pm',
59 'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
60 map { get_module_files($_) } @CPAN);
61 my @dirs = ('cpan', 'win32', 'mad', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
70 while(($d = dirname($d)) ne "."){
71 last if $d eq $previous_d; # safety valve
72 last if exists $dirs{$d};
76 # if $d is "." it means we tried every parent dir of the file and none
77 # of them were in the private list
79 $d eq "." || $d eq $previous_d;
81 sort { lc $a cmp lc $b } @files;
83 @dirs = sort { lc $a cmp lc $b } @dirs;
85 $distmeta->{no_index}->{file} = \@files;
86 $distmeta->{no_index}->{directory} = \@dirs;
88 my $meta = CPAN::Meta->create( $distmeta );
89 my $fh = open_new($file);
90 print $fh $meta->as_string( $opts->{$file} );
91 close_and_rename($fh);
94 sub _determine_status {
95 my $patchlevel_h = 'patchlevel.h';
96 return unless -e $patchlevel_h;
100 open my $fh, '<', $patchlevel_h;
104 next unless m!^#define! or m!!;
106 my ($foo,$bar) = ( split /\s+/ )[1,2];
107 $defines{$foo} = $bar;
109 elsif ( m!\"RC\d+\"! ) {
115 $status = $defines{PERL_VERSION} % 2 ? 'unstable' : 'stable';