2 ################################################################################
4 # regenerate -- regenerate baseline and todo files
6 ################################################################################
10 # $Date: 2006/05/25 17:22:32 +0200 $
12 ################################################################################
14 # Version 3.x, Copyright (C) 2004-2006, 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';
35 GetOptions(\%opt, qw( verbose )) or die pod2usage();
39 unless (-e 'parts/embed.fnc' and -e 'parts/apidoc.fnc') {
40 print "\nOooops, $0 must be run from the Devel::PPPort root directory.\n";
44 ask_or_quit("Are you sure you have updated parts/embed.fnc and parts/apidoc.fnc?");
46 my %files = map { ($_ => [glob "parts/$_/5*"]) } qw( base todo );
49 for my $f (map @$_, values %files) {
50 push @{-w $f ? \@wr : \@notwr}, $f;
55 print "\nThe following files are not writable:\n\n";
56 print " $_\n" for @notwr;
57 print "\nAre you sure you have checked out these files?\n";
60 print "\nAll baseline / todo file are not writable.\n";
61 ask_or_quit("Do you want to try to check out these files?");
62 unless (runtool("wco", "-l", "-t", "locked by $0", @notwr)) {
63 print "\nSomething went wrong while checking out the files.\n";
69 for my $dir (qw( base todo )) {
70 my $cur = "parts/$dir";
73 ask_or_quit("Do you want me to remove the old $old directory?");
77 print "\nBacking up $cur in $old.\n";
78 for my $src (@{$files{$dir}}) {
80 $dst =~ s/\E$cur/$old/ or die "Ooops!";
81 move($src, $dst) or die "Moving $src to $dst failed: $!\n";
87 print "\nBuilding baseline files...\n\n";
89 unless (runperl('devel/mktodo', '--base', ddverbose())) {
90 print "\nSomething went wrong while building the baseline files.\n";
94 print "\nMoving baseline files...\n\n";
96 for my $src (glob 'parts/todo/5*') {
98 $dst =~ s/todo/base/ or die "Ooops!";
99 move($src, $dst) or die "Moving $src to $dst failed: $!\n";
102 print "\nBuilding todo files...\n\n";
104 unless (runperl('devel/mktodo', ddverbose())) {
105 print "\nSomething went wrong while building the baseline files.\n";
109 print "\nAdding remaining baseline info...\n\n";
111 unless (runperl('Makefile.PL') and
113 runperl('devel/scanprov', 'write')) {
114 print "\nSomething went wrong while adding the baseline info.\n";
118 my($wall, $usr, $sys, $cusr, $csys) = (time - $T0, times);
119 my $cpu = sprintf "%.2f", $usr + $sys + $cusr + $csys;
120 $usr = sprintf "%.2f", $usr + $cusr;
121 $sys = sprintf "%.2f", $sys + $csys;
125 API info regenerated successfully.
127 Finished in $wall wallclock secs ($usr usr + $sys sys = $cpu CPU)
129 Don't forget to check in the files in parts/base and parts/todo.