summaryrefslogtreecommitdiff
path: root/Porting/makemeta
blob: 1dd644ca8ae0ecf82b9c9d288e944c1bc4448707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!./perl -w
# this script must be run by the current perl to get perl's version right
#
# Create a META.yml file in the current directory. Must be run from the
# root directory of a perl source tree.

use strict;
use warnings;
use lib "Porting";

use File::Basename qw( dirname );


BEGIN {
    # Get function prototypes
    require 'regen/regen_lib.pl';
}


my $file = "META.yml";

use Maintainers qw(%Modules get_module_files get_module_pat);

my @CPAN  = grep { $Modules{$_}{CPAN} } keys %Modules;
my @files = ('autodoc.pl', 'lib/unicore/mktables', 'TestInit.pm',
	     'Porting/Maintainers.pm', 'Porting/perldelta_template.pod',
	     map { get_module_files($_) } @CPAN);
my @dirs  = ('cpan', 'win32', 'mad', grep { -d $_ && $_  !~ /^cpan/ } map { get_module_pat($_) } @CPAN);

my %dirs;
@dirs{@dirs} = ();

@files = map { "    - $_" }
  grep {
    my $d = $_;
    my $previous_d = '';
    while(($d = dirname($d)) ne "."){
      last if $d eq $previous_d; # safety valve
      last if exists $dirs{$d};
      $previous_d = $d;
    }

    # if $d is "." it means we tried every parent dir of the file and none
    # of them were in the private list
    
    $d eq "." || $d eq $previous_d;
  }
  sort { lc $a cmp lc $b } @files;

@dirs  = map { "    - $_" } sort { lc $a cmp lc $b } @dirs;

my $fh = open_new($file);

local $" = "\n";
print $fh <<"EOI";
name: perl
version: $]
abstract: The Perl 5 language interpreter
author: perl5-porters\@perl.org
license: perl
resources:
  homepage: http://www.perl.org/
  bugtracker: http://rt.perl.org/perlbug/
  license: http://dev.perl.org/licenses/
  repository: http://perl5.git.perl.org/
distribution_type: core
generated_by: $0
no_index:
  directory:
@dirs
  file:
@files
EOI

close_and_rename($fh);