This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devel/mktodo: Add some comments
[perl5.git] / dist / Devel-PPPort / devel / mktodo
CommitLineData
adfe19db
MHM
1#!/usr/bin/perl -w
2################################################################################
3#
4# mktodo -- generate baseline and todo files by running mktodo.pl
5#
b53c2d56
KW
6# It calls plain 'mktodo' on each perl version it finds based on the input
7# parameters.
8#
adfe19db
MHM
9################################################################################
10#
b2049988 11# Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
adfe19db
MHM
12# Version 2.x, Copyright (C) 2001, Paul Marquess.
13# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
14#
15# This program is free software; you can redistribute it and/or
16# modify it under the same terms as Perl itself.
17#
18################################################################################
19
20use strict;
21use Getopt::Long;
22
3d7c117d 23require './devel/devtools.pl';
0c96388f
MHM
24
25our %opt = (
b53c2d56
KW
26 base => 0, # If specified, this will generate base files, not todo ones
27 check => 1, # Do extra checking
0c96388f 28 verbose => 0,
49ef49fe 29 install => '/tmp/perl/install/default',
b2049988 30 blead => 'bleadperl-debug',
adfe19db
MHM
31);
32
b53c2d56
KW
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. It also uses
36# blead, again with an overridable default.
37#
38# It first verifies that the test file works properly for blead.
39#
40# Then it goes through the list of perl binaries sorted in decreasing order of
41# version number. If something works in version n, but not in version n-1,
42# that means it was introduced (or perhaps fixed) in version n, and adds that
43# thing to the version n list.
44#
45# After everything is done, we have lists of what got added when. The --base
46# parameter tells it to not use ppport.h when computing this. Thus we get
47# what the official perls added when. Without this parameter, we do use
48# ppport.h, so we get, as patched by ppport.h, what gets added when
49
49ef49fe 50GetOptions(\%opt, qw( base check! verbose install=s blead=s blead-version=s )) or die;
adfe19db 51
0c96388f
MHM
52identify();
53
adfe19db
MHM
54my $outdir = 'parts/todo';
55
adfe19db
MHM
56my @perls = sort { $b->{version} <=> $a->{version} }
57 map { { version => `$_ -e 'printf "%.6f", \$]'`, path => $_ } }
60474171 58 ($opt{blead}, grep !/-RC\d+/, glob "$opt{install}/bin/perl5.*");
49ef49fe
CBW
59
60if (exists $opt{'blead-version'}) {
61 $perls[0]{version} = $opt{'blead-version'};
62}
adfe19db 63
ac18778d
KW
64# blead's todo is its version plus 1. Otherwise, each todo is the previous
65# one's version
66$perls[0]{todo} = $perls[0]{version} + 1;
adfe19db
MHM
67for (1 .. $#perls) {
68 $perls[$_]{todo} = $perls[$_-1]{version};
69}
70
adfe19db
MHM
71for (@perls) {
72 my $todo = do { my $v = $_->{todo}; $v =~ s/\D+//g; $v };
73 -e "$outdir/$todo" and next;
ac18778d
KW
74 my @args = ('--perl', $_->{path}, '--version', "$_->{todo}");
75
76 push @args, '--blead' if $_ == $perls[0]; # First one is blead
77 push @args, '--todo', $_->{'todo'};
adfe19db 78 push @args, '--base' if $opt{base};
0c96388f 79 push @args, '--verbose' if $opt{verbose};
ba120f6f 80 push @args, '--nocheck' unless $opt{check};
0c96388f 81 runperl('devel/mktodo.pl', @args) or die "error running mktodo.pl [$!] [$?]\n";
adfe19db 82}