Skip to content

Commit

Permalink
Applying patch submitted in
Browse files Browse the repository at this point in the history
http://rt.perl.org/rt3//Ticket/Display.html?id=42777:  "Configure.pl and
underlying packages: Eliminate temporary hack."
Hack described in Configure.pl and found in Parrot::Configure::Step is fixed
by making Parrot::Configure object into a singleton.  This entailed changes in
those two packages as well as config/init/defaults.pm.

Also:  Parrot::Configure::Data::slurp() now checks Parrot::Config::Generated
rather than Parrot::Config to determine if configuration has been completed.

12 test files added to directory t/configure; t/configure/configure.t
eliminated because it assumed non-singleton Parrot::Configure object.  7 .pm
files added for testing in new directory t/configure/testlib/.  1 new test
file added to new directory t/postconfigure/, which will house tests
pertaining to configuration that can only be run once Configure.pl has been
executed.  'postconfigure' added to @default_tests in t/harness.  MANIFEST
updated to reflect new files and one deletion.

Application of this patch results in same %Parrot::Config::Generated::PConfig
as previous version of Configure.pl and associated files.  All tests in 'make
test' pass.


git-svn-id: https://svn.parrot.org/parrot/trunk@18405 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
jkeenan committed May 3, 2007
1 parent 9e350cf commit 25830bb
Show file tree
Hide file tree
Showing 29 changed files with 1,966 additions and 336 deletions.
41 changes: 19 additions & 22 deletions Configure.pl
Expand Up @@ -257,6 +257,8 @@ =head1 SEE ALSO
use 5.006_001;
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent = 1;
use lib 'lib';

use Parrot::BuildUtil;
Expand All @@ -268,11 +270,9 @@ =head1 SEE ALSO
);
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();
our @parrot_version = Parrot::BuildUtil::parrot_version();
my $parrot_version = Parrot::BuildUtil::parrot_version();

$| = 1;
$| = 1; # $OUTPUT_AUTOFLUSH = 1;

# Install Option text was taken from:
#
Expand All @@ -284,14 +284,12 @@ =head1 SEE ALSO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# from Parrot::Configure::Options
my $args = process_options(
{
argv => [@ARGV],
script => $0,
parrot_version => $parrot_version,
svnid => '$Id$',
}
);
my $args = process_options( {
argv => [ @ARGV ],
script => $0,
parrot_version => $parrot_version,
svnid => '$Id$',
} );
exit unless defined $args;

my %args = %$args;
Expand All @@ -300,40 +298,39 @@ =head1 SEE ALSO
print_introduction($parrot_version);

my $conf = Parrot::Configure->new;
{

# RT#41201 $Parrot::Configure::Step::conf is a temporary hack
no warnings qw(once);
$Parrot::Configure::Step::conf = $conf;
}

# from Parrot::Configure::Step::List
$conf->add_steps(get_steps_list());

# from Parrot::Configure::Data
$conf->options->set(%args);

if ( exists $args{step} ) {
# from Parrot::Configure::Data
$conf->data()->slurp();
# from Parrot::Configure
$conf->runstep( $args{step} );
print "\n";
exit(0);
}
else {

# Run the actual steps
# from Parrot::Configure
$conf->runsteps or exit(1);
}

# tell users what to do next

# from Parrot::Configure::Messages
print_conclusion( $conf->data->get('make') );
print_conclusion($conf->data->get('make'));

exit(0);

################### DOCUMENTATION ###################


# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4:

22 changes: 21 additions & 1 deletion MANIFEST
Expand Up @@ -2792,11 +2792,31 @@ t/compilers/tge/parser.t []
t/configure/01-options.t []
t/configure/02-messages.t []
t/configure/03-steplist.t []
t/configure/04-configure.t []
t/configure/05-run_one_step.t []
t/configure/06-bad_step.t []
t/configure/07-verbose_two.t []
t/configure/08-verbose_step_number.t []
t/configure/09-verbose_step_regex.t []
t/configure/10-verbose_step_number_not_called.t []
t/configure/11-no_description.t []
t/configure/12-verbose.t []
t/configure/13-die.t []
t/configure/14-params.t []
t/configure/15-no_return.t []
t/configure/16-no_return_but_result.t []
t/configure/base.t []
t/configure/config_steps.t []
t/configure/configure.t []
t/configure/data.t []
t/configure/step.t []
t/configure/testlib/init/alpha.pm []
t/configure/testlib/init/beta.pm []
t/configure/testlib/init/delta.pm []
t/configure/testlib/init/epsilon.pm []
t/configure/testlib/init/foobar.pm []
t/configure/testlib/init/gamma.pm []
t/configure/testlib/init/zeta.pm []
t/postconfigure/01-data_slurp.t []
t/distro/file_metadata.t []
t/distro/manifest.t []
t/distro/manifest_skip.t []
Expand Down
12 changes: 8 additions & 4 deletions config/init/defaults.pm
Expand Up @@ -22,13 +22,17 @@ use base qw(Parrot::Configure::Step::Base);
use Config;
use FindBin; # see build_dir
use Parrot::Configure::Step;
use Parrot::BuildUtil;
use Cwd qw(abs_path);
use File::Spec;

