xref: /openbsd/gnu/usr.bin/perl/Porting/makemeta (revision 898184e3)
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
7use strict;
8use warnings;
9use lib "Porting";
10
11use File::Basename qw( dirname );
12
13
14BEGIN {
15    # Get function prototypes
16    require 'regen/regen_lib.pl';
17}
18
19
20my $file = "META.yml";
21
22use Maintainers qw(%Modules get_module_files get_module_pat);
23
24my @CPAN  = grep { $Modules{$_}{CPAN} } keys %Modules;
25my @files = ('autodoc.pl', 'lib/unicore/mktables', 'TestInit.pm',
26	     'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
27	     map { get_module_files($_) } @CPAN);
28my @dirs  = ('cpan', 'win32', grep { -d $_ && $_  !~ /^cpan/ } map { get_module_pat($_) } @CPAN);
29
30my %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
52my $fh = open_new($file);
53
54local $" = "\n";
55print $fh <<"EOI";
56name: perl
57version: $]
58abstract: The Perl 5 language interpreter
59author: perl5-porters\@perl.org
60license: perl
61resources:
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/
66distribution_type: core
67generated_by: $0
68no_index:
69  directory:
70@dirs
71  file:
72@files
73EOI
74
75close_and_rename($fh);
76