use base qw/CPANPLUS::Dist::Base/;
use CPANPLUS::Dist::Gentoo::Atom;
+use CPANPLUS::Dist::Gentoo::Guard;
use CPANPLUS::Dist::Gentoo::Maps;
=head1 NAME
my $conf = $self->parent->parent->configure_object;
$stat->mk_accessors(qw/name version author distribution desc uri src license
+ meta min_perl
fetched_arch requires
ebuild_name ebuild_version ebuild_dir ebuild_file
portdir_overlay
}
$stat->requires(\@requires);
+ $stat->min_perl(CPANPLUS::Dist::Gentoo::Maps::perl_version_c2g(
+ eval { $self->meta->{requires}->{perl} }
+ ));
+
return $OK->();
}
+=head2 C<meta>
+
+Returns the contents of the F<META.yml> or F<META.json> files as parsed by L<Parse::CPAN::Meta>.
+
+=cut
+
+sub meta {
+ my $self = shift;
+ my $mod = $self->parent;
+ my $stat = $self->status;
+
+ my $meta = $stat->meta;
+ return $meta if defined $meta;
+
+ my $extract_dir = $mod->status->extract;
+
+ for my $name (qw/META.json META.yml/) {
+ my $meta_file = File::Spec->catdir($extract_dir, $name);
+ next unless -e $meta_file;
+
+ my $meta = eval { Parse::CPAN::Meta::LoadFile($meta_file) };
+ if (defined $meta) {
+ $stat->meta($meta);
+ return $meta;
+ }
+ }
+
+ return;
+}
+
=head2 C<intuit_license>
Returns an array reference to a list of Gentoo licences identifiers under which the current distribution is released.
return \@licenses if @licenses;
}
- my $extract_dir = $mod->status->extract;
-
- for my $meta_file (qw/META.json META.yml/) {
- my $meta = eval {
- Parse::CPAN::Meta::LoadFile(File::Spec->catdir(
- $extract_dir,
- $meta_file,
- ));
- } or next;
- my $license = $meta->{license};
- if (defined $license) {
- my @licenses = CPANPLUS::Dist::Gentoo::Maps::license_c2g($license);
- return \@licenses if @licenses;
- }
+ my $license = $self->meta->{license};
+ if (defined $license) {
+ my @licenses = CPANPLUS::Dist::Gentoo::Maps::license_c2g($license);
+ return \@licenses if @licenses;
}
return [ CPANPLUS::Dist::Gentoo::Maps::license_c2g('perl') ];
my $file;
+ my $guard = CPANPLUS::Dist::Gentoo::Guard->new(sub {
+ if (defined $file and -e $file and -w _) {
+ 1 while unlink $file;
+ }
+ });
+
+ my $SIG_INT = $SIG{INT};
+ local $SIG{INT} = sub {
+ if ($SIG_INT) {
+ local $@;
+ eval { $SIG_INT->() };
+ die $@ if $@;
+ }
+ die 'Caught SIGINT';
+ };
+
my $OK = sub {
+ $guard->unarm;
$stat->created(1);
$stat->dist($file) if defined $file;
1;
$stat->created(0);
$stat->dist(undef);
$self->_abort(@_) if @_;
- if (defined $file and -f $file) {
- 1 while unlink $file;
- }
0;
};
push @requires, $atom;
}
+ my $min_perl = $stat->min_perl;
my $perl = CPANPLUS::Dist::Gentoo::Atom->new(
category => 'dev-lang',
name => 'perl',
+ (defined $min_perl ? (version => $min_perl, range => '>=') : ()),
);
+
@requires = CPANPLUS::Dist::Gentoo::Atom->fold($perl, @requires);
my $d = $stat->header;