Perl-Dist-WiX
view release on metacpan or search on metacpan
lib/Perl/Dist/WiX.pm view on Meta::CPAN
#
=head2 Methods used by C<run> in the tasklist.
my $dist = Perl::Dist::WiX->new(
tasklist => [
'final_initialization',
...
],
...
);
These methods are used in the tasklist, along with other methods that
are defined by C<Perl::Dist::WiX> or its subclasses.
=head3 final_initialization
The C<final_initialization> routine does the initialization that is
required after the object representing a distribution has been created, but
before files can be installed.
=cut
sub final_initialization {
my $self = shift;
# Check for architectures that we can't build 64-bit on.
if ( 64 == $self->bits() ) {
$self->_check_64_bit();
}
if ( $self->use_dll_relocation()
and $self->relocatable()
and not $self->can('msm_relocation_idlist') )
{
PDWiX::Parameter->throw(
parameter => 'use_dll_relocation: Cannot use DLL relocation'
. ' without a relocation file id being available '
. '(set this parameter to 0)',
where => '->final_initialization',
);
}
# Redirect $ENV{TEMP} to within our build directory.
$self->trace_line( 1,
"Emptying the directory to redirect \$ENV{TEMP} to...\n" );
$self->remake_path( $self->tempenv_dir() );
## no critic (RequireLocalizedPunctuationVars)
$ENV{TEMP} = $self->tempenv_dir();
$self->trace_line( 5, 'Emptied: ' . $self->tempenv_dir() . "\n" );
### *** TODO: Move AppData/.cpan/CPAN/MyConfig.pm out of the way. ***
# If we have a file:// url for the CPAN, move the
# sources directory out of the way.
if ( $self->cpan()->as_string() =~ m{\Afile://}mxsi ) {
if ( not $CPAN::Config_loaded++ ) {
CPAN::HandleConfig->load();
}
my $cpan_path_from = $CPAN::Config->{'keep_source_where'};
my $cpan_path_to =
rel2abs( catdir( $cpan_path_from, q{..}, 'old_sources' ) );
$self->trace_line( 0, "Moving CPAN sources files:\n" );
$self->trace_line( 2, <<"EOF");
From: $cpan_path_from
To: $cpan_path_to
EOF
File::Copy::Recursive::move( $cpan_path_from, $cpan_path_to );
$self->_set_cpan_sources_from($cpan_path_from);
$self->_set_cpan_sources_to($cpan_path_to);
$self->_move_cpan();
} ## end if ( $self->cpan()->as_string...)
# Do some sanity checks.
if ( $self->cpan()->as_string() !~ m{\/\z}ms ) {
PDWiX::Parameter->throw(
parameter => 'cpan: Missing trailing slash',
where => '->final_initialization'
);
}
if ( $self->build_dir() =~ /\s/ms ) {
PDWiX::Parameter->throw(
parameter => 'build_dir: Spaces are not allowed',
where => '->final_initialization'
);
}
# Handle portable special cases
if ( $self->portable() ) {
$self->_set_exe(0);
$self->_set_msi(0);
if ( not $self->zip() ) {
PDWiX->throw('Cannot be portable and not build a .zip');
}
}
# Making sure that this is set.
$self->_set_in_merge_module(1);
## no critic(ProtectPrivateSubs)
# Set up element collections, starting with the directory tree.
$self->trace_line( 2, "Creating in-memory directory tree...\n" );
Perl::Dist::WiX::DirectoryTree->_clear_instance();
$self->_set_directories(
Perl::Dist::WiX::DirectoryTree->new(
app_dir => $self->image_dir(),
app_name => $self->app_name(),
)->initialize_tree(
$self->perl_version(), $self->bits(), $self->gcc_version() ) );
# Create an environment fragment.
$self->_add_fragment( 'Environment',
Perl::Dist::WiX::Fragment::Environment->new() );
# Add directories that need created.
$self->_add_fragment(
'CreateCpan',
Perl::Dist::WiX::Fragment::CreateFolder->new(
directory_id => 'Cpan',
id => 'CPANFolder',
) );
$self->_add_fragment(
'CreateCpanSources',
Perl::Dist::WiX::Fragment::CreateFolder->new(
directory_id => 'CpanSources',
id => 'CPANSourcesFolder',
) );
$self->_add_fragment(
'CreatePerl',
Perl::Dist::WiX::Fragment::CreateFolder->new(
( run in 2.057 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )