X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/ec08ff806cb70a184db7ff25b978632f878170bc..4a904372e4d28940f0bcc3b8501925d58b3f0e68:/Porting/makemeta diff --git a/Porting/makemeta b/Porting/makemeta index d12c7f6..af39ecc 100644 --- a/Porting/makemeta +++ b/Porting/makemeta @@ -1,5 +1,8 @@ #!./perl -w # this script must be run by the current perl to get perl's version right +# +# Create a META.yml file in the current directory. Must be run from the +# root directory of a perl source tree. use strict; use warnings; @@ -7,53 +10,66 @@ use lib "Porting"; use File::Basename qw( dirname ); + +BEGIN { + # Get function prototypes + require 'regen/regen_lib.pl'; +} + + my $file = "META.yml"; -die "$0: will not override $file, delete it first.\n" if -e $file; use Maintainers qw(%Modules get_module_files get_module_pat); my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules; -my @files = map { get_module_files($_) } @CPAN; -my @dirs = grep { -d $_ } map { get_module_pat($_) } @CPAN; +my @files = ('lib/unicore/mktables', 'TestInit.pm', + 'Porting/Maintainers.pm', 'Porting/perldelta_template.pod', + map { get_module_files($_) } @CPAN); +my @dirs = ('cpan', 'win32', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN); my %dirs; @dirs{@dirs} = (); -my $files = join '', map { " - $_\n" } +@files = map { " - $_" } grep { my $d = $_; + my $previous_d = ''; while(($d = dirname($d)) ne "."){ + last if $d eq $previous_d; # safety valve last if exists $dirs{$d}; + $previous_d = $d; } # if $d is "." it means we tried every parent dir of the file and none # of them were in the private list - $d eq "."; + $d eq "." || $d eq $previous_d; } sort { lc $a cmp lc $b } @files; -my $dirs = join '', map { " - $_\n" } sort { lc $a cmp lc $b } @dirs; +@dirs = map { " - $_" } sort { lc $a cmp lc $b } @dirs; -open my $fh, ">$file" or die "Can't open $file: $!"; +my $fh = open_new($file); +local $" = "\n"; print $fh <<"EOI"; name: perl version: $] -abstract: Practical Extraction and Report Language +abstract: The Perl 5 language interpreter author: perl5-porters\@perl.org license: perl resources: homepage: http://www.perl.org/ bugtracker: http://rt.perl.org/perlbug/ license: http://dev.perl.org/licenses/ + repository: http://perl5.git.perl.org/ distribution_type: core -private: +generated_by: $0 +no_index: directory: -$dirs +@dirs file: -$files +@files EOI -close $fh; - +close_and_rename($fh);