On Tue Jun 10 05:32:21 2008, coke wrote:
>
> From: Nathan Gray <[EMAIL PROTECTED]>
> Date: Tue, Jun 10, 2008 at 6:57 AM
> Subject: parrot init/hints for the Hurd
> To: [EMAIL PROTECTED]
> 
> 
> I tried compiling parrot on the Hurd, but Configure.pl complained:
> 
> Loading platform and local hints files...
> step init::hints died during execution: Can't locate init/hints/gnu.pm
> in @INC (@INC contains: config lib /usr/lib/perl/5.10
> /usr/share/perl/5.10 /usr/local/lib/perl/5.10.0
> /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 .) at
> (eval 12) line 2.
> BEGIN failed--compilation aborted at (eval 12) line 2.
> 
>  at Configure.pl line 444
> 
> -kolibrie
> 
> 
>

Nathan, Will:

Please try the attached patch.  After applying the patch, I would
suggest the following to test it thoroughly:

    perl Configure.pl

... then:

    perl Configure.pl --nomanicheck --verbose-step=init::hints

... and see if you get reasonable output.

The patch attached should make config/init/hints.pm DTRT in the absence
of an OS-specific hints file -- so this should be tested *without* and
'touch' of config/init/hints/gnu.pm or /hurd.pm or whatever.  (The patch
also does some cleanup on each of the 4 files testing this config step.)

(Nathan:  Once the above looks good, you could try: 'perl Configure.pl
--test' for a more thorough test of the configure and build systems. 
But any problems there would be reported in a separate ticket.)

If I don't hear anything negative, I'll apply this patch in 1-2 days.

Thank you very much.

kid51
Index: t/steps/init_hints-04.t
===================================================================
--- t/steps/init_hints-04.t     (revision 28227)
+++ t/steps/init_hints-04.t     (working copy)
@@ -5,21 +5,20 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  15;
+use Test::More tests =>  10;
 use Carp;
-use Cwd;
-use File::Path ();
+use File::Spec::Functions qw/catfile/;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
-use_ok('config::init::install');
 use_ok('config::init::hints');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
 use Parrot::Configure::Test qw( test_step_thru_runstep);
+use IO::CaptureOutput qw( capture );
 
 my $args = process_options(
     {
-        argv => [],
+        argv => [ q{--verbose} ],
         mode => q{configure},
     }
 );
@@ -27,14 +26,13 @@
 my $conf = Parrot::Configure->new;
 
 test_step_thru_runstep( $conf, q{init::defaults}, $args );
-test_step_thru_runstep( $conf, q{init::install},  $args );
 
 my ( $task, $step_name, $step, $ret );
 my $pkg = q{init::hints};
 
 $conf->add_steps($pkg); $conf->options->set( %{$args} );
 
-$task        = $conf->steps->[2];
+$task        = $conf->steps->[-1];
 $step_name   = $task->step;
 
 $step = $step_name->new();
