App-CPANtoRPM
view release on metacpan or search on metacpan
lib/App/CPANtoRPM.pm view on Meta::CPAN
}
}
# For some reason, rpmdeps sometimes gives a version number
# for perl as #:xxx. Fix this
$ver =~ s/^\d+:// if ($mod eq 'perl');
foreach my $lev (@$level) {
$package{'requires'}{$lev}{$mod} = $ver;
}
} else {
$req =~ s/\s*$//;
$req =~ s/^\s*//;
if ($req =~ /^perl\((.*)\)$/) {
$req = $1;
} else {
$self->_log_message
('ERR',"Dependency malformed: $req");
}
foreach my $lev (@$level) {
$package{'requires'}{$lev}{$req} = 0;
}
}
}
}
}
############################################################################
############################################################################
# This is the most complicated step of the process. We actually need to
# build the package for the following reasons:
# o To make sure that we CAN build it non-interactively
# o To determine what the module provides for this architecture
# o To determine what the module requires for this architecture
#
# With Build.PL, it is especially complicated because we want to be able
# to override the install directories, but to do so, we want to use 'installdirs'
# from the Build.PL script. In order to not parse the file, we'll actually
# do a 'perl Build.PL' without directory arguments. This will create a
# _build/build_params file which contains the information.
sub _build {
my($self) = @_;
$self->_log_message('HEAD',"Building package: $package{dir}");
my $type = $package{'build_type'};
#
# Get the config command (perl Makefile.PL), the build command
# (make), and the install command (make install).
#
# First, we'll get the commands ignoring an alternate directory.
# We'll do this so we can figure out what installation type (if any)
# is hardcoded into the module.
#
# We'll run the configure and build commands to make sure
# everything works, and to verify where the module wants to be
# installed by default.
#
$self->_log_message('INFO',"Generating commands to build the module");
$self->_commands('',0);
my $status = $self->_run_command("$TMPDIR/config",$package{'config_cmd'});
if ($status eq 'WAITING') {
my @err = `cat "$TMPDIR/config.out"`;
chomp(@err);
$self->_log_message('ERR',
'Config command failed waiting on input.',
'Output is as follows:',
'#'x70,
@err);
} elsif ($status eq 'ERROR') {
my @err = `cat "$TMPDIR/config.err"`;
chomp(@err);
$self->_log_message('ERR',
'Config command failed with an exit code.',
'Output is as follows:',
'#'x70,
@err);
}
$status = $self->_run_command("$TMPDIR/config",$package{'build_cmd'});
if ($status eq 'WAITING') {
my @err = `cat "$TMPDIR/config.out"`;
chomp(@err);
$self->_log_message('ERR',
'Build command failed waiting on input.',
'Output is as follows:',
'#'x70,
@err);
} elsif ($status eq 'ERROR') {
my @err = `cat "$TMPDIR/config.err"`;
chomp(@err);
$self->_log_message('ERR',
'Build command failed with an exit code.',
'Output is as follows:',
'#'x70,
@err);
}
#
# We have to see if a Build.PL is Module::Build::Tiny.
#
$package{'build_tiny'} = 0;
if ($type eq 'build') {
if (-f "_build_params") {
# Module::Build::Tiny produces ./_build_params
$self->_log_message('INFO','Using Module::Build::Tiny');
$package{'build_tiny'} = 1;
} elsif (-f "_build/build_params") {
# Module::Build produces _build/build_params
$self->_log_message('INFO','Using Module::Build');
( run in 1.265 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )