Commit | Line | Data |
---|---|---|
3e9ed10a FD |
1 | #!./perl -w |
2 | # this script must be run by the current perl to get perl's version right | |
0c429c78 | 3 | # |
96db07ef | 4 | # Create a META.yml file in the current directory. Must be run from the |
0c429c78 | 5 | # root directory of a perl source tree. |
0cf51544 JH |
6 | |
7 | use strict; | |
8 | use warnings; | |
9 | use lib "Porting"; | |
10 | ||
3e9ed10a FD |
11 | use File::Basename qw( dirname ); |
12 | ||
df1ad5b3 JV |
13 | |
14 | BEGIN { | |
15 | # Get function prototypes | |
2bd4012d | 16 | require 'regen/regen_lib.pl'; |
df1ad5b3 JV |
17 | } |
18 | ||
19 | ||
0cf51544 | 20 | my $file = "META.yml"; |
0cf51544 JH |
21 | |
22 | use Maintainers qw(%Modules get_module_files get_module_pat); | |
23 | ||
24 | my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules; | |
25c32de1 NC |
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); | |
0cf51544 | 29 | |
3e9ed10a FD |
30 | my %dirs; |
31 | @dirs{@dirs} = (); | |
32 | ||
e34f6d89 | 33 | @files = map { " - $_" } |
3e9ed10a FD |
34 | grep { |
35 | my $d = $_; | |
2ccec147 | 36 | my $previous_d = ''; |
3e9ed10a | 37 | while(($d = dirname($d)) ne "."){ |
2ccec147 | 38 | last if $d eq $previous_d; # safety valve |
3e9ed10a | 39 | last if exists $dirs{$d}; |
2ccec147 | 40 | $previous_d = $d; |
3e9ed10a FD |
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 | ||
2ccec147 | 46 | $d eq "." || $d eq $previous_d; |
3e9ed10a FD |
47 | } |
48 | sort { lc $a cmp lc $b } @files; | |
49 | ||
e34f6d89 | 50 | @dirs = map { " - $_" } sort { lc $a cmp lc $b } @dirs; |
0cf51544 | 51 | |
29c22b52 | 52 | my $fh = open_new($file); |
0cf51544 | 53 | |
e34f6d89 | 54 | local $" = "\n"; |
0cf51544 JH |
55 | print $fh <<"EOI"; |
56 | name: perl | |
57 | version: $] | |
095a5c3e | 58 | abstract: The Perl 5 language interpreter |
0cf51544 JH |
59 | author: perl5-porters\@perl.org |
60 | license: perl | |
ec08ff80 NC |
61 | resources: |
62 | homepage: http://www.perl.org/ | |
63 | bugtracker: http://rt.perl.org/perlbug/ | |
64 | license: http://dev.perl.org/licenses/ | |
f3560023 | 65 | repository: http://perl5.git.perl.org/ |
0cf51544 | 66 | distribution_type: core |
dbcf044e NC |
67 | generated_by: $0 |
68 | no_index: | |
0cf51544 | 69 | directory: |
e34f6d89 | 70 | @dirs |
0cf51544 | 71 | file: |
e34f6d89 | 72 | @files |
0cf51544 JH |
73 | EOI |
74 | ||
284e4287 | 75 | close_and_rename($fh); |