@@ -43,13 +41,19 @@
 
 
 {
+    my ($stdout, $stderr);
     $conf->data->set_p5( OSNAME => q{imaginaryOS} );
-    my $os = $conf->data->get_p5( 'OSNAME' );
-    eval { $ret = $step->runstep($conf); };
+    my $osname = lc( $conf->data->get_p5( 'OSNAME' ) );
+    my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
+    capture (
+        sub { $ret = $step->runstep($conf); },
+        \$stdout,
+        \$stderr,
+    );;
     like(
-        $@,
-        qr{^Can't locate init/hints/$os\.pm}i,
-        "Got expected error message upon bad value for \$^O"
+        $stdout,
+        qr/No $hints_file found/s,
+        "Got expected verbose output when no hints file found"
     );
 }
 
Index: t/steps/init_hints-01.t
===================================================================
--- t/steps/init_hints-01.t     (revision 28227)
+++ t/steps/init_hints-01.t     (working copy)
@@ -5,12 +5,11 @@
 
 use strict;
 use warnings;
-use Test::More tests => 17;
+use Test::More tests => 12;
 use Carp;
 use Data::Dumper;
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
-use_ok('config::init::install');
 use_ok('config::init::hints');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
@@ -27,7 +26,6 @@
 my $conf = Parrot::Configure->new;
 
 test_step_thru_runstep( $conf, q{init::defaults}, $args );
-test_step_thru_runstep( $conf, q{init::install},  $args );
 
 my ( $task, $step_name, $step, $ret );
 my $pkg = q{init::hints};
@@ -35,7 +33,7 @@
 $conf->add_steps($pkg);
 $conf->options->set( %{$args} );
 
-$task        = $conf->steps->[2];
+$task        = $conf->steps->[-1];
 $step_name   = $task->step;
 
 $step = $step_name->new();
Index: t/steps/init_hints-02.t
===================================================================
--- t/steps/init_hints-02.t     (revision 28227)
+++ t/steps/init_hints-02.t     (working copy)
@@ -5,14 +5,13 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  16;
+use Test::More tests =>  11;
 use Carp;
 use Cwd;
 use File::Path ();
 use File::Temp qw(tempdir);
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
-use_ok('config::init::install');
 use_ok('config::init::hints');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
@@ -29,7 +28,6 @@
 my $conf = Parrot::Configure->new;
 
 test_step_thru_runstep( $conf, q{init::defaults}, $args );
-test_step_thru_runstep( $conf, q{init::install},  $args );
 
 my ( $task, $step_name, $step, $ret );
 my $pkg = q{init::hints};
@@ -37,7 +35,7 @@
 $conf->add_steps($pkg);
 $conf->options->set( %{$args} );
 
-$task        = $conf->steps->[2];
+$task        = $conf->steps->[-1];
 $step_name   = $task->step;
 
 $step = $step_name->new();
Index: t/steps/init_hints-03.t
===================================================================
--- t/steps/init_hints-03.t     (revision 28227)
+++ t/steps/init_hints-03.t     (working copy)
@@ -5,14 +5,13 @@
 
 use strict;
 use warnings;
-use Test::More tests =>  16;
+use Test::More tests =>  11;
 use Carp;
 use Cwd;
 use File::Path ();
 use File::Temp qw(tempdir);
 use lib qw( lib t/configure/testlib );
 use_ok('config::init::defaults');
-use_ok('config::init::install');
 use_ok('config::init::hints');
 use Parrot::Configure;
 use Parrot::Configure::Options qw( process_options );
@@ -29,7 +28,6 @@
 my $conf = Parrot::Configure->new;
 
 test_step_thru_runstep( $conf, q{init::defaults}, $args );
-test_step_thru_runstep( $conf, q{init::install},  $args );
 
 my ( $task, $step_name, $step, $ret );
 my $pkg = q{init::hints};
@@ -37,7 +35,7 @@
 $conf->add_steps($pkg);
 $conf->options->set( %{$args} );
 
-$task        = $conf->steps->[2];
+$task        = $conf->steps->[-1];
 $step_name   = $task->step;
 
 $step = $step_name->new();
Index: config/init/hints.pm
===================================================================
--- config/init/hints.pm        (revision 28227)
+++ config/init/hints.pm        (working copy)
@@ -17,6 +17,7 @@
 use strict;
 use warnings;
 
+use File::Spec::Functions qw/catfile/;
 use base qw(Parrot::Configure::Step);
 
 sub _init {
@@ -31,29 +32,37 @@
     my ( $self, $conf ) = @_;
 
     my $verbose = $conf->options->get('verbose');
+    print "\n[ " if $verbose;
 
     my $hints_used = 0;
 
-    my $hints = "init::hints::" . lc( $conf->data->get_p5('OSNAME') );
-
-    print "[ $hints " if $verbose;
-
-    eval "use $hints";
-    die $@ if $@;
-
-    # Call the runstep method if it exists.
-    # Otherwise the step must have done its work when it was loaded.
-    $hints->runstep( $conf, @_ ) if $hints->can('runstep');
-    $hints_used++;
-
-    $hints = "init::hints::local";
-    print "$hints " if $verbose;
-    eval "use $hints";
-
-    unless ($@) {
-        $hints->runstep( $conf, @_ ) if $hints->can('runstep');
+    my $osname = lc( $conf->data->get_p5('OSNAME') );
+    my $hints_file = catfile('config', 'init', 'hints', "$osname.pm");
+    if ( -f $hints_file ) {
+        my $hints_pkg = "init::hints::" . $osname;
+    
+        print "$hints_pkg " if $verbose;
+    
+        eval "use $hints_pkg";
+        die $@ if $@;
+    
+        # Call the runstep method if it exists.
+        # Otherwise the step must have done its work when it was loaded.
+        $hints_pkg->runstep( $conf, @_ ) if $hints_pkg->can('runstep');
         $hints_used++;
+    
+        $hints_pkg = "init::hints::local";
+        print "$hints_pkg " if $verbose;
+        eval "use $hints_pkg";
+    
+        unless ($@) {
+            $hints_pkg->runstep( $conf, @_ ) if $hints_pkg->can('runstep');
+            $hints_used++;
+        }
     }
+    else {
+        print "No $hints_file found.  " if $verbose;
+    }
 
     if ( $hints_used == 0 and $verbose ) {
         print "(no hints) ";

Reply via email to