2 ################################################################################
4 # regenerate -- regenerate baseline and todo files
6 ################################################################################
10 # $Date: 2009/01/18 14:10:50 +0100 $
12 ################################################################################
14 # Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
15 # Version 2.x, Copyright (C) 2001, Paul Marquess.
16 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
18 # This program is free software; you can redistribute it and/or
19 # modify it under the same terms as Perl itself.
21 ################################################################################
29 require 'devel/devtools.pl';
36 GetOptions(\%opt, qw( check! verbose )) or die pod2usage();
40 unless (-e 'parts/embed.fnc' and -e 'parts/apidoc.fnc') {
41 print "\nOooops, $0 must be run from the Devel::PPPort root directory.\n";
45 ask_or_quit("Are you sure you have updated parts/embed.fnc and parts/apidoc.fnc?");
47 my %files = map { ($_ => [glob "parts/$_/5*"]) } qw( base todo );
50 for my $f (map @$_, values %files) {
51 push @{-w $f ? \@wr : \@notwr}, $f;
56 print "\nThe following files are not writable:\n\n";
57 print " $_\n" for @notwr;
58 print "\nAre you sure you have checked out these files?\n";
61 print "\nAll baseline / todo file are not writable.\n";
62 ask_or_quit("Do you want to try to check out these files?");
63 unless (runtool("wco", "-l", "-t", "locked by $0", @notwr)) {
64 print "\nSomething went wrong while checking out the files.\n";
70 for my $dir (qw( base todo )) {
71 my $cur = "parts/$dir";
74 ask_or_quit("Do you want me to remove the old $old directory?");
78 print "\nBacking up $cur in $old.\n";
79 for my $src (@{$files{$dir}}) {
81 $dst =~ s/\E$cur/$old/ or die "Ooops!";
82 move($src, $dst) or die "Moving $src to $dst failed: $!\n";
87 my @args = ddverbose();
88 push @args, '--nocheck' unless $opt{check};
90 print "\nBuilding baseline files...\n\n";
92 unless (runperl('devel/mktodo', '--base', @args)) {
93 print "\nSomething went wrong while building the baseline files.\n";
97 print "\nMoving baseline files...\n\n";
99 for my $src (glob 'parts/todo/5*') {
101 $dst =~ s/todo/base/ or die "Ooops!";
102 move($src, $dst) or die "Moving $src to $dst failed: $!\n";
105 print "\nBuilding todo files...\n\n";
107 unless (runperl('devel/mktodo', @args)) {
108 print "\nSomething went wrong while building the baseline files.\n";
112 print "\nAdding remaining baseline info...\n\n";
114 unless (runperl('Makefile.PL') and
116 runperl('devel/scanprov', 'write')) {
117 print "\nSomething went wrong while adding the baseline info.\n";
121 my($wall, $usr, $sys, $cusr, $csys) = (time - $T0, times);
122 my $cpu = sprintf "%.2f", $usr + $sys + $cusr + $csys;
123 $usr = sprintf "%.2f", $usr + $cusr;
124 $sys = sprintf "%.2f", $sys + $csys;
128 API info regenerated successfully.
130 Finished in $wall wallclock secs ($usr usr + $sys sys = $cpu CPU)
132 Don't forget to check in the files in parts/base and parts/todo.
140 regenerate - Automatically regeneate Devel::PPPort's API information
146 --nocheck don't recheck symbols that caused an error
147 --verbose show verbose output
151 Copyright (c) 2006-2009, Marcus Holland-Moritz.
153 This program is free software; you can redistribute it and/or
154 modify it under the same terms as Perl itself.
158 See L<Devel::PPPort> and L<HACKERS>.