From: Vincent Pit Date: Mon, 20 Sep 2010 00:24:29 +0000 (+0200) Subject: Specify configure_requires entries in DEPEND X-Git-Tag: v0.11~14 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=5af07d69e53872ebe1bdea02e0e880141eacd862;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Specify configure_requires entries in DEPEND --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 6c6ef13..d5a7b79 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -195,7 +195,7 @@ sub init { $stat->mk_accessors(qw/name version author distribution desc uri src license meta min_perl - fetched_arch requires + fetched_arch requires configure_requires ebuild_name ebuild_version ebuild_dir ebuild_file portdir_overlay overlay distdir keywords do_manifest header footer @@ -207,6 +207,32 @@ sub init { return 1; } +my $filter_prereqs = sub { + my ($int, $prereqs) = @_; + + my @requires; + for my $prereq (sort keys %$prereqs) { + next if $prereq =~ /^perl(?:-|\z)/; + + my $obj = $int->module_tree($prereq); + next unless $obj; # Not in the module tree (e.g. Config) + next if $obj->package_is_perl_core; + + my $version; + if ($prereqs->{$prereq}) { + if ($obj->installed_version && $obj->installed_version < $obj->version) { + $version = $obj->installed_version; + } else { + $version = $obj->package_version; + } + } + + push @requires, [ $obj->package_name, $version ]; + } + + return \@requires; +}; + sub prepare { my $self = shift; my $mod = $self->parent; @@ -343,26 +369,9 @@ sub prepare { $stat->license($self->intuit_license); - my $prereqs = $mod->status->requires; - my @requires; - for my $prereq (sort keys %$prereqs) { - next if $prereq =~ /^perl(?:-|\z)/; - my $obj = $int->module_tree($prereq); - next unless $obj; # Not in the module tree (e.g. Config) - next if $obj->package_is_perl_core; - { - my $version; - if ($prereqs->{$prereq}) { - if ($obj->installed_version && $obj->installed_version < $obj->version) { - $version = $obj->installed_version; - } else { - $version = $obj->package_version; - } - } - push @requires, [ $obj->package_name, $version ]; - } - } - $stat->requires(\@requires); + my $mstat = $mod->status; + $stat->configure_requires($int->$filter_prereqs($mstat->configure_requires)); + $stat->requires($int->$filter_prereqs($mstat->requires)); my $meta = $self->meta; $stat->min_perl(CPANPLUS::Dist::Gentoo::Maps::perl_version_c2g( @@ -556,25 +565,37 @@ sub ebuild_source { # We must resolve the deps now and not inside prepare because _cpan2portage # has to see the ebuilds already generated for the dependencies of the current # dist. - my @requires; - for (@{$stat->requires}) { - my $atom = $self->_cpan2portage(@$_); - unless (defined $atom) { - $self->_abort( - "Couldn't find an appropriate ebuild for $_->[0] in the portage tree" - ); - return; - } - push @requires, $atom; - } - my $perl = CPANPLUS::Dist::Gentoo::Atom->new( + my (@configure_requires, @requires); + + my @phases = ( + [ configure_requires => \@configure_requires ], + [ requires => \@requires ], + ); + + push @requires, CPANPLUS::Dist::Gentoo::Atom->new( category => 'dev-lang', name => 'perl', version => $stat->min_perl, ); - @requires = CPANPLUS::Dist::Gentoo::Atom->fold($perl, @requires); + for (@phases) { + my ($phase, $list) = @$_; + + for (@{ $stat->$phase }) { + my $atom = $self->_cpan2portage(@$_); + unless (defined $atom) { + $self->_abort( + "Couldn't find an appropriate ebuild for $_->[0] in the portage tree" + ); + return; + } + + push @$list, $atom; + } + + @$list = CPANPLUS::Dist::Gentoo::Atom->fold(@$list); + } my $d = $stat->header; $d .= "# Generated by CPANPLUS::Dist::Gentoo version $VERSION\n\n"; @@ -587,7 +608,7 @@ sub ebuild_source { $d .= 'LICENSE="|| ( ' . join(' ', sort @{$stat->license}) . " )\"\n"; $d .= 'KEYWORDS="' . join(' ', sort @{$stat->keywords}) . "\"\n"; $d .= 'RDEPEND="' . join("\n", sort @requires) . "\"\n"; - $d .= "DEPEND=\"\${RDEPEND}\"\n"; + $d .= 'DEPEND="' . join("\n", '${RDEPEND}', sort @configure_requires) . "\"\n"; $d .= "SRC_TEST=\"do\"\n"; $d .= $stat->footer;