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 | ||
0cf51544 JH |
13 | my $file = "META.yml"; |
14 | die "$0: will not override $file, delete it first.\n" if -e $file; | |
15 | ||
16 | use Maintainers qw(%Modules get_module_files get_module_pat); | |
17 | ||
18 | my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules; | |
19 | my @files = map { get_module_files($_) } @CPAN; | |
99115150 | 20 | my @dirs = ('cpan', grep { -d $_ && $_ !~ /^cpan/ } map { get_module_pat($_) } @CPAN); |
0cf51544 | 21 | |
3e9ed10a FD |
22 | my %dirs; |
23 | @dirs{@dirs} = (); | |
24 | ||
25 | my $files = join '', map { " - $_\n" } | |
26 | grep { | |
27 | my $d = $_; | |
28 | while(($d = dirname($d)) ne "."){ | |
29 | last if exists $dirs{$d}; | |
30 | } | |
31 | ||
32 | # if $d is "." it means we tried every parent dir of the file and none | |
33 | # of them were in the private list | |
34 | ||
35 | $d eq "."; | |
36 | } | |
37 | sort { lc $a cmp lc $b } @files; | |
38 | ||
0cf51544 JH |
39 | my $dirs = join '', map { " - $_\n" } sort { lc $a cmp lc $b } @dirs; |
40 | ||
41 | open my $fh, ">$file" or die "Can't open $file: $!"; | |
42 | ||
43 | print $fh <<"EOI"; | |
44 | name: perl | |
45 | version: $] | |
717f132d | 46 | abstract: Practical Extraction and Report Language |
0cf51544 JH |
47 | author: perl5-porters\@perl.org |
48 | license: perl | |
ec08ff80 NC |
49 | resources: |
50 | homepage: http://www.perl.org/ | |
51 | bugtracker: http://rt.perl.org/perlbug/ | |
52 | license: http://dev.perl.org/licenses/ | |
0cf51544 | 53 | distribution_type: core |
dbcf044e NC |
54 | generated_by: $0 |
55 | no_index: | |
0cf51544 JH |
56 | directory: |
57 | $dirs | |
58 | file: | |
59 | $files | |
60 | EOI | |
61 | ||
62 | close $fh; | |
63 |