Author: jkeenan
Date: Wed Apr 11 17:32:35 2007
New Revision: 18157

Added:
   trunk/lib/Parrot/Configure/Step/List.pm   (contents, props changed)
   trunk/t/configure/03-steplist.t   (contents, props changed)
Modified:
   trunk/Configure.pl
   trunk/MANIFEST

Log:
Apply patch supplied in http://rt.perl.org/rt3/Ticket/Display.html?id=42337.
List of configuration steps has been refactored out of Configure.pl and placed
in lib/Parrot/Configure/Step/List.pm.
t/configure/03-step.t supplied to test this functionality.
docs/configuration.pod revised to reflect this change.


Modified: trunk/Configure.pl
==============================================================================
--- trunk/Configure.pl  (original)
+++ trunk/Configure.pl  Wed Apr 11 17:32:35 2007
@@ -266,6 +266,7 @@
     print_introduction
     print_conclusion
 );
+use Parrot::Configure::Step::List qw( get_steps_list );
 
 # These globals are accessed in config/init/defaults.pm
 our $parrot_version = Parrot::BuildUtil::parrot_version();
@@ -298,66 +299,6 @@
 # from Parrot::Configure::Messages
 print_introduction($parrot_version);
 
-# EDIT HERE TO ADD NEW TESTS
-my @steps = qw(
-    init::manifest
-    init::defaults
-    init::install
-    init::miniparrot
-    init::hints
-    init::headers
-    inter::progs
-    inter::make
-    inter::lex
-    inter::yacc
-    auto::gcc
-    auto::msvc
-    init::optimize
-    inter::shlibs
-    inter::libparrot
-    inter::charset
-    inter::encoding
-    inter::types
-    inter::ops
-    inter::pmc
-    auto::alignptrs
-    auto::headers
-    auto::sizes
-    auto::byteorder
-    auto::va_ptr
-    auto::pack
-    auto::format
-    auto::isreg
-    auto::jit
-    gen::cpu
-    auto::funcptr
-    auto::cgoto
-    auto::inline
-    auto::gc
-    auto::memalign
-    auto::signal
-    auto::socklen_t
-    auto::env
-    auto::aio
-    auto::gmp
-    auto::readline
-    auto::gdbm
-    auto::snprintf
-    auto::perldoc
-    auto::python
-    auto::m4
-    auto::cpu
-    gen::icu
-    gen::revision
-    gen::config_h
-    gen::core_pmcs
-    gen::parrot_include
-    gen::languages
-    gen::makefiles
-    gen::platform
-    gen::config_pm
-);
-
 my $conf = Parrot::Configure->new;
 {
 
@@ -365,7 +306,10 @@
     no warnings qw(once);
     $Parrot::Configure::Step::conf = $conf;
 }
