Perl2Package
view release on metacpan or search on metacpan
lib/Distribution/RPM.pm view on Meta::CPAN
quotemeta($mo)) : ""));
foreach my $opttype ("makemakeropts", "makeperlopts") {
my @mmo=();
CASE:{
($#{$self->{"$opttype"}} > -1) and do {
foreach my $opt (@{$self->{"$opttype"}}) {
# $mmo =~ s/\n\t/ /sg; #allow through newlines???
$opt=quotemeta(quotemeta $opt);
$opt= "--$opttype=" . $opt ;
push @mmo, $opt;
}
$specs .= "%define $opttype ".join (" ",@mmo). " \n";
last;
};
$specs .= "%define $opttype \"\"\n";
}
}
my $setup_dir = $self->{'setup-dir'} eq $self->{'default_setup_dir'} ?
"" : " --setup-dir=$self->{'setup-dir'}";
my $makerpm_path = File::Spec->catdir('$RPM_SOURCE_DIR', 'makerpm.pl');
$makerpm_path = File::Spec->canonpath($makerpm_path) . $setup_dir .
" --source=$self->{'source'}";
$self->{"description"} = $self->{'summary'}
unless $self->{'description'};
my $prefix='';
$prefix="perl-" if ($self->{'name-prefix'});
$specs .= <<"EOF";
Name: $prefix%{packagename}
Version: %{packageversion}
Release: %{release}
Group: $self->{'rpm-group'}
Source: $self->{'source'}
License: $self->{'copyright'}
BuildRoot: $self->{'build-root'}
Provides: $prefix%{packagename}
Summary: $self->{'summary'}
EOF
#this is something added to mirror the RedHat generated spec files..
#I think it makes sense, though maybe the version number is too
#strict?? - Michael
$specs .= <<"EOF" if $self->{"rpm-version"} > 4;
BuildRequires: perl >= 5.6
Requires: perl >= 5.6
EOF
if (my $req = $self->{'require'}) {
$specs .= "Requires: " . join(" ", @$req) . "\n";
}
my $runtests = $self->{'runtests'} ? " --runtests" : "";
#Normally files should be owned by root. If we are non root
#then we can't do chowns (on any civilised operating system
#;-) so we have to fix the ownership with a command.
# This is a warning because there might be modules which might
# install their own userid for security reasons or set files
# to other ownership's deliberately. It is the responsibility
# of the packager to be aware of this.
my $defattr;
if ($self->{'defattr'}) {
$defattr="";
} else {
warn "using Defattr to force all files to root ownership\n";
$defattr = "%defattr(-,root,root)";
}
use vars qw/$prep_script $build_script $install_script
$clean_script $pre_script $post_script
$preun_script $postun_script $verify_script/;
my @scripts = ("prep", "build", "install", "clean", "pre",
"post","preun", "postun", "verify" );
foreach my $script ( @scripts ) {
no strict "refs"; #makes for an easier life..
my $var = $script . "_script";
$$var = $self->ReadConfigFile($script . ".sh") ;
}
my $doclist = $self->ReadConfigFile("docfiles") ;
$doclist = $self->AutoDocs() unless $doclist ;
$doclist = "" unless $doclist;
$specs .= <<"EOF";
%description
$self->{'description'}
EOF
$specs .= <<"EOF" if $self->{'find-requires'};
# Provide perl-specific find-{provides,requires}.
%define __find_provides /usr/lib/rpm/find-provides.perl
%define __find_requires /usr/lib/rpm/find-requires.perl
EOF
$specs .= <<"EOF";
%prep
EOF
$specs .= <<"EOF" ;
%setup -q -n $self->{'setup-dir'}
EOF
#FIXME we haven't actually checked that a file would be removed
#so this might give an error at prep time?
$specs .= <<"EOF" if $self->{'rm-files'};
find $self->{'setup-dir'} -regex '$self->{'rm-files'} ' -print0 | xargs -0 rm
EOF
$specs .= <<"EOF" ;
$prep_script
%build
( run in 0.620 second using v1.01-cache-2.11-cpan-5511b514fd6 )