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=40817.  This will log files
created during configuration in new file MANIFEST.configure.generated.


git-svn-id: https://svn.parrot.org/parrot/trunk@26761 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
jkeenan committed Apr 5, 2008
1 parent 6bf5194 commit 7bb2d0e
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 11 deletions.
1 change: 1 addition & 0 deletions Configure.pl
Expand Up @@ -58,6 +58,7 @@

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

# build tests will only be run if you requested them
Expand Down
1 change: 1 addition & 0 deletions config/gen/config_h.pm
Expand Up @@ -48,6 +48,7 @@ sub runstep {
);

my $hh = "include/parrot/has_header.h";
$conf->append_configure_log($hh);
open( my $HH, ">", "$hh.tmp" )
or die "Can't open has_header.h: $!";

Expand Down
13 changes: 9 additions & 4 deletions config/gen/config_pm.pm
Expand Up @@ -19,6 +19,7 @@ use strict;
use warnings;

use base qw(Parrot::Configure::Step);
use Parrot::Configure::Utils ':gen';

use Cwd qw(cwd);
use File::Spec::Functions qw(catdir);
Expand Down Expand Up @@ -46,8 +47,10 @@ sub runstep {
mkdir $configdir
or die "Can't create dir $configdir: $!";
}
open( my $OUT, ">", "lib/Parrot/Config/Generated.pm" )
or die "Can't open lib/Parrot/Config/Generated.pm: $!";
my $gen_pm = q{lib/Parrot/Config/Generated.pm};
$conf->append_configure_log($gen_pm);
open( my $OUT, ">", $gen_pm )
or die "Can't open $gen_pm: $!";

print {$OUT} "# Generated by config/gen/config_pm.pm\n";

Expand All @@ -62,7 +65,9 @@ sub runstep {

my $template = "config/gen/config_pm/config_lib.in";
open( $IN, "<", $template ) or die "Can't open '$template': $!";
open( $OUT, ">", "config_lib.pasm" ) or die "Can't open config_lib.pasm: $!";
my $c_l_pasm = q{config_lib.pasm};
$conf->append_configure_log($c_l_pasm);
open( $OUT, ">", $c_l_pasm ) or die "Can't open $c_l_pasm: $!";

print {$OUT} <<"END";
# Generated by config/gen/config_pm.pm from the template
Expand Down Expand Up @@ -95,7 +100,7 @@ END
}

close $IN or die "Can't close config_lib.in: $!";
close $OUT or die "Can't close config_lib.pasm: $!";
close $OUT or die "Can't close $c_l_pasm: $!";

