| 1 | #!./perl -w |
| 2 | # this script must be run by the current perl to get perl's version right |
| 3 | # |
| 4 | # Create a META.yml file in the current directory. Must be run from the |
| 5 | # root directory of a perl source tree. |
| 6 | |
| 7 | use strict; |
| 8 | use warnings; |
| 9 | use lib "Porting"; |
| 10 | |
| 11 | use File::Basename qw( dirname ); |
| 12 | |
| 13 | |
| 14 | BEGIN { |
| 15 | # Get function prototypes |
| 16 | require 'regen/regen_lib.pl'; |
| 17 | } |
| 18 | |
| 19 | |
| 20 | my $file = "META.yml"; |
| 21 | |
| 22 | use Maintainers qw(%Modules get_module_files get_module_pat); |
| 23 | |
| 24 | my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules; |
| 25 | my @files = ('lib/unicore/mktables', 'TestInit.pm', |
| 26 | 'Porting/Maintainers.pm', 'Porting/perldelta_template.pod', |
| 27 | map { get_module_files($_) } @CPAN); |
| 28 | my @dirs = ('cpan', 'win32', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN); |
| 29 | |
| 30 | my %dirs; |
| 31 | @dirs{@dirs} = (); |
| 32 | |
| 33 | @files = map { " - $_" } |
| 34 | grep { |
| 35 | my $d = $_; |
| 36 | my $previous_d = ''; |
| 37 | while(($d = dirname($d)) ne "."){ |
| 38 | last if $d eq $previous_d; # safety valve |
| 39 | last if exists $dirs{$d}; |
| 40 | $previous_d = $d; |
| 41 | } |
| 42 | |
| 43 | # if $d is "." it means we tried every parent dir of the file and none |
| 44 | # of them were in the private list |
| 45 | |
| 46 | $d eq "." || $d eq $previous_d; |
| 47 | } |
| 48 | sort { lc $a cmp lc $b } @files; |
| 49 | |
| 50 | @dirs = map { " - $_" } sort { lc $a cmp lc $b } @dirs; |
| 51 | |
| 52 | my $fh = open_new($file); |
| 53 | |
| 54 | local $" = "\n"; |
| 55 | print $fh <<"EOI"; |
| 56 | name: perl |
| 57 | version: $] |
| 58 | abstract: The Perl 5 language interpreter |
| 59 | author: perl5-porters\@perl.org |
| 60 | license: perl |
| 61 | resources: |
| 62 | homepage: http://www.perl.org/ |
| 63 | bugtracker: http://rt.perl.org/perlbug/ |
| 64 | license: http://dev.perl.org/licenses/ |
| 65 | repository: http://perl5.git.perl.org/ |
| 66 | distribution_type: core |
| 67 | generated_by: $0 |
| 68 | no_index: |
| 69 | directory: |
| 70 | @dirs |
| 71 | file: |
| 72 | @files |
| 73 | EOI |
| 74 | |
| 75 | close_and_rename($fh); |