From: Vincent Pit Date: Sun, 16 Aug 2009 15:39:11 +0000 (+0200) Subject: Put the update Manifest logic into its own update_manifest() method X-Git-Tag: v0.08~16 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=29445aa70c5502e06d4ed53334e650a33b2efc28;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Put the update Manifest logic into its own update_manifest() method --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 7fab73a..d5d87c4 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -348,23 +348,39 @@ sub create { $self->SUPER::create(@_); - if ($stat->do_manifest) { - unless (File::Copy::copy($stat->fetched_arch => $stat->distdir)) { - error "Couldn\'t copy the distribution file to distdir ($!) -- aborting"; - 1 while unlink $file; - return $FAIL->(); - } - - msg 'Adding Manifest entry for ' . $stat->distribution; - unless ($self->_run([ 'ebuild', $file, 'manifest' ], 0)) { - 1 while unlink $file; - return $FAIL->(); - } + if ($stat->do_manifest and not $self->update_manifest) { + 1 while unlink $file; + return $FAIL->(); } return $OK->(); } +=head2 C + +Update the F file for the ebuild associated to the current dist object. + +=cut + +sub update_manifest { + my $self = shift; + my $stat = $self->status; + + my $file = $stat->eb_file; + unless ($file and -e $file) { + error 'The ebuild file is invalid or does not exist -- aborting'; + return 0; + } + + unless (File::Copy::copy($stat->fetched_arch => $stat->distdir)) { + error "Couldn\'t copy the distribution file to distdir ($!) -- aborting"; + return 0; + } + + msg 'Adding Manifest entry for ' . $stat->distribution; + return $self->_run([ 'ebuild', $stat->eb_file, 'manifest' ], 0); +} + sub _cpan2portage { my ($self, $name, $version) = @_;