2 ################################################################################
4 # mktodo -- generate baseline and todo files by running mktodo.pl
6 # It calls plain 'mktodo' on each perl version it finds based on the input
9 ################################################################################
11 # Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
12 # Version 2.x, Copyright (C) 2001, Paul Marquess.
13 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
15 # This program is free software; you can redistribute it and/or
16 # modify it under the same terms as Perl itself.
18 ################################################################################
23 require './devel/devtools.pl';
26 base => 0, # If specified, this will generate base files, not todo ones
27 check => 1, # Do extra checking
29 install => '/tmp/perl/install/default',
30 blead => 'bleadperl-debug',
33 # The way this works, is it expects to find perl binaries for a bunch of
34 # different versions in a given directory. This defaults to the 'install' one
35 # listed above, but is overriddable by the --install parameter. Comma
36 # separating --install allows multiple source directories.
37 # It also uses blead, again with an overridable default.
39 # It first verifies that the test file works properly for blead.
41 # Then it goes through the list of perl binaries sorted in decreasing order of
42 # version number. If something works in version n, but not in version n-1,
43 # that means it was introduced (or perhaps fixed) in version n, and adds that
44 # thing to the version n list.
46 # After everything is done, we have lists of what got added when. The --base
47 # parameter tells it to not use ppport.h when computing this. Thus we get
48 # what the official perls added when. Without this parameter, we do use
49 # ppport.h, so we get, as patched by ppport.h, what gets added when
51 GetOptions(\%opt, qw( base check! verbose install=s blead=s blead-version=s )) or die;
55 my $outdir = 'parts/todo';
58 # Get blead and all other perls
59 my @perls = $opt{blead};
60 for my $dir (split ",", $opt{install}) {
61 push @perls, grep !/-RC\d+/, glob "$dir/bin/perl5.*";
64 # Sort in descending version order. Each element is a hash describing a perl,
65 # with keys 'version' and 'path'
66 @perls = sort { $b->{version} <=> $a->{version} }
68 # Call the perl to get it to print out it's $]
70 map { { version => `$_ -e 'printf "%.6f", \$]'`,
75 # Override blead's version if specified.
76 if (exists $opt{'blead-version'}) {
77 $perls[0]{version} = $opt{'blead-version'};
82 # blead's todo is its version plus 1. Otherwise, each todo is the previous
83 # one's version. Also get rid of duplicate versions.
84 $perls[0]{todo} = $perls[0]{version} + 1;
85 $seen{$perls[0]{version}} = 1;
86 for my $i (1 .. $#perls) {
87 last unless defined $perls[$i];
88 if ( exists $seen{$perls[$i]{version}}
93 $seen{$perls[$i]{version}} = 1;
94 $perls[$i]{todo} = $perls[$i-1]{version};
97 # Go through all the perls, creating a todo file for it.
99 my $todo = do { my $v = $_->{todo}; $v =~ s/\D+//g; $v };
100 my @args = ('--perl', $_->{path}, '--version', "$_->{todo}");
102 push @args, '--blead' if $_ == $perls[0]; # First one is blead
103 push @args, '--todo', $_->{'todo'};
104 push @args, '--base' if $opt{base};
105 push @args, '--verbose' if $opt{verbose};
106 push @args, '--nocheck' unless $opt{check};
107 runperl('devel/mktodo.pl', @args) or die "error running mktodo.pl [$!] [$?]\n";