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