A slightly better layout for the diagram.
[p5sagit/p5-mst-13.2.git] / Porting / makemeta
CommitLineData
3e9ed10a 1#!./perl -w
2# this script must be run by the current perl to get perl's version right
0cf51544 3
4use strict;
5use warnings;
6use lib "Porting";
7
3e9ed10a 8use File::Basename qw( dirname );
9
0cf51544 10my $file = "META.yml";
11die "$0: will not override $file, delete it first.\n" if -e $file;
12
13use Maintainers qw(%Modules get_module_files get_module_pat);
14
15my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules;
16my @files = map { get_module_files($_) } @CPAN;
17my @dirs = grep { -d $_ } map { get_module_pat($_) } @CPAN;
18
3e9ed10a 19my %dirs;
20@dirs{@dirs} = ();
21
22my $files = join '', map { " - $_\n" }
23 grep {
24 my $d = $_;
25 while(($d = dirname($d)) ne "."){
26 last if exists $dirs{$d};
27 }
28
29 # if $d is "." it means we tried every parent dir of the file and none
30 # of them were in the private list
31
32 $d eq ".";
33 }
34 sort { lc $a cmp lc $b } @files;
35
0cf51544 36my $dirs = join '', map { " - $_\n" } sort { lc $a cmp lc $b } @dirs;
37
38open my $fh, ">$file" or die "Can't open $file: $!";
39
40print $fh <<"EOI";
41name: perl
42version: $]
43abstract: Practical Extraction and Reporting Language
44author: perl5-porters\@perl.org
45license: perl
46distribution_type: core
47private:
48 directory:
49$dirs
50 file:
51$files
52EOI
53
54close $fh;
55