$description = q{Setting up Configure's default values};

@args = qw(debugging optimize profile verbose m);

my $parrot_version = Parrot::BuildUtil::parrot_version();
my @parrot_version = Parrot::BuildUtil::parrot_version();

sub runstep {
my ( $self, $conf ) = @_;

Expand Down Expand Up @@ -169,10 +173,10 @@ sub runstep {
lns => $Config{lns}, # soft link
slash => '/',

VERSION => $main::parrot_version,
MAJOR => $main::parrot_version[0],
MINOR => $main::parrot_version[1],
PATCH => $main::parrot_version[2],
VERSION => $parrot_version,
MAJOR => $parrot_version[0],
MINOR => $parrot_version[1],
PATCH => $parrot_version[2],
DEVEL => ( -e 'DEVELOPING' ? '-devel' : '' ),

configdate => scalar gmtime() . " GMT",
Expand Down
53 changes: 26 additions & 27 deletions lib/Parrot/Configure.pm
@@ -1,8 +1,6 @@
# Copyright (C) 2001-2006, The Perl Foundation.
# $Id$

=pod
=head1 NAME
Parrot::Configure - Conducts the execution of Configuration Steps
Expand Down Expand Up @@ -67,18 +65,19 @@ Accepts no arguments and returns a L<Parrot::Configure> object.
=cut

sub new {
my $class = shift;

my $self = {
my $singleton;
BEGIN {
$singleton = {
steps => [],
data => Parrot::Configure::Data->new,
options => Parrot::Configure::Data->new,
};
bless $singleton, "Parrot::Configure";
}

bless $self, ref $class || $class;

return $self;
sub new {
my $class = shift;
return $singleton;
}

=back
Expand Down Expand Up @@ -136,11 +135,12 @@ sub steps {

=item * C<add_step()>
Registers a new step and any parameters that should be passed to it. With the
first parameter being the class name of the step register. All other
parameters are saved and passed to the registered class's C<runstep()> method.
Registers a new step and any parameters that should be passed to it. The
first parameter passed is the class name of the step being registered. All
other parameters are saved and passed to the registered class's C<runstep()>
method.
Accepts a list and returns a L<Parrot::Configure> object.
Accepts a list and modifies the data structure within the L<Parrot::Configure> object.
=cut

Expand All @@ -149,14 +149,14 @@ sub add_step {

push @{ $self->{steps} }, Parrot::Configure::Task->new( step => $step, params => \@params );

return $self;
return 1;
}

=item * C<add_steps()>
Registers a new step to be run at the end of the execution queue.
Registers new steps to be run at the end of the execution queue.
Accepts a list and returns a L<Parrot::Configure> object.
Accepts a list of new steps and modifies the data structure within the L<Parrot::Configure> object.
=cut

Expand All @@ -167,17 +167,17 @@ sub add_steps {
$self->add_step($step);
}

return $self;
return 1;
}

=item * C<runsteps()>
Sequentially executes step in the order they were registered. The invoking
L<Parrot::Configure> object is passed as the first argument to each steps
C<runstep()> method followed by any parameters that were registered for that
Sequentially executes steps in the order they were registered. The invoking
L<Parrot::Configure> object is passed as the first argument to each step's
C<runstep()> method, followed by any parameters that were registered for that
step.
Accepts no arguments and returns a L<Parrot::Configure> object.
Accepts no arguments and modifies the data structure within the L<Parrot::Configure> object.
=cut

Expand All @@ -191,17 +191,16 @@ sub runsteps {
$n++;
$self->_runstep( $task, $verbose, $verbose_step, $ask, $n );
}
return $self;
return 1;
}

=item * C<runstep()>
The invoking
L<Parrot::Configure> object is passed as the first argument to each steps
C<runstep()> method followed by any parameters that were registered for that
step.
The invoking L<Parrot::Configure> object is passed as the first argument to
each step's C<runstep()> method, followed by any parameters that were
registered for that step.
Accepts no arguments and returns a L<Parrot::Configure> object.
Accepts no arguments and modifies the data structure within the L<Parrot::Configure> object.
=cut

Expand Down
2 changes: 1 addition & 1 deletion lib/Parrot/Configure/Data.pm
Expand Up @@ -177,7 +177,7 @@ Accepts no arguments.

sub slurp() {
my $self = shift;
my $res = eval "no strict; use Parrot::Config; \\%PConfig";
my $res = eval "no strict; use Parrot::Config::Generated; \\%PConfig";

if ( not defined $res ) {
die "You cannot use --step until you have completed the full configure process\n";
Expand Down
5 changes: 3 additions & 2 deletions lib/Parrot/Configure/Step.pm
Expand Up @@ -33,9 +33,10 @@ use File::Basename qw( basename );
use File::Copy ();
use File::Spec;
use File::Which;
use lib ("lib");
use Parrot::Configure;

# XXX $conf is a temporary hack
our $conf;
my $conf = Parrot::Configure->new();

our @EXPORT = ();
our @EXPORT_OK = qw(prompt genfile copy_if_diff move_if_diff integrate
Expand Down

0 comments on commit 25830bb

Please sign in to comment.