/[gentoo-perl]/g-cpan/trunk/bin/g-cpan
Gentoo

Diff of /g-cpan/trunk/bin/g-cpan

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 74 Revision 75
17use YAML; 17use YAML;
18use YAML::Node; 18use YAML::Node;
19use Carp; 19use Carp;
20use IO::File; 20use IO::File;
21 21
22# While Writing - TO REMOVE - MPC
23use lib "../lib/";
22use Gentoo; 24use Gentoo;
23use Gentoo::UI::Console; 25use Gentoo::UI::Console;
26
27use constant PATH_PKG_VAR => '/var/db/pkg/';
24 28
25##### Establish our tmpdir 29##### Establish our tmpdir
26unless ( $ENV{TMPDIR} ) { $ENV{TMPDIR} = '/var/tmp/g-cpan' } 30unless ( $ENV{TMPDIR} ) { $ENV{TMPDIR} = '/var/tmp/g-cpan' }
27 31
28our $VERSION = "0.14.0"; 32our $VERSION = "0.14.0";
369 # trying to pre-seed the portage_name 373 # trying to pre-seed the portage_name
370 if ( $gcpan_run->{'cpan'}{ lc($ebuild_wanted) } ) { 374 if ( $gcpan_run->{'cpan'}{ lc($ebuild_wanted) } ) {
371 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'portage_name'} = 375 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'portage_name'} =
372 $gcpan_run->transformCPANname( 376 $gcpan_run->transformCPANname(
373 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'src_uri'} ); 377 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'src_uri'} );
378 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'portage_version'} =
379 $gcpan_run->transformCPANVersion(
380 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'src_uri'} );
374 } 381 }
375 else { 382 else {
376 print_err( $prog, "$ebuild_wanted is not a CPAN module!" ); 383 print_err( $prog, "$ebuild_wanted is not a CPAN module!" );
377 return; 384 return;
378 } 385 }
424 # ways now, time to get serious and create it ourselves 431 # ways now, time to get serious and create it ourselves
425 unless ( $gcpan_run->{'ebuilds'}{'found_ebuild'}{ lc($ebuild_wanted) } ) { 432 unless ( $gcpan_run->{'ebuilds'}{'found_ebuild'}{ lc($ebuild_wanted) } ) {
426 433
427 # Generate info - nothing found currently in the tree 434 # Generate info - nothing found currently in the tree
428 if ($debug) { $gcpan_run->debug; } 435 if ($debug) { $gcpan_run->debug; }
429 next
430 if (
431 lc( $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'} )
432 eq "perl" );
433 if ( $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'name'} ) { 436 if (( $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'name'} ) && (
437 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'}
438 ne "perl" )) {
434 439
435 # We have a cpan package that matches the request. 440 # We have a cpan package that matches the request.
436 # Let's unpack it and get all the deps out of it. 441 # Let's unpack it and get all the deps out of it.
437 $gcpan_run->unpackModule( 442 $gcpan_run->unpackModule(
438 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'name'} ); 443 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'name'} );
440 foreach my $dep ( 445 foreach my $dep (
441 keys 446 keys
442 %{ $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'depends'} } ) 447 %{ $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'depends'} } )
443 { 448 {
444 next unless ( defined $dep && $dep ne '' ); 449 next unless ( defined $dep && $dep ne '' );
445 next if ( $dep eq "perl" ); 450 if ( $dep eq "perl" )
451 {
452 delete $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'depends'}{$dep};
453 }
446 454
447 # Make sure we have information relevant to each of the deps 455 # Make sure we have information relevant to each of the deps
448 generatePackageInfo($dep); 456 generatePackageInfo($dep);
449 457
450 # Remove dep from list of modules to install later on - no 458 # Remove dep from list of modules to install later on - no
500 } 508 }
501 my $ebuild = File::Spec->catdir( $ebuild_dir, 509 my $ebuild = File::Spec->catdir( $ebuild_dir,
502 $gcpan_run->{'cpan'}{ lc($original_ebuild) } 510 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
503 {'portage_name'} . "-" 511 {'portage_name'} . "-"
504 . $gcpan_run->{'cpan'}{ lc($original_ebuild) } 512 . $gcpan_run->{'cpan'}{ lc($original_ebuild) }
505 {'version'} . ".ebuild" ); 513 {'portage_version'} . ".ebuild" );
506 514
507 # Break out if we already have an ebuild (upgrade or 515 # Break out if we already have an ebuild (upgrade or
508 # mistake in the code) 516 # mistake in the code)
509 unless ( -f $ebuild ) { 517 unless ( -f $ebuild ) {
510 print_info( $prog, 518 print_info( $prog,
545 {'depends'} 553 {'depends'}
546 } 554 }
547 ) 555 )
548 { 556 {
549 print $EBUILD "DEPEND=\""; 557 print $EBUILD "DEPEND=\"";
558 my %seen_deps;
550 foreach my $dep ( 559 foreach my $dep (
551 keys %{ 560 keys %{
552 $gcpan_run->{'cpan'}{ lc($original_ebuild) } 561 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
553 {'depends'} 562 {'depends'}
554 } 563 }
555 ) 564 )
556 { 565 {
557 next unless ( defined $dep && $dep ne '' ); 566 next unless ( defined $dep && $dep ne '' );
558 next if ( $dep eq "perl" );
559 my $portage_name = 567 my $portage_name =
560 lc( $gcpan_run->{'cpan'}{ lc($dep) } 568 lc( $gcpan_run->{'cpan'}{ lc($dep) }
561 {'portage_name'} ); 569 {'portage_name'} );
570 next if (defined $seen_deps{$portage_name});
571 $seen_deps{$portage_name} = 1;
572 next if ( $portage_name eq "perl" );
562 print $EBUILD "\t" 573 print $EBUILD "\t"
563 . $gcpan_run->{ebuilds}{portage} 574 . $gcpan_run->{ebuilds}{portage}
564 {$portage_name}{'category'} . "/" 575 {$portage_name}{'category'} . "/"
565 . $gcpan_run->{ebuilds}{portage} 576 . $gcpan_run->{ebuilds}{portage}
566 { lc($portage_name) }{'name'} . "\n"; 577 { $portage_name }{'name'} . "\n";
567 578
568 } 579 }
569 print $EBUILD "\"\n"; 580 print $EBUILD "\"\n";
570 print $EBUILD "RDEPEND=\"\$\{DEPEND\}\"\n";
571 undef $EBUILD; 581 undef $EBUILD;
572 autoflush STDOUT 1; 582 autoflush STDOUT 1;
573 } 583 }
574 if ( -f $gcpan_run->{'cpan'}{ lc($original_ebuild) } 584 if ( -f $gcpan_run->{'cpan'}{ lc($original_ebuild) }
575 {'cpan_tarball'} ) 585 {'cpan_tarball'} )

Legend:
Removed from v.74  
changed lines
  Added in v.75

  ViewVC Help
Powered by ViewVC 1.1.20