Please review the patch attached, which proposes adding a new Parrot
configuration step, auto::fink, for the purpose of locating the Fink
directories needed for three later configuration steps.
Adding config/auto/fink.pm and 9 test files. Modifying
Parrot::Configure::Step::List, the 3 affected config step classes and
MANIFEST.
If there is no objection, I will apply this to trunk within a week. Is
there anyone out there building Parrot on Darwin who has Fink installed
in a non-standard location? If so, your smoke of the patch would be
welcome. (But since there probably won't be that many such people, I
won't wait long before applying the patch.)
Thank you very much.
kid51
Index: MANIFEST
===================================================================
--- MANIFEST (revision 24263)
+++ MANIFEST (working copy)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Dec 29 07:48:33 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Dec 29 16:58:16 2007 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -216,6 +216,7 @@
config/auto/env.pm []
config/auto/env/test_setenv.in []
config/auto/env/test_unsetenv.in []
+config/auto/fink.pm []
config/auto/format.pm []
config/auto/funcptr.pm []
config/auto/funcptr/test_c.in []
@@ -3124,6 +3125,15 @@
t/configure/111-auto_gcc-13.t []
t/configure/112-auto_backtrace-01.t []
t/configure/112-auto_backtrace-02.t []
+t/configure/113-auto_fink-01.t []
+t/configure/113-auto_fink-02.t []
+t/configure/113-auto_fink-03.t []
+t/configure/113-auto_fink-04.t []
+t/configure/113-auto_fink-05.t []
+t/configure/113-auto_fink-06.t []
+t/configure/113-auto_fink-07.t []
+t/configure/113-auto_fink-08.t []
+t/configure/113-auto_fink-09.t []
t/configure/113-auto_msvc-01.t []
t/configure/113-auto_msvc-02.t []
t/configure/113-auto_msvc-03.t []
Index: lib/Parrot/Configure/Step/List.pm
===================================================================
--- lib/Parrot/Configure/Step/List.pm (revision 24263)
+++ lib/Parrot/Configure/Step/List.pm (working copy)
@@ -20,6 +20,7 @@
inter::yacc
auto::gcc
auto::backtrace
+ auto::fink
auto::msvc
auto::attributes
auto::warnings
Index: t/configure/113-auto_fink-01.t
===================================================================
--- t/configure/113-auto_fink-01.t (revision 0)
+++ t/configure/113-auto_fink-01.t (revision 0)
@@ -0,0 +1,81 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-01.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-01.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 11 );
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+# Success in the following test means:
+# (a) OS is Darwin.
+# (b) Either Fink is not installed or it is installed correctly, i.e., we can
+# locate the Fink subdirectories we need for later Parrot configuration steps.
+ok($step->runstep($conf), "runstep() returned true value");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-01.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-01.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file run on Darwin only and test config::auto::fink.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-01.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-05.t
===================================================================
--- t/configure/113-auto_fink-05.t (revision 0)
+++ t/configure/113-auto_fink-05.t (revision 0)
@@ -0,0 +1,91 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-05.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-05.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 12 );
+# plan( 'no_plan' );
+use Carp;
+use File::Temp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock Fink config file with non-existent Basepath
+ my $tfile = File::Temp->new();
+ open my $fh, ">", $tfile
+ or croak "Unable to open temporary file for writing";
+ print $fh "Basepath: /my/phony/directory\n";
+ close $fh or croak "Unable to close temporary file after writing";
+ $step->{fink_conf} = $tfile;
+ ok(! defined $step->runstep($conf),
+ "runstep() returned undef due to unlocateable Fink directories");
+ is($step->result(), q{failed},
+ "Got expected result for unlocateable Fink directories");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-05.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-05.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the one or
+more of the Fink directories cannot be located.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-05.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-09.t
===================================================================
--- t/configure/113-auto_fink-09.t (revision 0)
+++ t/configure/113-auto_fink-09.t (revision 0)
@@ -0,0 +1,101 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-09.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-09.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 13 );
+# plan( 'no_plan' );
+use Carp;
+use File::Temp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+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 => [ q{--verbose} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock Fink config file with non-existent Basepath
+ my $tfile = File::Temp->new();
+ open my $fh, ">", $tfile
+ or croak "Unable to open temporary file for writing";
+ print $fh "Basepath: /my/phony/directory\n";
+ close $fh or croak "Unable to close temporary file after writing";
+ $step->{fink_conf} = $tfile;
+
+ my ($rv, $stdout);
+ capture(
+ sub { $rv = $step->runstep($conf); },
+ \$stdout,
+ );
+ ok(! defined $rv,
+ "runstep() returned undef due to unlocateable Fink directories");
+ is($step->result(), q{failed},
+ "Got expected result for unlocateable Fink directories");
+ like($stdout,
+ qr/Could not locate Fink directories/,
+ "Got expected verbose output for unlocateable Fink directories");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-09.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-09.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the one or
+more of the Fink directories cannot be located.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-09.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-02.t
===================================================================
--- t/configure/113-auto_fink-02.t (revision 0)
+++ t/configure/113-auto_fink-02.t (revision 0)
@@ -0,0 +1,79 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-02.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-02.t
+
+use strict;
+use warnings;
+use Test::More tests => 12;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+# mock not Darwin
+$conf->data->set_p5( 'OSNAME' => 'foobar' );
+ok($step->runstep($conf), "runstep() returned true value");
+is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-02.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-02.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the OS is not
+Darwin.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-02.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-06.t
===================================================================
--- t/configure/113-auto_fink-06.t (revision 0)
+++ t/configure/113-auto_fink-06.t (revision 0)
@@ -0,0 +1,90 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-06.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-06.t
+
+use strict;
+use warnings;
+use Test::More tests => 13;
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+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 => [ q{--verbose} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock not Darwin
+ my $phony_OS = q{foobar};
+ $conf->data->set_p5( 'OSNAME' => $phony_OS );
+ my ($rv, $stdout);
+ capture(
+ sub { $rv = $step->runstep($conf); },
+ \$stdout,
+ );
+ ok($rv, "runstep() returned true value");
+ is($step->result(), q{skipped}, "Got expected result for non-Darwin OS");
+ like($stdout,
+ qr/Operating system is $phony_OS; Fink is Darwin only/,
+ "Got expected verbose output when OS is not Darwin");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-06.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-06.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the OS is not
+Darwin and C<--verbose> output has been requested.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-06.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-03.t
===================================================================
--- t/configure/113-auto_fink-03.t (revision 0)
+++ t/configure/113-auto_fink-03.t (revision 0)
@@ -0,0 +1,82 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-03.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-03.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 12 );
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+# mock no Fink
+$step->{fink_conf} = q{my_ridiculous_foobar};
+my $msg = q{Fink not installed};
+ok($step->runstep($conf), "runstep() returned true value");
+is($step->result(), $msg,
+ "Got expected result for $msg");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-03.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-03.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the OS is
+Darwin but Fink is not installed.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-03.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-07.t
===================================================================
--- t/configure/113-auto_fink-07.t (revision 0)
+++ t/configure/113-auto_fink-07.t (revision 0)
@@ -0,0 +1,93 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-07.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-07.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 13 );
+use Carp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+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 => [ q{--verbose} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock no Fink
+ $step->{fink_conf} = q{my_ridiculous_foobar};
+ my $msg = q{Fink not installed};
+ my ($rv, $stdout);
+ capture(
+ sub { $rv = $step->runstep($conf); },
+ \$stdout,
+ );
+ ok($rv, "runstep() returned true value");
+ is($step->result(), $msg,
+ "Got expected result for $msg");
+ like($stdout,
+ qr/Fink configuration file not located/,
+ "Got expected verbose output when OS is not Darwin");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-07.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-07.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the OS is
+Darwin but Fink is not installed and C<--verbose> output has been requested.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-07.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-04.t
===================================================================
--- t/configure/113-auto_fink-04.t (revision 0)
+++ t/configure/113-auto_fink-04.t (revision 0)
@@ -0,0 +1,91 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-04.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-04.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 12 );
+# plan( 'no_plan' );
+use Carp;
+use File::Temp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+use Parrot::Configure;
+use Parrot::Configure::Options qw( process_options );
+use Parrot::Configure::Test qw( test_step_thru_runstep);
+
+my $args = process_options( {
+ argv => [],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock Fink config file with no Basepath
+ my $tfile = File::Temp->new();
+ open my $fh, ">", $tfile
+ or croak "Unable to open temporary file for writing";
+ print $fh "Message: Hello world\n";
+ close $fh or croak "Unable to close temporary file after writing";
+ $step->{fink_conf} = $tfile;
+ ok(! defined $step->runstep($conf),
+ "runstep() returned undef due to defective Fink config file");
+ is($step->result(), q{failed},
+ "Got expected result for defective Fink Config file");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-04.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-04.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the Fink
+configuration file is defective.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-04.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: t/configure/113-auto_fink-08.t
===================================================================
--- t/configure/113-auto_fink-08.t (revision 0)
+++ t/configure/113-auto_fink-08.t (revision 0)
@@ -0,0 +1,101 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id: 113-auto_fink-08.t 23588 2007-12-08 14:31:02Z jkeenan $
+# 113-auto_fink-08.t
+
+use strict;
+use warnings;
+use Test::More;
+plan( skip_all => 'Fink is Darwin only' ) unless $^O =~ /darwin/;
+plan( tests => 13 );
+# plan( 'no_plan' );
+use Carp;
+use File::Temp;
+use lib qw( lib t/configure/testlib );
+use_ok('config::init::defaults');
+use_ok('config::auto::fink');
+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 => [ q{--verbose} ],
+ mode => q{configure},
+} );
+
+my $conf = Parrot::Configure->new();
+
+test_step_thru_runstep($conf, q{init::defaults}, $args);
+
+my ($task, $step_name, $step, $ret);
+my $pkg = q{auto::fink};
+
+$conf->add_steps($pkg);
+$conf->options->set(%{$args});
+$task = $conf->steps->[-1];
+$step_name = $task->step;
+
+$step = $step_name->new();
+ok(defined $step, "$step_name constructor returned defined value");
+isa_ok($step, $step_name);
+ok($step->description(), "$step_name has description");
+
+{
+ # mock Fink config file with no Basepath
+ my $tfile = File::Temp->new();
+ open my $fh, ">", $tfile
+ or croak "Unable to open temporary file for writing";
+ print $fh "Message: Hello world\n";
+ close $fh or croak "Unable to close temporary file after writing";
+ $step->{fink_conf} = $tfile;
+
+ my ($rv, $stdout);
+ capture(
+ sub { $rv = $step->runstep($conf); },
+ \$stdout,
+ );
+ ok(! defined $rv,
+ "runstep() returned undef due to defective Fink config file");
+ is($step->result(), q{failed},
+ "Got expected result for defective Fink Config file");
+ like($stdout,
+ qr/Fink configuration file defective: no 'Basepath'/,
+ "Got expected verbose output when Fink config file lacked 'Basepath'");
+}
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+113-auto_fink-08.t - test config::auto::fink
+
+=head1 SYNOPSIS
+
+ % prove t/configure/113-auto_fink-08.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test config::auto::fink in the case where the Fink
+configuration file is defective.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+config::auto::fink, 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/113-auto_fink-08.t
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Index: config/auto/gdbm.pm
===================================================================
--- config/auto/gdbm.pm (revision 24263)
+++ config/auto/gdbm.pm (working copy)
@@ -56,13 +56,13 @@
# On OS X check the presence of the gdbm header in the standard
# Fink location.
- # RT#43134: Need a more generalized way for finding
- # where Fink lives.
if ( $osname =~ /darwin/ ) {
- if ( -f "/sw/include/gdbm.h" ) {
- $conf->data->add( ' ', linkflags => '-L/sw/lib' );
- $conf->data->add( ' ', dflags => '-L/sw/lib' );
- $conf->data->add( ' ', cflags => '-I/sw/include' );
+ my $fink_lib_dir = $conf->data->get('fink_lib_dir');
+ my $fink_include_dir = $conf->data->get('fink_include_dir');
+ if ( -f "$fink_include_dir/gdbm.h" ) {
+ $conf->data->add( ' ', linkflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', dflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', cflags => "-I$fink_include_dir" );
}
}
Index: config/auto/gmp.pm
===================================================================
--- config/auto/gmp.pm (revision 24263)
+++ config/auto/gmp.pm (working copy)
@@ -66,13 +66,13 @@
# On OS X check the presence of the gmp header in the standard
# Fink location.
- # RT#43134: Need a more generalized way for finding
- # where Fink lives.
if ( $osname =~ /darwin/ ) {
- if ( -f "/sw/include/gmp.h" ) {
- $conf->data->add( ' ', linkflags => '-L/sw/lib' );
- $conf->data->add( ' ', ldflags => '-L/sw/lib' );
- $conf->data->add( ' ', ccflags => '-I/sw/include' );
+ my $fink_lib_dir = $conf->data->get('fink_lib_dir');
+ my $fink_include_dir = $conf->data->get('fink_include_dir');
+ if ( -f "$fink_include_dir/gmp.h" ) {
+ $conf->data->add( ' ', linkflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', ldflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', ccflags => "-I$fink_include_dir" );
}
}
Index: config/auto/readline.pm
===================================================================
--- config/auto/readline.pm (revision 24263)
+++ config/auto/readline.pm (working copy)
@@ -55,13 +55,13 @@
# On OS X check the presence of the readline header in the standard
# Fink/macports location.
- # RT#43134: Need a more generalized way for finding
- # where Fink lives.
if ( $osname =~ /darwin/ ) {
- if ( -f "/sw/include/readline/readline.h" ) {
- $conf->data->add( ' ', linkflags => '-L/sw/lib' );
- $conf->data->add( ' ', ldflags => '-L/sw/lib' );
- $conf->data->add( ' ', ccflags => '-I/sw/include' );
+ my $fink_lib_dir = $conf->data->get('fink_lib_dir');
+ my $fink_include_dir = $conf->data->get('fink_include_dir');
+ if ( -f "$fink_include_dir/readline/readline.h" ) {
+ $conf->data->add( ' ', linkflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', ldflags => "-L$fink_lib_dir" );
+ $conf->data->add( ' ', ccflags => "-I$fink_include_dir" );
}
if ( -f "/opt/local/include/readline/readline.h" ) {
$conf->data->add( ' ', linkflags => '-L/opt/local/lib' );
Index: config/auto/fink.pm
===================================================================
--- config/auto/fink.pm (revision 0)
+++ config/auto/fink.pm (revision 0)
@@ -0,0 +1,101 @@
+# Copyright (C) 2005-2007, The Perl Foundation.
+# $Id: fink.pm 22629 2007-10-31 02:09:28Z jkeenan $
+
+=head1 NAME
+
+config/auto/fink.pm - Determine Fink location on Darwin
+
+=head1 DESCRIPTION
+
+If the operating system is Darwin, this class determines whether and where
+Fink is installed.
+
+=cut
+
+package auto::fink;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step::Base);
+
+use Parrot::Configure::Step ':auto';
+use Parrot::BuildUtil;
+
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Determining Fink location on Darwin};
+ $data{args} = [ ];
+ $data{result} = q{};
+ # Per fink(8), this is location for Fink configuration file, presumably
+ # regardless of where Fink itself is installed.
+ $data{fink_conf} = q{/sw/etc/fink.conf};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = ( shift, shift );
+ my $osname = $conf->data->get_p5( 'OSNAME' );
+ my $verbose = $conf->options->get( 'verbose' );
+ unless ($osname =~ /darwin/) {
+ print "Operating system is $osname; Fink is Darwin only\n"
+ if $verbose;
+ $self->set_result('skipped');
+ return 1;
+ }
+ # Per fink(8), this is location for Fink configuration file, presumably
+ # regardless of where Fink itself is installed.
+ my $fink_conf = $self->{fink_conf};
+ unless (-f $fink_conf) {
+ print "Fink configuration file not located\n"
+ if $verbose;
+ $self->set_result('Fink not installed');
+ return 1;
+ }
+ my $fink_conf_str = Parrot::BuildUtil::slurp_file($fink_conf);
+ my @lines = split /\n/, $fink_conf_str;
+ my $fink_base_dir;
+ while (defined (my $l = shift @lines) ) {
+ chomp $l;
+ next unless $l =~ /^Basepath:\s(.*)/;
+ $fink_base_dir = $1;
+ last;
+ }
+ unless (defined $fink_base_dir) {
+ print "Fink configuration file defective: no 'Basepath'\n"
+ if $verbose;
+ $self->set_result('failed');
+ return;
+ }
+ my $fink_lib_dir = qq{$fink_base_dir/lib};
+ my $fink_include_dir = qq{$fink_base_dir/include};
+ my @unlocateables;
+ foreach my $dir ($fink_base_dir, $fink_lib_dir, $fink_include_dir) {
+ push @unlocateables, $dir unless (-d $dir);
+ }
+ if (@unlocateables) {
+ print "Could not locate Fink directories: @unlocateables\n"
+ if $verbose;
+ $self->set_result('failed');
+ return;
+ } else {
+ $conf->data->set(
+ fink_base_dir => $fink_base_dir,
+ fink_lib_dir => $fink_lib_dir,
+ fink_include_dir => $fink_include_dir,
+ );
+ $self->set_result('Fink located');
+ return 1;
+ }
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Property changes on: config/auto/fink.pm
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native