Author: jkeenan
Date: Sat Aug 9 19:06:39 2008
New Revision: 30153
Removed:
branches/stepdescription/t/configure/008-verbose_step_number.t
branches/stepdescription/t/configure/009-verbose_step_regex.t
branches/stepdescription/t/configure/010-verbose_step_num_uncalled.t
Modified:
branches/stepdescription/MANIFEST
branches/stepdescription/config/gen/parrot_include.pm
branches/stepdescription/lib/Parrot/Configure.pm
branches/stepdescription/lib/Parrot/Configure/Options/Conf.pm
branches/stepdescription/t/configure/007-verbose_two.t
Log:
Remove superseded descriptions of fatal-step and verbose-step options from
Configure.pl's --help message (P::C::Options::Conf). Remove t/configure files
testing superseded options. Rework lib/Parrot/Configure.pm to improve
readability of verbose-step and verbose output. Allow for multiple steps to
be designated as verbose steps by passing comma-delimited string to
--verbose-step (_handle_verbose_step_option()).
Modified: branches/stepdescription/MANIFEST
==============================================================================
--- branches/stepdescription/MANIFEST (original)
+++ branches/stepdescription/MANIFEST Sat Aug 9 19:06:39 2008
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 9 17:26:00 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Aug 10 02:04:26 2008 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -3278,9 +3278,6 @@
t/configure/005-run_one_step.t []
t/configure/006-bad_step.t []
t/configure/007-verbose_two.t []
-t/configure/008-verbose_step_number.t []
-t/configure/009-verbose_step_regex.t []
-t/configure/010-verbose_step_num_uncalled.t []
t/configure/011-no_description.t []
t/configure/012-verbose.t []
t/configure/013-die.t []
Modified: branches/stepdescription/config/gen/parrot_include.pm
==============================================================================
--- branches/stepdescription/config/gen/parrot_include.pm (original)
+++ branches/stepdescription/config/gen/parrot_include.pm Sat Aug 9
19:06:39 2008
@@ -181,6 +181,7 @@
sub runstep {
my ( $self, $conf ) = @_;
+ my $verbose = $conf->options->get('verbose');
# need vtable.h now
system( $^X, "tools/build/vtable_h.pl" );
@@ -193,7 +194,7 @@
for my $d (@directives) {
my @defs = perform_directive $d;
for my $target ( @{ $d->{files} } ) {
- $conf->options->get('verbose') and print "$target ";
+ $verbose and print "$target ";
my $gen = join "\n",
( $target =~ /\.pl$/ ? \&const_to_perl : \&const_to_parrot
)->(@defs);
$conf->append_configure_log(qq{$self->{destdir}/$target});
Modified: branches/stepdescription/lib/Parrot/Configure.pm
==============================================================================
--- branches/stepdescription/lib/Parrot/Configure.pm (original)
+++ branches/stepdescription/lib/Parrot/Configure.pm Sat Aug 9 19:06:39 2008
@@ -221,10 +221,10 @@
my $conf = shift;
my $n = 0; # step number
- my ( $silent, $verbose, $verbose_step, $fatal, $fatal_step, $ask );
+ my ( $silent, $verbose, $verbose_step_str, $fatal, $fatal_step_str, $ask );
$silent = $conf->options->get(qw( silent ));
unless ($silent) {
- ( $verbose, $verbose_step, $fatal, $fatal_step, $ask ) =
+ ( $verbose, $verbose_step_str, $fatal, $fatal_step_str, $ask ) =
$conf->options->get(qw( verbose verbose-step fatal fatal-step ask
));
}
@@ -238,29 +238,37 @@
# We make certain that argument to --fatal-step is a comma-delimited
# string of configuration steps, each of which is a string delimited by
# two colons, the first half of which is one of init|inter|auto|gen
- # (This will be modified to take a step sequence number.)
- elsif ( defined ( $fatal_step ) ) {
- %steps_to_die_for = $conf->_handle_fatal_step_option( $fatal_step );
+ elsif ( defined ( $fatal_step_str ) ) {
+ %steps_to_die_for = _handle_fatal_step_option( $fatal_step_str );
}
else {
# No action needed; this is the default case where no step is fatal
}
+ my %verbose_steps;
+ if (defined $verbose_step_str) {
+ %verbose_steps = _handle_verbose_step_option( $verbose_step_str );
+ }
foreach my $task ( $conf->steps ) {
- my $red_flag;
+ my ($red_flag, $this_step_is_verbose);
my $step_name = $task->step;
- if ( scalar ( keys ( %steps_to_die_for ) ) ) {
+ if ( scalar keys %steps_to_die_for ) {
if ( $steps_to_die_for{$step_name} ) {
$red_flag++;
}
}
+ if ( scalar keys %verbose_steps ) {
+ if ( $verbose_steps{$step_name} ) {
+ $this_step_is_verbose = $step_name;
+ }
+ }
$n++;
my $rv = $conf->_run_this_step(
{
task => $task,
verbose => $verbose,
- verbose_step => $verbose_step,
+ verbose_step => $this_step_is_verbose || q{},
ask => $ask,
n => $n,
silent => $silent,
@@ -281,26 +289,45 @@
}
sub _handle_fatal_step_option {
- my $conf = shift;
- my $fatal_step = shift;
+ my $fatal_step_str = shift;
my %steps_to_die_for = ();
my $named_step_pattern = qr/(?:init|inter|auto|gen)::\w+/;
- if ( $fatal_step =~ /^
+ if ( $fatal_step_str =~ /^
$named_step_pattern
(, $named_step_pattern)*
$/x
) {
- my @fatal_steps = split /,/, $fatal_step;
+ my @fatal_steps = split /,/, $fatal_step_str;
for my $s (@fatal_steps) {
$steps_to_die_for{$s}++;
}
}
else {
- die "Argument to 'fatal-step' option must be comma-delimited string of
valid configuration steps or configuration step sequence numbers";
+ die "Argument to 'fatal-step' option must be comma-delimited string of
valid configuration steps";
}
return %steps_to_die_for;
}
+sub _handle_verbose_step_option {
+ my $verbose_step_str = shift;
+ my %verbose_steps = ();
+ my $named_step_pattern = qr/(?:init|inter|auto|gen)::\w+/;
+ if ( $verbose_step_str =~ /^
+ $named_step_pattern
+ (, $named_step_pattern)*
+ $/x
+ ) {
+ my @verbose_steps = split /,/, $verbose_step_str;
+ for my $s (@verbose_steps) {
+ $verbose_steps{$s}++;
+ }
+ }
+ else {
+ die "Argument to 'verbose-step' option must be comma-delimited string
of valid configuration steps";
+ }
+ return %verbose_steps;
+}
+
=item * C<run_single_step()>
The invoking Parrot::Configure object is passed as the first argument to
@@ -310,6 +337,9 @@
Accepts no arguments and modifies the data structure within the
Parrot::Configure object.
+B<Note:> Currently used only in F<tools/dev/reconfigure.pl>; not used in
+F<Configure.pl>.
+
=cut
sub run_single_step {
@@ -356,26 +386,8 @@
my $step = $step_name->new();
# set per step verbosity
- if ( defined $args->{verbose_step} ) {
- if (
- (
- # by step number
- ( $args->{verbose_step} =~ /^\d+$/ )
- and ( $args->{n} == $args->{verbose_step} )
- )
- or (
- # by step name
- ( ${ $conf->{hash_of_steps} }{ $args->{verbose_step} } )
- and ( $args->{verbose_step} eq $step_name )
- )
- or (
- # by description
- $step->description =~ /$args->{verbose_step}/
- )
- )
- {
- $conf->options->set( verbose => 2 );
- }
+ if ( $args->{verbose_step} ) {
+ $conf->options->set( verbose => 2 );
}
my $stub = qq{$step_name - };
@@ -385,8 +397,12 @@
'...';
my $length_message = length($message);
unless ($args->{silent}) {
- print "\n", $message;
- print "\n" if $args->{verbose} && $args->{verbose} == 2;
+ # The first newline terminates the report on the *previous* step.
+ # (Probably needed to make interactive output work properly.
+ # Otherwise, we'd put it in _finish_printing_result().
+ print "\n";
+ print $message;
+ print "\n" if $args->{verbose_step};
}
my $ret;
@@ -400,6 +416,8 @@
# A Parrot configuration step can run successfully, but if it fails to
# achieve its objective it is supposed to return an undefined status.
if ( $ret ) {
+ # reset verbose value for the next step
+ $conf->options->set( verbose => $args->{verbose} );
unless ($args->{silent}) {
_finish_printing_result(
{
@@ -411,8 +429,6 @@
}
);
}
- # reset verbose value for the next step
- $conf->options->set( verbose => $args->{verbose} );
if ($conf->options->get(q{configure_trace}) ) {
_update_conftrace(
{
@@ -442,10 +458,17 @@
sub _finish_printing_result {
my $argsref = shift;
my $result = $argsref->{step}->result || 'done';
- if ( $argsref->{args}->{verbose} && $argsref->{args}->{verbose} == 2 ) {
- print "...";
+ if ($argsref->{args}->{verbose} or $argsref->{args}->{verbose_step}) {
+ # For more readable verbose output, we'll repeat the step description
+ print "\n";
+ my $spaces = 22;
+ print q{ } x $spaces;
+ print $argsref->{description};
+ print '.' x ( ( 78 - $spaces ) - ( length($argsref->{description}) +
length($result) ) );
+ }
+ else {
+ print '.' x ( 78 - ( $argsref->{length_message} + length($result) ) );
}
- print "." x ( 78 - ( $argsref->{length_message} + length($result) ) );
unless ( $argsref->{step_name} =~ m{^inter} && $argsref->{args}->{ask} ) {
print "$result.";
}
Modified: branches/stepdescription/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- branches/stepdescription/lib/Parrot/Configure/Options/Conf.pm
(original)
+++ branches/stepdescription/lib/Parrot/Configure/Options/Conf.pm Sat Aug
9 19:06:39 2008
@@ -128,11 +128,13 @@
--version Show version information
--verbose Output extra information
--verbose=2 Output every setting change
- --verbose-step=N Set verbose for step N only
- --verbose-step=regex Set verbose for step matching description
+ --verbose-step=init::step,auto::step,...
+ Comma-delimited string of configuration steps
+ providing verbose output
--fatal Failure of any configuration step will cause
Configure.pl to halt
- --fatal-step Comma-delimited string of configuration steps
+ --fatal-step=init::step,auto::step,...
+ Comma-delimited string of configuration steps
which upon failure cause Configure.pl to halt
--silent Don't be verbose, interactive or fatal
--nomanicheck Don't check the MANIFEST
Modified: branches/stepdescription/t/configure/007-verbose_two.t
==============================================================================
--- branches/stepdescription/t/configure/007-verbose_two.t (original)
+++ branches/stepdescription/t/configure/007-verbose_two.t Sat Aug 9
19:06:39 2008
@@ -56,7 +56,7 @@
ok( $rv, "runsteps successfully ran $step" );
like(
$stdout,
- qr/$description\.\.\..*done.*Setting Configuration Data.*verbose.*2/s,
+ qr/$description\.\.\..*Setting Configuration Data.*verbose.*2.*done/s,
"Got message expected upon running $step"
);
}