]> git.vpit.fr Git - perl/modules/CPANPLUS-Dist-Gentoo.git/blobdiff - lib/CPANPLUS/Dist/Gentoo.pm
Generate ebuild for the current dist before recursing
[perl/modules/CPANPLUS-Dist-Gentoo.git] / lib / CPANPLUS / Dist / Gentoo.pm
index ed048f96153594b6e86292f85c85962b8a52e90c..67428ed265a4e71135a40bf0948bb82eb01e302e 100644 (file)
@@ -383,14 +383,6 @@ sub create {
   return 1;
  }
 
- $stat->created(0);
- $stat->dist(undef);
-
- $self->SUPER::create(@_);
-
- $stat->created(0);
- $stat->dist(undef);
-
  my $dir = $stat->eb_dir;
  unless (-d $dir) {
   eval { mkpath $dir };
@@ -400,6 +392,8 @@ sub create {
   }
  }
 
+ my %seen;
+
  my $d = $stat->header;
  $d   .= "# Generated by CPANPLUS::Dist::Gentoo version $VERSION\n\n";
  $d   .= 'MODULE_AUTHOR="' . $stat->author . "\"\ninherit perl-module\n\n";
@@ -411,8 +405,8 @@ sub create {
  $d   .= 'LICENSE="|| ( ' . join(' ', sort @{$stat->license}) . " )\"\n";
  $d   .= 'KEYWORDS="' . join(' ', sort @{$stat->keywords}) . "\"\n";
  $d   .= 'DEPEND="' . join("\n",
-  'dev-lang/perl',
-  map $self->_cpan2portage(@$_), @{$stat->deps}
+  sort grep !$seen{$_}++, 'dev-lang/perl',
+                          map $self->_cpan2portage(@$_), @{$stat->deps}
  ) . "\"\n";
  $d   .= "SRC_TEST=\"do\"\n";
  $d   .= $stat->footer;
@@ -425,6 +419,14 @@ sub create {
  print $eb $d;
  close $eb;
 
+ $stat->created(0);
+ $stat->dist(undef);
+
+ $self->SUPER::create(@_);
+
+ $stat->created(0);
+ $stat->dist(undef);
+
  if ($stat->do_manifest) {
   unless (copy $stat->fetched_arch, $stat->distdir) {
    error "Couldn\'t copy the distribution file to distdir ($!) -- aborting";