perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r21633 - in branches/reconfigure: . lib/Parrot lib/Parrot/C

Subject: [svn:parrot] r21633 - in branches/reconfigure: . lib/Parrot lib/Parrot/Configure/Options
From:
Date: Thu, 27 Sep 2007 19:38:04 -0700 PDT
Newsgroups: perl.cvs.parrot

Author: jkeenan
Date: Thu Sep 27 19:38:03 2007
New Revision: 21633

Modified:
   branches/reconfigure/Configure.pl
   branches/reconfigure/lib/Parrot/Configure.pm
   branches/reconfigure/lib/Parrot/Configure/Options/Conf.pm

Log:
First draft of implementation of --fatal-step option to Configure.pl.  User
will be able to supply a comma-delimited string of names of configuration
steps which, upon failure (undef return), will cause Configure.pl to halt
completely.


Modified: branches/reconfigure/Configure.pl
==============================================================================
--- branches/reconfigure/Configure.pl   (original)
+++ branches/reconfigure/Configure.pl   Thu Sep 27 19:38:03 2007
@@ -44,6 +44,11 @@
 
 Run C<--verbose=2> for step number C<N> or matching description.
 
+=item C<--fatal-step={init::alpha,inter::beta,auto::gamma}>
+
+Tells Configure.pl to halt completely if any configuration step in
+comma-delimited string individually fails.
+
 =item C<--nomanicheck>
 
 Tells Configure.pl not to run the MANIFEST check.

Modified: branches/reconfigure/lib/Parrot/Configure.pm
==============================================================================
--- branches/reconfigure/lib/Parrot/Configure.pm        (original)
+++ branches/reconfigure/lib/Parrot/Configure.pm        Thu Sep 27 19:38:03 2007
@@ -36,9 +36,10 @@
 
 use strict;
 use warnings;
+use Data::Dumper;
 
 use lib qw(config);
-use Carp qw(carp);
+use Carp qw(carp croak);
 use Storable qw(nstore retrieve);
 use Parrot::Configure::Data;
 
@@ -194,7 +195,8 @@
     my $conf = shift;
 
     my $n = 0;    # step number
-    my ( $verbose, $verbose_step, $ask ) = $conf->options->get(qw( verbose 
verbose-step ask ));
+    my ( $verbose, $verbose_step, $fatal_step, $ask ) =
+        $conf->options->get(qw( verbose verbose-step fatal-step ask ));
 
 #    $conf->{log} = [];
     # The way the options are currently structured, 'verbose' applies to all
@@ -231,7 +233,31 @@
     # error *before* we run that step -- which means having that info at hand
     # before we run *any* steps.
 
+    my %steps_to_die_for = ();
+    # 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 ( $fatal_step =~ /^
+        $step_pattern
+        (, $step_pattern)*
+        $/x
+    ) {
+        %steps_to_die_for = map {$_, 1} (split /,/, $fatal_step);
+        print STDERR Dumper \%steps_to_die_for;
+    } else {
+        die "Argument to 'fatal-step' option must be comma-delimited string of 
valid configuration steps";
+    }
+
     foreach my $task ( $conf->steps ) {
+        my $red_flag;
+        my $step_name   = $task->step;
+        if ( scalar ( keys ( %steps_to_die_for ) ) ) {
+            if ( $steps_to_die_for{$step_name} ) {
+                $red_flag++;
+            }
+        }
+
         $n++;
         my $rv = $conf->_run_this_step( {
             task            => $task,
@@ -240,9 +266,9 @@
             ask             => $ask,
             n               => $n,
         } );
-#        ${$conf->{log}}[$n] = $rv
-#            ? { $task->step, 1 }
-#            : { $task->step, undef };;
+        if ( ( not defined ( $rv ) ) and $red_flag ) {
+            return;
+        }
     }
     return 1;
 }
@@ -261,7 +287,8 @@
     my $conf     = shift;
     my $taskname = shift;
 
-    my ( $verbose, $verbose_step, $ask ) = $conf->options->get(qw( verbose 
verbose-step ask ));
+    my ( $verbose, $verbose_step, $ask ) =
+        $conf->options->get(qw( verbose verbose-step ask ));
  
     my $task = ( $conf->steps() )[0];
     if ( $task->{"Parrot::Configure::Task::step"} eq $taskname ) {
@@ -298,8 +325,6 @@
     }
     my $step = $step_name->new();
 
-    my $description = $step->description() || q{};
-
     # set per step verbosity
     if ( defined $args->{verbose_step} ) {
         if (
@@ -317,7 +342,7 @@
             or (
 
                 # by description
-                $description =~ /$args->{verbose_step}/
+                $step->description =~ /$args->{verbose_step}/
             )
             )
         {
@@ -328,7 +353,7 @@
     # RT#43673 cc_build uses this verbose setting, why?
     $conf->data->set( verbose => $args->{verbose} ) if $args->{n} > 2;
 
-    print "\n", $description, '...';
+    print "\n", $step->description, '...';
     print "\n" if $args->{verbose} && $args->{verbose} == 2;
 
     my $ret;
@@ -352,7 +377,7 @@
             _finish_printing_result( {
                 step        => $step,
                 args        => $args,
-                description => $description,
+                description => $step->description,
             } );
             # reset verbose value for the next step
             $conf->options->set( verbose => $args->{verbose} );

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   Thu Sep 27 
19:38:03 2007
@@ -29,6 +29,7 @@
     define
     exec-prefix
     execcapable
+    fatal-step
     floatval
     gc
     help
@@ -122,6 +123,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-step         Comma-delimited string of configuration steps
+                        which upon failure cause Configure.pl to halt
    --nomanicheck        Don't check the MANIFEST
    --step=(gen::languages)
                         Execute a single configure step

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r21633 - in branches/reconfigure: . lib/Parrot lib/Parrot/Configure/Options, jkeenan <=