-$conf->add_steps(@steps);
+
+# from Parrot::Configure::Step::List
+$conf->add_steps(get_steps_list());
+
 $conf->options->set(%args);
 
 if ( exists $args{step} ) {

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST      (original)
+++ trunk/MANIFEST      Wed Apr 11 17:32:35 2007
@@ -2230,6 +2230,7 @@
 lib/Parrot/Configure/Options.pm                             [devel]
 lib/Parrot/Configure/Step.pm                                [devel]
 lib/Parrot/Configure/Step/Base.pm                           [devel]
+lib/Parrot/Configure/Step/List.pm                           [devel]
 lib/Parrot/Distribution.pm                                  [devel]
 lib/Parrot/Docs/Directory.pm                                [devel]
 lib/Parrot/Docs/File.pm                                     [devel]
@@ -2773,6 +2774,7 @@
 t/compilers/tge/parser.t                                    []
 t/configure/01-options.t                                    []
 t/configure/02-messages.t                                   []
+t/configure/03-steplist.t                                   []
 t/configure/base.t                                          []
 t/configure/config_steps.t                                  []
 t/configure/configure.t                                     []

Added: trunk/lib/Parrot/Configure/Step/List.pm
==============================================================================
--- (empty file)
+++ trunk/lib/Parrot/Configure/Step/List.pm     Wed Apr 11 17:32:35 2007
@@ -0,0 +1,130 @@
+# Copyright (C) 2001-2006, The Perl Foundation.
+# $Id$
+package Parrot::Configure::Step::List;
+use strict;
+use warnings;
+use base qw( Exporter );
+our @EXPORT_OK = qw( get_steps_list );
+
+# EDIT HERE TO ADD NEW TESTS
+my @steps = qw(
+    init::manifest
+    init::defaults
+    init::install
+    init::miniparrot
+    init::hints
+    init::headers
+    inter::progs
+    inter::make
+    inter::lex
+    inter::yacc
+    auto::gcc
+    auto::msvc
+    init::optimize
+    inter::shlibs
+    inter::libparrot
+    inter::charset
+    inter::encoding
+    inter::types
+    inter::ops
+    inter::pmc
+    auto::alignptrs
+    auto::headers
+    auto::sizes
+    auto::byteorder
+    auto::va_ptr
+    auto::pack
+    auto::format
+    auto::isreg
+    auto::jit
+    gen::cpu
+    auto::funcptr
+    auto::cgoto
+    auto::inline
+    auto::gc
+    auto::memalign
+    auto::signal
+    auto::socklen_t
+    auto::env
+    auto::aio
+    auto::gmp
+    auto::readline
+    auto::gdbm
+    auto::snprintf
+    auto::perldoc
+    auto::python
+    auto::m4
+    auto::cpu
+    gen::icu
+    gen::revision
+    gen::config_h
+    gen::core_pmcs
+    gen::parrot_include
+    gen::languages
+    gen::makefiles
+    gen::platform
+    gen::config_pm
+);
+
+sub get_steps_list { return @steps; }
+
+1;
+
+#################### DOCUMENTATION ####################
+
+=head1 NAME
+
+Parrot::Configure::Step::List - Get sequence of configuration steps
+
+=head1 SYNOPSIS
+
+    use Parrot::Configure::Step::List qw( get_steps_list );
+
+    @steps = get_steps_list();
+
+=head1 DESCRIPTION
+
+Parrot::Configure::Step::List exports on demand a single subroutine,
+C<get_steps_list()>.  This subroutine returns a list of Parrot's configuration
+steps in the order in which they are to be executed.  To change the order in
+which the steps are executed, edit C<@steps> inside this module.
+
+=head1 SUBROUTINE
+
+=head2 C<get_steps_list()>
+
+=over 4
+
+=item * Purpose
+
+Provide Parrot configuration steps in their order of execution.
+
+=item * Arguments
+
+None.
+
+=item * Return Value
+
+List holding strings representing the configuration steps.
+
+=item * Comment
+
+=back
+
+=head1 NOTES
+
+The functionality in this package was transferred from F<Configure.pl> by Jim
+Keenan.
+
+=head1 SEE ALSO
+
+F<Configure.pl>.
+
+=cut
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Added: trunk/t/configure/03-steplist.t
==============================================================================
--- (empty file)
+++ trunk/t/configure/03-steplist.t     Wed Apr 11 17:32:35 2007
@@ -0,0 +1,63 @@
+#! perl
+# Copyright (C) 2007, The Perl Foundation.
+# $Id$
+# 03-steplist.t
+
+use strict;
+use warnings;
+
+BEGIN {
+    use FindBin qw($Bin);
+    use Cwd qw(cwd realpath);
+    realpath($Bin) =~ m{^(.*\/parrot)\/[^/]*\/[^/]*\/[^/]*$};
+    our $topdir = $1;
+    if ( defined $topdir ) {
+        print "\nOK:  Parrot top directory located\n";
+    }
+    else {
+        $topdir = realpath($Bin) . "/../..";
+    }
+    unshift @INC, qq{$topdir/lib};
+}
+use Test::More qw(no_plan); # tests => 10;
+use Carp;
+use_ok('Parrot::Configure::Step::List', qw|
+    get_steps_list
+| );
+
+my @steps;
+ok(@steps = get_steps_list(), "non-zero number of steps located");
+my $badsteps = 0;
+foreach my $s (@steps) {
+    $badsteps++ unless $s =~ /^(init|inter|auto|gen)::\w+$/;
+}
+is($badsteps, 0, "no bad entries found in [EMAIL PROTECTED]");
+
+pass("Completed all tests in $0");
+
+################### DOCUMENTATION ###################
+
+=head1 NAME
+
+03-steplist.t - test Parrot::Configure::Step::List
+
+=head1 SYNOPSIS
+
+    % prove t/configure/03-steplist.t
+
+=head1 DESCRIPTION
+
+The files in this directory test functionality used by F<Configure.pl>.
+
+The tests in this file test subroutines exported by
+Parrot::Configure::Step::List.
+
+=head1 AUTHOR
+
+James E Keenan
+
+=head1 SEE ALSO
+
+Parrot::Configure::Step::List, F<Configure.pl>.
+
+=cut

Reply via email to