Author: jkeenan
Date: Sat Oct  6 17:10:22 2007
New Revision: 21932

Modified:
   branches/reconfigure/Configure.pl
   branches/reconfigure/lib/Parrot/Configure.pm
   branches/reconfigure/lib/Parrot/Configure/Options/Conf.pm
   branches/reconfigure/t/configure/050-fatal_step.t

Log:
Create a --fatal option to handle the case where the user wants configuration
to halt upon failure in any configuration step.  Discontinue having
'--fatal-step' (with no argument) mean that all steps are fatalized.  This
brings behavior of --fatal and --fatal-step closer to being same as --verbose
and --verbose-step and will allow us in future to pass configuration step
sequence numbers to --fatal-step.


Modified: branches/reconfigure/Configure.pl
==============================================================================
--- branches/reconfigure/Configure.pl   (original)
+++ branches/reconfigure/Configure.pl   Sat Oct  6 17:10:22 2007
@@ -44,6 +44,10 @@
 
 Run C<--verbose=2> for step number C<N> or matching description.
 
+=item C<--fatal>
+
+Tells Configure.pl to halt completely if any configuration step fails.
+
 =item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
 
 Tells Configure.pl to halt completely if any configuration step in

Modified: branches/reconfigure/lib/Parrot/Configure.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Configure.pm        (original)
+++ branches/reconfigure/lib/Parrot/Configure.pm        Sat Oct  6 17:10:22 2007
@@ -220,8 +220,8 @@
     my $conf = shift;
 
     my $n = 0;    # step number
-    my ( $verbose, $verbose_step, $fatal_step, $ask ) =
-        $conf->options->get(qw( verbose verbose-step fatal-step ask ));
+    my ( $verbose, $verbose_step, $fatal, $fatal_step, $ask ) =
+        $conf->options->get(qw( verbose verbose-step fatal fatal-step ask ));
 
 #    $conf->{log} = [];
     # The way the options are currently structured, 'verbose' applies to all
@@ -259,23 +259,30 @@
     # before we run *any* steps.
 
     my %steps_to_die_for = ();
+    # If the --fatal option is true, then all config steps are mapped into
+    # %steps_to_die_for and there is no consideration of --fatal-step.
+    if ($fatal) {
+        %steps_to_die_for = map {$_, 1} @{ $conf->{list_of_steps} };
+    }
     # 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
-    my $step_pattern = qr/((?:init|inter|auto|gen)::[a-z]+)/;
-    if ( defined ( $fatal_step ) ) {
+    # (This will be modified to take a step sequence number.)
+    elsif ( defined ( $fatal_step ) ) {
+        my $step_pattern = qr/((?:init|inter|auto|gen)::[a-z]+)/;
         if ( $fatal_step =~ /^
             $step_pattern
             (, $step_pattern)*
             $/x
         ) {
             %steps_to_die_for = map {$_, 1} (split /,/, $fatal_step);
-        } elsif ( $fatal_step eq '1' ) {
-            %steps_to_die_for = map {$_, 1} @{ $conf->{list_of_steps} };
         } else {
             die "Argument to 'fatal-step' option must be comma-delimited 
string of valid configuration steps";
         }
     }
+    else {
+        # No action needed; this is the default case where no step is fatal
+    }
 
     foreach my $task ( $conf->steps ) {
         my $red_flag;

Modified: branches/reconfigure/lib/Parrot/Configure/Options/Conf.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Configure/Options/Conf.pm   (original)
+++ branches/reconfigure/lib/Parrot/Configure/Options/Conf.pm   Sat Oct  6 
17:10:22 2007
@@ -29,6 +29,7 @@
     define
     exec-prefix
     execcapable
+    fatal
     fatal-step
     floatval
     gc
@@ -123,6 +124,8 @@
    --verbose=2          Output every setting change
    --verbose-step=N     Set verbose for step N only
    --verbose-step=regex Set verbose for step matching description
+   --fatal              Failure of any configuration step will cause
+                        Configure.pl to halt
    --fatal-step         Comma-delimited string of configuration steps
                         which upon failure cause Configure.pl to halt
    --nomanicheck        Don't check the MANIFEST

Modified: branches/reconfigure/t/configure/050-fatal_step.t
==============================================================================
--- branches/reconfigure/t/configure/050-fatal_step.t   (original)
+++ branches/reconfigure/t/configure/050-fatal_step.t   Sat Oct  6 17:10:22 2007
@@ -1,7 +1,7 @@
 #! perl
 # Copyright (C) 2007, The Perl Foundation.
 # $Id$
-# 050-fatal_step.t
+# 050-fatal.t
 
 use strict;
 use warnings;
@@ -18,7 +18,7 @@
 is($|, 1, "output autoflush is set");
 
 my $args = process_options( {
-    argv    => [ q{--fatal-step} ],
+    argv    => [ q{--fatal} ],
     mode    => q{configure},
 } );
 ok(defined $args, "process_options returned successfully");
@@ -59,11 +59,11 @@
 
 =head1 NAME
 
-050-fatal_step.t - see what happens when C<--fatal-step> is set for all 
configuration steps
+050-fatal.t - see what happens when C<--fatal-step> is set for all 
configuration steps
 
 =head1 SYNOPSIS
 
-    % prove t/configure/050-fatal_step.t
+    % prove t/configure/050-fatal.t
 
 =head1 DESCRIPTION
 

Reply via email to