CPANPLUS-Dist-Gentoo
view release on metacpan or search on metacpan
0.12 2012-06-15 10:45 UTC
+ Add : The current portage tree timestamp is now checked during
initialization against the one corresponding to the portage
tree in use when gentooisms were generated. This works best
when POSIX::strptime is installed, but it is not explicitely
required in order to keep boostrapping this module easy.
+ Chg : The default cpan-to-gentoo version mapping has been changed
to the new saner scheme now used by most ebuilds in the default
portage tree.
+ Chg : When the 'overlay' option is unspecified, it now defaults to
the first overlay listed in PORTDIR_OVERLAY.
+ Fix : Gentoo versions x.y.z.0 are now rightfully considered greater
than x.y.z.
Thanks Torsten Veller for bringing this to my attention.
+ Fix : Leading zeros in version components of Gentoo versions are now
handled correctly.
Thanks Torsten Veller for bringing this to my attention.
+ Fix : Gentoo versions with a zero as suffix or revision index are
now also handled correctly.
+ Upd : Update gentooisms.
+ Tst : t/99-kwalitee.t will be skipped when only problematic versions
or the build process is interrupted by Ctrl-C.
+ Upd : Update gentooisms.
0.09 2009-11-29 14:20 UTC
+ Add : A default header.
+ Add : Redundant dependencies are simplified to a minimal set.
+ Chg : The 'requires' dependencies now go into RDEPEND.
DEPEND is set to RDEPEND for now.
+ Doc : A section describing how to bootstrap CPANPLUS and
CPANPLUS::Dist::Gentoo has been added.
+ Fix : dist-options (like the overlay) were not correctly propagated
through recursive calls.
+ Fix : Work around Kwalitee test misfailures.
+ Upd : One more gentooism : NTLM.
0.08 2009-09-04 18:50 UTC
+ Add : Map licenses advertised in the DSLIP or the META file to their
Gentoo counterparts.
+ Chg : CPANPLUS::Dist::Gentoo has much less public methods and imports.
+ Chg : Don't generate a new ebuild if there's already one available at
prepare time (unless --force is used).
+ Chg : Generate ebuild for the current dist before recursing.
+ Fix : Prevent infinite loop when forcing a distribution with recursive
dependencies.
+ Fix : Remove duplicated dependencies from DEPEND.
+ Upd : Resources in META.yml.
+ Tst : Test gentooisms and version mappings.
0.05 2009-01-25 00:30 UTC
+ Add : Many more gentooisms, and a script to generate them.
+ Add : Get the default values of options from emerge --info's output:
- the overlay from PORTDIR_OVERLAY ;
- the keywords from ACCEPT_KEYWORDS ;
- the distdir from DISTDIR ;
- the main portage tree from PORTDIR.
+ Chg : Search in the portage tree for the category (including virtuals)
each dependency belongs, and state it explictely in the ebuild's
DEPEND. This change was made necessary because portage recently
stopped accepting non-existent atoms in || ( ) constructs.
+ Fix : Append our overlay to the ones specified in PORTDIR_OVERLAY (if
it's not listed yet) when running commands.
0.04 2008-12-06 17:05 UTC
This release was motivated by Kent Fredric's suggestions in RT #41483.
Many thanks to him.
+ Add : The --dist-opts 'header' and 'footer', that respectively prepend
and append any text to the ebuilds.
+ Add : The samples/g-cpanp shell script (don't forget to set the proper
keywords).
+ Add : Add 'SRC_TEST="do"' in the ebuids so that tests are run when
'test' is set in FEATURES.
+ Fix : Only the modules in the modules list were fetchable.
0.03 2008-11-29 18:45 UTC
+ Add : --force regenerates ebuilds.
+ Fix : Flaky perl -> portage version conversion.
+ Fix : Prerequisites weren't relinked through gentooisms.
+ Fix : Generating Manifests with user-defined distdir and overlay.
+ Upd : META.yml spec updated to 1.4.
0.02_01 2008-05-26 22:35 UTC
+ Add : The 'keywords' option.
+ Chg : From now, the portage category is perl-gcpanp, for consistency
with g-cpan.
+ Fix : Empty emerge command.
+ Fix : Missing '-C' to the uninstall command.
+ Fix : Removed an useless debug message.
VERSION
Version 0.12
SYNOPSIS
# Using default values from your make.conf
cpan2dist --format=CPANPLUS::Dist::Gentoo --buildprereq Some::Module
# Specifying your own options
cpan2dist --format=CPANPLUS::Dist::Gentoo \
--dist-opts overlay=/usr/local/portage \
--dist-opts distdir=/usr/portage/distfiles \
--dist-opts manifest=yes \
--dist-opts keywords=x86 \
--dist-opts header="# Begin" \
--dist-opts footer="# End" \
Any::Module You::Like
DESCRIPTION
This module is a CPANPLUS backend that recursively generates Gentoo
ebuilds for a given package in the default overlay, updates the
manifest, and even emerges it (together with its dependencies) if the
user requires it.
The generated ebuilds are placed into the "perl-gcpanp" category. They
favour depending on a "virtual", on "perl-core", "dev-perl" or
"perl-gcpan" (in that order) rather than "perl-gcpanp". Existing ebuilds
will be searched into the main "PORTDIR" portage tree and then into the
overlays listed in "PORTDIR_OVERLAY".
OPTIONS
You can pass specific options to cpan2dist by using the "--dist-opts"
command-line argument followed by a "key=value" pair, where "key" is the
option name and "value" is what it is set to. "--dist-opts" can be used
several times.
The valid option "key"s are :
* "manifest"
A boolean that indicates whether the Manifest file should be
generated by running "ebuild manifest" onto the generated ebuilds.
Defaults to "yes".
* "overlay"
The path of the overlay in which the generated ebuilds will be
written.
Defaults to the first overlay listed in "PORTDIR_OVERLAY" (as
returned by "emerge --info") or /usr/local/portage if this variable
is empty.
* "distdir"
The directory where "ebuild" expects to find the source tarballs.
You need write permissions on this directory.
Defaults to the value of "DISTDIR" (as returned by "emerge --info")
or /usr/portage/distfiles if this variable is empty.
Please refer to cpan2dist documentation for a complete coverage of its
abilities.
INSTALLATION
Before installing this module, you should append "perl-gcpanp" to your
/etc/portage/categories file.
You have two ways for installing this module :
* Use the perl overlay located at
<http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git>. It
contains an ebuild for CPANPLUS::Dist::Gentoo which will most likely
be up-to-date given the reactivity of Gentoo's Perl herd.
* Bootstrap an ebuild for CPANPLUS::Dist::Gentoo using itself.
First, make sure your system "perl" is 5.10 or greater, so that the
CPANPLUS toolchain is available.
$ perl -v
This is perl 5, version 12, subversion 2 (v5.12.2)...
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
our $VERSION = '0.12';
=head1 SYNOPSIS
# Using default values from your make.conf
cpan2dist --format=CPANPLUS::Dist::Gentoo --buildprereq Some::Module
# Specifying your own options
cpan2dist --format=CPANPLUS::Dist::Gentoo \
--dist-opts overlay=/usr/local/portage \
--dist-opts distdir=/usr/portage/distfiles \
--dist-opts manifest=yes \
--dist-opts keywords=x86 \
--dist-opts header="# Begin" \
--dist-opts footer="# End" \
Any::Module You::Like
=head1 DESCRIPTION
This module is a CPANPLUS backend that recursively generates Gentoo ebuilds for a given package in the default overlay, updates the manifest, and even emerges it (together with its dependencies) if the user requires it.
The generated ebuilds are placed into the C<perl-gcpanp> category.
They favour depending on a C<virtual>, on C<perl-core>, C<dev-perl> or C<perl-gcpan> (in that order) rather than C<perl-gcpanp>.
Existing ebuilds will be searched into the main C<PORTDIR> portage tree and then into the overlays listed in C<PORTDIR_OVERLAY>.
=head1 OPTIONS
You can pass specific options to L<cpan2dist> by using the C<--dist-opts> command-line argument followed by a C<key=value> pair, where C<key> is the option name and C<value> is what it is set to.
C<--dist-opts> can be used several times.
The valid option C<key>s are :
=over 4
=item *
C<manifest>
A boolean that indicates whether the F<Manifest> file should be generated by running C<ebuild manifest> onto the generated ebuilds.
Defaults to C<yes>.
=item *
C<overlay>
The path of the overlay in which the generated ebuilds will be written.
Defaults to the first overlay listed in C<PORTDIR_OVERLAY> (as returned by C<emerge --info>) or F</usr/local/portage> if this variable is empty.
=item *
C<distdir>
The directory where C<ebuild> expects to find the source tarballs.
You need write permissions on this directory.
Defaults to the value of C<DISTDIR> (as returned by C<emerge --info>) or F</usr/portage/distfiles> if this variable is empty.
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
=head1 INSTALLATION
Before installing this module, you should append C<perl-gcpanp> to your F</etc/portage/categories> file.
You have two ways for installing this module :
=over 4
=item *
Use the perl overlay located at L<http://git.overlays.gentoo.org/gitweb/?p=proj/perl-overlay.git>.
It contains an ebuild for L<CPANPLUS::Dist::Gentoo> which will most likely be up-to-date given the reactivity of Gentoo's Perl herd.
=item *
Bootstrap an ebuild for L<CPANPLUS::Dist::Gentoo> using itself.
First, make sure your system C<perl> is C<5.10> or greater, so that the L<CPANPLUS> toolchain is available.
$ perl -v
This is perl 5, version 12, subversion 2 (v5.12.2)...
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
=head1 METHODS
This module inherits all the methods from L<CPANPLUS::Dist::Base>.
Please refer to its documentation for precise information on what's done at each step.
=cut
use constant CATEGORY => 'perl-gcpanp';
my $overlays;
my $default_keywords;
my $default_distdir;
my $main_portdir;
my %dependencies;
my %forced;
my $unquote = sub {
my $s = shift;
$s =~ s/^["']*//;
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
{
my $buffers;
my ($success, $errmsg) = IPC::Cmd::run(
command => [ qw<emerge --info> ],
verbose => 0,
buffer => \$buffers,
);
if ($success) {
if ($buffers =~ /^PORTDIR_OVERLAY=(.*)$/m) {
$overlays = [ map Cwd::abs_path($_), split ' ', $unquote->($1) ];
}
if ($buffers =~ /^ACCEPT_KEYWORDS=(.*)$/m) {
$default_keywords = [ split ' ', $unquote->($1) ];
}
if ($buffers =~ /^DISTDIR=(.*)$/m) {
$default_distdir = Cwd::abs_path($unquote->($1));
}
if ($buffers =~ /^PORTDIR=(.*)$/m) {
$main_portdir = Cwd::abs_path($unquote->($1));
}
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
my ($self) = @_;
my $stat = $self->status;
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 configure_requires recursive_requires
ebuild_name ebuild_version ebuild_dir ebuild_file
portdir_overlay overlay distdir keywords do_manifest header footer
force verbose
>);
$stat->force($conf->get_conf('force'));
$stat->verbose($conf->get_conf('verbose'));
return 1;
}
my $filter_prereqs = sub {
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
$stat->header($header);
my $footer = delete $opts{footer};
if (defined $footer) {
$footer = "\n" . $footer;
} else {
$footer = '';
}
$stat->footer($footer);
my $overlay = delete $opts{overlay};
if (defined $overlay) {
$overlay = Cwd::abs_path($overlay);
} else {
$overlay = $overlays->[0];
$overlay = '/usr/local/portage' unless defined $overlay;
}
$stat->overlay($overlay);
my $distdir = delete $opts{distdir};
$distdir = (defined $distdir) ? Cwd::abs_path($distdir) : $default_distdir;
$stat->distdir($distdir);
return $FAIL->("distdir isn't writable") if $stat->do_manifest && !-w $distdir;
$stat->fetched_arch($mod->status->fetch);
my $cur = File::Spec->curdir();
my $portdir_overlay;
for (@$overlays) {
if ($_ eq $overlay or File::Spec->abs2rel($overlay, $_) eq $cur) {
$portdir_overlay = [ @$overlays ];
last;
}
}
$portdir_overlay = [ @$overlays, $overlay ] unless $portdir_overlay;
$stat->portdir_overlay($portdir_overlay);
my $name = $mod->package_name;
$stat->name($name);
my $version = $mod->package_version;
$stat->version($version);
my $author = $mod->author->cpanid;
$stat->author($author);
$stat->distribution($name . '-' . $version);
$stat->ebuild_version(CPANPLUS::Dist::Gentoo::Maps::version_c2g($name, $version));
$stat->ebuild_name(CPANPLUS::Dist::Gentoo::Maps::name_c2g($name));
$stat->ebuild_dir(File::Spec->catdir(
$stat->overlay,
CATEGORY,
$stat->ebuild_name,
));
my $file = File::Spec->catfile(
$stat->ebuild_dir,
$stat->ebuild_name . '-' . $stat->ebuild_version . '.ebuild',
);
$stat->ebuild_file($file);
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
return $d;
}
sub _cpan2portage {
my ($self, $dist_name, $dist_version) = @_;
my $name = CPANPLUS::Dist::Gentoo::Maps::name_c2g($dist_name);
my $version = CPANPLUS::Dist::Gentoo::Maps::version_c2g($dist_name, $dist_version);
my @portdirs = ($main_portdir, @{$self->status->portdir_overlay});
for my $category (qw<virtual perl-core dev-perl perl-gcpan>, CATEGORY) {
my $name = ($category eq 'virtual' ? 'perl-' : '') . $name;
for my $portdir (@portdirs) {
my @ebuilds = glob File::Spec->catfile(
$portdir,
$category,
$name,
"$name-*.ebuild",
lib/CPANPLUS/Dist/Gentoo.pm view on Meta::CPAN
$stat->uninstalled($success);
return $success;
}
sub _run {
my ($self, $cmd, $verbose) = @_;
my $stat = $self->status;
my ($success, $errmsg, $output) = do {
local $ENV{PORTDIR_OVERLAY} = join ' ', @{$stat->portdir_overlay};
local $ENV{PORTAGE_RO_DISTDIRS} = $stat->distdir;
IPC::Cmd::run(
command => $cmd,
verbose => $verbose,
);
};
unless ($success) {
$self->_abort($errmsg);
if (not $verbose and defined $output and $stat->verbose) {
( run in 0.397 second using v1.01-cache-2.11-cpan-49f99fa48dc )