$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
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;
$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(
# 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";
$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;