particle: I think this patch should get verbose-step to work the way you wanted it to. Please review. This was developed in the 'step_verbosity_by_name' branch; the attached is a diff between trunk and that branch.
kid51
Index: lib/Parrot/Configure/Options.pm =================================================================== --- lib/Parrot/Configure/Options.pm (.../trunk) (revision 20496) +++ lib/Parrot/Configure/Options.pm (.../branches/step_verbosity_by_name) (revision 20496) @@ -138,6 +138,7 @@ --verbose Output extra information --verbose=2 Output every setting change --verbose-step=N Set verbose for step N only + --verbose-step=name Set verbose for step some::step only --verbose-step=regex Set verbose for step matching description --nomanicheck Don't check the MANIFEST --step=(gen::languages) Index: lib/Parrot/Configure.pm =================================================================== --- lib/Parrot/Configure.pm (.../trunk) (revision 20496) +++ lib/Parrot/Configure.pm (.../branches/step_verbosity_by_name) (revision 20496) @@ -168,8 +168,11 @@ sub add_steps { my ( $conf, @new_steps ) = @_; - foreach my $step (@new_steps) { - $conf->add_step($step); + $conf->{list_of_steps} = [ @new_steps ]; + + for (my $i = 0; $i <= $#new_steps; $i++) { + $conf->add_step($new_steps[$i]); + $conf->{hash_of_steps}->{$new_steps[$i]} = $i + 1; } return 1; @@ -260,20 +263,28 @@ # set per step verbosity if ( defined $args->{verbose_step} ) { - - # by step number if ( - $args->{verbose_step} =~ /^\d+$/ - && - $args->{n} == $args->{verbose_step} + ( + # 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 + $description =~ /$args->{verbose_step}/ + ) ) { $conf->options->set( verbose => 2 ); } - - # by description - elsif ( $description =~ /$args->{verbose_step}/ ) { - $conf->options->set( verbose => 2 ); - } } # RT#43673 cc_build uses this verbose setting, why? @@ -312,6 +323,8 @@ print "..." if $args->{verbose} && $args->{verbose} == 2; print "." x ( 71 - length($description) - length($result) ); print "$result." unless $step =~ m{^inter/} && $args->{ask}; + # reset verbose value for the next step + $conf->options->set( verbose => $args->{verbose} ); if ($conf->options->get(q{configure_trace}) ) { if (! defined $conftrace->[0]) { @@ -325,8 +338,6 @@ push @{$conftrace}, $evolved_data; nstore($conftrace, $sto); } - # reset verbose value for the next step - $conf->options->set( verbose => $args->{verbose} ); } =item * C<option_or_data($arg)> Index: MANIFEST =================================================================== --- MANIFEST (.../trunk) (revision 20496) +++ MANIFEST (.../branches/step_verbosity_by_name) (revision 20496) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by ./tools/dev/mk_manifest_and_skip.pl Fri Aug 3 15:09:40 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Aug 5 14:47:24 2007 UT # # See tools/dev/install_files.pl for documentation on the # format of this file. @@ -2891,6 +2891,7 @@ t/configure/023-version.t [] t/configure/024-version.t [] t/configure/025-options_test.t [] +t/configure/026-verbose_step_name.t [] t/configure/101-init_manifest.01.t [] t/configure/101-init_manifest.02.t [] t/configure/102-init_defaults.01.t [] Index: MANIFEST.SKIP =================================================================== --- MANIFEST.SKIP (.../trunk) (revision 20496) +++ MANIFEST.SKIP (.../branches/step_verbosity_by_name) (revision 20496) @@ -1,6 +1,6 @@ # ex: set ro: # $Id$ -# generated by tools/dev/mk_manifest_and_skip.pl Thu Aug 2 01:41:36 2007 UT +# generated by tools/dev/mk_manifest_and_skip.pl Sun Aug 5 14:47:24 2007 UT # # This file should contain a transcript of the svn:ignore properties # of the directories in the Parrot subversion repository. (Needed for @@ -1740,6 +1740,8 @@ ^t/tools/.*\.pbc/ ^t/tools/.*\.pir$ ^t/tools/.*\.pir/ +^t/tools/pdb\.t\..*$ +^t/tools/pdb\.t\..*/ ^t/tools/pmc2c\..*\.c$ ^t/tools/pmc2c\..*\.c/ ^t/tools/pmc2c\..*\.dump$ Index: Configure.pl =================================================================== --- Configure.pl (.../trunk) (revision 20496) +++ Configure.pl (.../branches/step_verbosity_by_name) (revision 20496) @@ -40,9 +40,10 @@ Tells Configure.pl to output information about i<every> setting added or changed. -=item C<--verbose-step={N|regex}> +=item C<--verbose-step={N|name|regex}> -Run C<--verbose=2> for step number C<N> or matching description. +Run one step with C<--verbose=2>; step indicated by step number C<N>, by step +name (I<e.g.>, C<--verbose-step=inter::make>), or by matching description. =item C<--nomanicheck> Index: t/configure/026-verbose_step_name.t =================================================================== --- t/configure/026-verbose_step_name.t (.../trunk) (revision 0) +++ t/configure/026-verbose_step_name.t (.../branches/step_verbosity_by_name) (revision 20496) @@ -0,0 +1,110 @@ +#! perl +# Copyright (C) 2007, The Perl Foundation. +# $Id$ +# 026-verbose_step_name.t + +use strict; +use warnings; + +use Test::More tests => 14; +use Carp; +use lib qw( . lib ../lib ../../lib t/configure/testlib ); +use Parrot::BuildUtil; +use Parrot::Configure; +use Parrot::Configure::Options qw( process_options ); +use Parrot::IO::Capture::Mini; + +my $parrot_version = Parrot::BuildUtil::parrot_version(); +like($parrot_version, qr/\d+\.\d+\.\d+/, + "Parrot version is in 3-part format"); + +$| = 1; +is($|, 1, "output autoflush is set"); + +my $args = process_options( { + argv => [ q{--verbose-step=init::foobar} ], + script => $0, + parrot_version => $parrot_version, + svnid => '$Id$', +} ); +ok(defined $args, "process_options returned successfully"); +my %args = %$args; + +my $conf = Parrot::Configure->new; +ok(defined $conf, "Parrot::Configure->new() returned okay"); + +my $step = q{init::foobar}; +my $description = 'Determining if your computer does foobar'; + +$conf->add_steps( $step ); +my @confsteps = @{$conf->steps}; +isnt(scalar @confsteps, 0, + "Parrot::Configure object 'steps' key holds non-empty array reference"); +is(scalar @confsteps, 1, + "Parrot::Configure object 'steps' key holds ref to 1-element array"); +my $nontaskcount = 0; +foreach my $k (@confsteps) { + $nontaskcount++ unless $k->isa("Parrot::Configure::Task"); +} +is($nontaskcount, 0, "Each step is a Parrot::Configure::Task object"); +is($confsteps[0]->step, $step, + "'step' element of Parrot::Configure::Task struct identified"); +is(ref($confsteps[0]->params), 'ARRAY', + "'params' element of Parrot::Configure::Task struct is array ref"); +ok(! ref($confsteps[0]->object), + "'object' element of Parrot::Configure::Task struct is not yet a ref"); + +$conf->options->set(%args); +is($conf->options->{c}->{debugging}, 1, + "command-line option '--debugging' has been stored in object"); + +my $rv; +my ($tie, @lines); +{ + $tie = tie *STDOUT, "Parrot::IO::Capture::Mini" + or croak "Unable to tie"; + $rv = $conf->runsteps; + @lines = $tie->READLINE; +} +ok($rv, "runsteps successfully ran $step"); +my $bigmsg = join q{}, @lines; +like($bigmsg, + qr/$description\.\.\..*done.*Setting Configuration Data.*verbose.*undef/s, + "Got message expected upon running $step"); + +pass("Completed all tests in $0"); + +################### DOCUMENTATION ################### + +=head1 NAME + +026-verbose_step_name.t - test bad step failure case in Parrot::Configure + +=head1 SYNOPSIS + + % prove t/configure/026-verbose_step_name.t + +=head1 DESCRIPTION + +The files in this directory test functionality used by F<Configure.pl>. + +The tests in this file examine what happens when you configure with the +<--verbose-step> option set to the name of a configuration step in +C<some::step> format. + +=head1 AUTHOR + +James E Keenan + +=head1 SEE ALSO + +Parrot::Configure, F<Configure.pl>. + +=cut + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: Property changes on: t/configure/026-verbose_step_name.t ___________________________________________________________________ Name: svn:eol-style + native Name: svn:mime-type + text/plain Name: svn:keywords + Author Date Id Revision