return 1;
}
Expand Down
3 changes: 3 additions & 0 deletions config/gen/core_pmcs.pm
Expand Up @@ -43,6 +43,7 @@ sub generate_h {
my ( $self, $conf ) = @_;

my $file = "include/parrot/core_pmcs.h";
$conf->append_configure_log($file);
open( my $OUT, ">", "$file.tmp" );

print {$OUT} <<"END_H";
Expand Down Expand Up @@ -95,6 +96,7 @@ sub generate_c {
my $file = "src/core_pmcs.c";
my @pmcs = split( / /, $conf->data->get('pmc_names') );

$conf->append_configure_log($file);
open( my $OUT, ">", "$file.tmp" );

print {$OUT} <<"END_C";
Expand Down Expand Up @@ -180,6 +182,7 @@ sub generate_pm {
my $file = "lib/Parrot/PMC.pm";
my @pmcs = split( / /, $conf->data->get('pmc_names') );

$conf->append_configure_log($file);
open( my $OUT, ">", "$file.tmp" );

print $OUT <<'END_PM';
Expand Down
1 change: 1 addition & 0 deletions config/gen/makefiles.pm
Expand Up @@ -76,6 +76,7 @@ sub runstep {
my ( $self, $conf ) = @_;

$self->makefiles($conf);
$conf->append_configure_log('docs/Makefile');
$self->cflags($conf);

return 1;
Expand Down
3 changes: 2 additions & 1 deletion config/gen/makefiles/root.in
Expand Up @@ -224,7 +224,8 @@ STICKY_FILES = \
$(GEN_MAKEFILES) \
ext/Parrot-Embed/Makefile.PL \
myconfig \
$(GEN_PASM_INCLUDES)
$(GEN_PASM_INCLUDES) \
MANIFEST.configure.generated


###############################################################################
Expand Down
1 change: 1 addition & 0 deletions config/gen/parrot_include.pm
Expand Up @@ -158,6 +158,7 @@ sub runstep {
$conf->options->get('verbose') and print "$target ";
my $gen = join "\n",
( $target =~ /\.pl$/ ? \&const_to_perl : \&const_to_parrot )->(@defs);
$conf->append_configure_log(qq{$destdir/$target});
my $target_tmp = "$target.tmp";
open my $out, '>', $target_tmp or die "Can't open $target_tmp: $!\n";

Expand Down
14 changes: 9 additions & 5 deletions config/gen/platform.pm
Expand Up @@ -19,7 +19,7 @@ use warnings;

use base qw(Parrot::Configure::Step);

use Parrot::Configure::Utils qw(copy_if_diff);
use Parrot::Configure::Utils ':gen';

sub _init {
my $self = shift;
Expand Down Expand Up @@ -74,8 +74,10 @@ CODA
string.h
/;

open my $PLATFORM_H, ">", "include/parrot/platform.h"
or die "Can't open include/parrot/platform.h: $!";
my $plat_h = q{include/parrot/platform.h};
$conf->append_configure_log($plat_h);
open my $PLATFORM_H, ">", $plat_h
or die "Can't open $plat_h: $!";

print {$PLATFORM_H} <<"END_HERE";
/* ex: set ro:
Expand Down Expand Up @@ -176,8 +178,10 @@ END_HERE
misc.c
/;

open my $PLATFORM_C, ">", "src/platform.c"
or die "Can't open src/platform.c: $!";
my $plat_c = q{src/platform.c};
$conf->append_configure_log($plat_c);
open my $PLATFORM_C, ">", $plat_c
or die "Can't open $plat_c: $!";

print {$PLATFORM_C} <<"END_HERE";
/*
Expand Down
2 changes: 2 additions & 0 deletions config/init/manifest.pm
Expand Up @@ -19,6 +19,7 @@ use warnings;
use base qw(Parrot::Configure::Step);

use Parrot::Configure::Step;
use Parrot::Configure::Utils ':gen';
use ExtUtils::Manifest qw(manicheck);


Expand All @@ -33,6 +34,7 @@ sub _init {
sub runstep {
my ( $self, $conf ) = @_;

$conf->append_configure_log('MANIFEST.configure.generated');
if ( $conf->options->get('nomanicheck') ) {
$self->set_result('skipped');
return 1;
Expand Down
19 changes: 19 additions & 0 deletions lib/Parrot/Configure/Compiler.pm
Expand Up @@ -258,6 +258,11 @@ sub genfile {
my $conf = shift;
my ( $source, $target, %options ) = @_;

my $calling_sub = (caller(1))[3] || q{};
if ( $calling_sub !~ /cc_gen$/ ) {
$conf->append_configure_log($target);
}

open my $in, '<', $source or die "Can't open $source: $!";
open my $out, '>', "$target.tmp" or die "Can't open $target.tmp: $!";

Expand Down Expand Up @@ -303,7 +308,9 @@ sub genfile {

# OUT was/is used at the output filehandle in eval'ed scripts
# e.g. feature.pl or feature_h.in
no warnings 'once';
local *OUT = $out;
use warnings;
my $text = do { local $/; <$in> };

# interpolate @foo@ values
Expand Down Expand Up @@ -418,6 +425,18 @@ sub genfile {
move_if_diff( "$target.tmp", $target, $options{ignore_pattern} );
}

sub append_configure_log {
my $conf = shift;
my $target = shift;
if ( $conf->{active_configuration} ) {
my $generated_log = 'MANIFEST.configure.generated';
open my $GEN, '>>', $generated_log
or die "Can't open $generated_log for appending: $!";
print $GEN "$target\n";
close $GEN or die "Can't close $generated_log after appending: $!";
}
}

=head1 SEE ALSO
=over 4
Expand Down
4 changes: 3 additions & 1 deletion lib/Parrot/Configure/Utils.pm
Expand Up @@ -44,7 +44,7 @@ our %EXPORT_TAGS = (
auto => [
qw(capture_output check_progs)
],
gen => [qw(copy_if_diff move_if_diff)]
gen => [qw( copy_if_diff move_if_diff )]
);

=item C<_run_command($command, $out, $err)>
Expand Down Expand Up @@ -311,6 +311,8 @@ sub _slurp {

=back
=cut

=head1 SEE ALSO
=over 4
Expand Down

0 comments on commit 7bb2d0e

Please sign in to comment.