use base qw/CPANPLUS::Dist::Base/;
use CPANPLUS::Dist::Gentoo::Atom;
+use CPANPLUS::Dist::Gentoo::Guard;
use CPANPLUS::Dist::Gentoo::Maps;
=head1 NAME
=head1 VERSION
-Version 0.09
+Version 0.10
=cut
-our $VERSION = '0.09';
+our $VERSION = '0.10';
=head1 SYNOPSIS
$ cd /tmp
$ wget http://search.cpan.org/CPAN/authors/id/B/BI/BINGOS/CPANPLUS-0.9003.tar.gz
- $ wget http://search.cpan.org/CPAN/authors/id/V/VP/VPIT/CPANPLUS-Dist-Gentoo-0.09.tar.gz
+ $ wget http://search.cpan.org/CPAN/authors/id/V/VP/VPIT/CPANPLUS-Dist-Gentoo-0.10.tar.gz
Log in as root and unpack them in e.g. your home directory :
# cd
# tar xzf /tmp/CPANPLUS-0.9003.tar.gz
- # tar xzf /tmp/CPANPLUS-Dist-Gentoo-0.09.tar.gz
+ # tar xzf /tmp/CPANPLUS-Dist-Gentoo-0.10.tar.gz
Set up environment variables so that the toolchain is temporarily available :
# export OLDPATH=$PATH
# export PATH=/root/CPANPLUS-0.9003/bin:$PATH
- # export PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.09/blib/lib:/root/CPANPLUS-0.9003/lib:/root/CPANPLUS-0.9003/inc/bundle
+ # export PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.10/blib/lib:/root/CPANPLUS-0.9003/lib:/root/CPANPLUS-0.9003/inc/bundle
Make sure you don't have an old C<.cpanplus> configuration visible :
Bootstrap L<CPANPLUS> :
- # cd /root/CPANPLUS-Dist-Gentoo-0.09
+ # cd /root/CPANPLUS-Dist-Gentoo-0.10
# samples/g-cpanp CPANPLUS
Reset the environment :
At this point, you can bootstrap L<CPANPLUS::Dist::Gentoo> using the system L<CPANPLUS> :
- # PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.09/blib/lib samples/g-cpanp CPANPLUS::Dist::Gentoo
+ # PERL5LIB=/root/CPANPLUS-Dist-Gentoo-0.10/blib/lib samples/g-cpanp CPANPLUS::Dist::Gentoo
# emerge -tv CPANPLUS-Dist-Gentoo
=back
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);
+ my $meta = $self->meta;
+ $stat->min_perl(CPANPLUS::Dist::Gentoo::Maps::perl_version_c2g(
+ $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;
+
+ local $@;
+ 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 $meta = $self->meta;
+ my $license = $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;
};
my $perl = CPANPLUS::Dist::Gentoo::Atom->new(
category => 'dev-lang',
name => 'perl',
+ version => $stat->min_perl,
);
+
@requires = CPANPLUS::Dist::Gentoo::Atom->fold($perl, @requires);
my $d = $stat->header;
return CPANPLUS::Dist::Gentoo::Atom->new(
category => $last->category,
name => $last->name,
- (defined $version ? (version => $version, range => '>=') : ()),
+ version => $version,
ebuild => $last->ebuild,
);
}