Example: # g-cpan -iv Text::WordDiff * g-cpan: Adding /usr/local/portage to overlay list * g-cpan: Setting /usr/local/portage as the PORTDIR_OVERLAY for this session. * g-cpan: Grabbing arch list CPAN: Storable loaded ok Going to read /root/.cpan/Metadata Database was generated on Sat, 14 Jan 2006 23:11:44 GMT * g-cpan: g-cpan: portage_dir returned Text-WordDiff * g-cpan: Checking to see if Text::WordDiff is installed already * g-cpan: Need to create ebuild for 'Text::WordDiff': Text-WordDiff Running make for D/DW/DWHEELER/Text-WordDiff-0.02.tar.gz CPAN: LWP::UserAgent loaded ok Fetching with LWP: http://no-more.kiev.ua/CPAN/authors/id/D/DW/DWHEELER/Text-WordDiff-0.02.tar.gz Checksum for /root/.cpan/sources/authors/id/D/DW/DWHEELER/Text-WordDiff-0.02.tar.gz ok Scanning cache /root/.cpan/build for sizes Text-WordDiff-0.02/ Text-WordDiff-0.02/Build.PL Text-WordDiff-0.02/Changes Text-WordDiff-0.02/eg/ Text-WordDiff-0.02/eg/word_diff.css Text-WordDiff-0.02/lib/ Text-WordDiff-0.02/lib/Text/ Text-WordDiff-0.02/lib/Text/WordDiff/ Text-WordDiff-0.02/lib/Text/WordDiff/ANSIColor.pm Text-WordDiff-0.02/lib/Text/WordDiff/HTML.pm Text-WordDiff-0.02/lib/Text/WordDiff.pm Text-WordDiff-0.02/Makefile.PL Text-WordDiff-0.02/MANIFEST Text-WordDiff-0.02/META.yml Text-WordDiff-0.02/README Text-WordDiff-0.02/t/ Text-WordDiff-0.02/t/ansicolor.t Text-WordDiff-0.02/t/base.t Text-WordDiff-0.02/t/data/ Text-WordDiff-0.02/t/data/left.txt Text-WordDiff-0.02/t/data/right.txt Text-WordDiff-0.02/t/html.t Text-WordDiff-0.02/t/pod.t Removing previously used /root/.cpan/build/Text-WordDiff-0.02 CPAN.pm: Going to build D/DW/DWHEELER/Text-WordDiff-0.02.tar.gz # running Build.PL /usr/bin/perl5.8.7 -I/usr/local/lib/perl5/site_perl/5.8.7/Module/ Build.PL Checking whether your kit is complete... Looks good Creating new 'Build' script for 'Text-WordDiff' version '0.02' /usr/bin/perl5.8.7 Build --makefile_env_macros 1 lib/Text/WordDiff/HTML.pm -> blib/lib/Text/WordDiff/HTML.pm lib/Text/WordDiff.pm -> blib/lib/Text/WordDiff.pm lib/Text/WordDiff/ANSIColor.pm -> blib/lib/Text/WordDiff/ANSIColor.pm Manifying blib/lib/Text/WordDiff/ANSIColor.pm -> blib/libdoc/Text::WordDiff::ANSIColor.3pm Manifying blib/lib/Text/WordDiff.pm -> blib/libdoc/Text::WordDiff.3pm blib/lib/Text/WordDiff.pm:280: Unknown command paragraph "=encoding utf8" Manifying blib/lib/Text/WordDiff/HTML.pm -> blib/libdoc/Text::WordDiff::HTML.3pm /usr/bin/make -- OK * g-cpan: Computing MD5 Sum of /root/.cpan/sources/authors/id/D/DW/DWHEELER/Text-WordDiff-0.02.tar.gz * g-cpan: g-cpan: portage_dir returned ANSIColor * g-cpan: Need to create ebuild for 'Term::ANSIColor': ANSIColor Running make for R/RR/RRA/ANSIColor-1.10.tar.gz But # emerge -pv dev-perl/Term-ANSIColor These are the packages that I would merge, in order: Calculating dependencies ...done! [ebuild R ] dev-perl/Term-ANSIColor-1.09 0 kB Total size of downloads: 0 kB Also it problem exists for modules like * g-cpan: g-cpan: portage_dir returned PathTools * g-cpan: Need to create ebuild for 'File::Spec': PathTools So I suggest simple patch for fix it It try find ebuild by module name also
Created attachment 77268 [details, diff] g-cpan.simple.patch
While your solution works in this case (and does no harm that I can see), I don't think its a permanent solution. The real issue is that there are 'oddball' modules that fall under one name(space), but where the downloaded file is something else. Two good examples of this would be Term-ANSIColor (duh) and File::Spec (which is part of Pathtools). So....the real question is how to painlessly capture that into g-cpan without writing a list of exception rules for the handfull of uniques.
Yes you are right I suggest "simple" solution, but not "correct" I think not many exception rules need added, now only this one or make agreement in naming: portage dir of MODULE = CPAN::Shell->expand("Module","MODULE")->cpan_file Example in FreeBSD ports exists file "pkg-plist" with all installed files and BSDPAN only make grep from p5-*/pkg-plist for check existing file in it In Gentoo portage such file list not exists :( So before install we can't check more carefully
Another example of bad perl module naming in portage Manifying blib/man3/WWW::Search.3pm /usr/bin/make -- OK * g-cpan: Need to create ebuild for 'Pod::Usage': Pod-Parser Running make for M/MA/MAREKR/Pod-Parser-1.34.tar.gz # emerge -pv virtual/perl-PodParser perl-core/PodParser These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild R ] virtual/perl-PodParser-1.32 0 kB [ebuild R ] perl-core/PodParser-1.32 USE="-minimal" 0 kB Total size of downloads: 0 kB I suggest try load (and find) required module and if exists when try find package with this file for this example # equery b Pod/Usage.pm [ Searching for file(s) Pod/Usage.pm in *... ] dev-lang/perl-5.8.8-r1 (/usr/lib/perl5/5.8.8/Pod/Usage.pm) perl-core/PodParser-1.32 (/usr/lib/perl5/vendor_perl/5.8.8/Pod/Usage.pm) net-analyzer/mrtg-2.13.2 (/usr/lib/mrtg2/Pod/Usage.pm)
Another example * g-cpan: g-cpan: portage_dir returned Data-Dumper * g-cpan: Need to create ebuild for 'Data::Dumper': Data-Dumper Running make for I/IL/ILYAM/Data-Dumper-2.121.tar.gz but $ perl use CPAN; my $obj = CPAN::Shell->expandany('Data::Dumper'); print $obj->inst_file, "\n"; CPAN: Storable loaded ok Going to read /home/bor/.cpan/Metadata Database was generated on Tue, 25 Apr 2006 06:34:47 GMT /usr/lib/perl5/5.8.8/i686-linux-thread-multi/Data/Dumper.pm $ equery b /usr/lib/perl5/5.8.8/i686-linux-thread-multi/Data/Dumper.pm [ Searching for file(s) /usr/lib/perl5/5.8.8/i686-linux-thread-multi/Data/Dumper.pm in *... ] dev-lang/perl-5.8.8-r1 (/usr/lib/perl5/5.8.8/i686-linux-thread-multi/Data/Dumper.pm) so we can set check inst_file before cpan_file for resolve this problem
I suggest this code put into module_check sub # check if this module installed already if (my $inst_file = $obj->inst_file) { print_info ("$prog: module alredy installed into $inst_file") if ($verbose); open(EQUERY,'-|','equery','-q','-C','b',$inst_file) or fatal("Cant run",'equery',$!); my @packages = <EQUERY>; close(EQUERY); print_info ("$prog: module alredy installed from:".(join(', ',@packages)||'cpan/g-cpan')) if ($verbose); return 1; } but also need or pass $obj to it or add my $obj = CPAN::Shell->expandany($module_name); and add equery(gentoolkit) depend PS: sorry for my urgency/persistency ;)
(In reply to comment #5) > Another example > * g-cpan: g-cpan: portage_dir returned Data-Dumper bad example - data-dumper isn't maintained outside of maint any more. Your suggestions are under advisement. I'm actually thinking of liberally borrowing from the new code ian wrote for up2date-ng to better track pre-existing deps in the tree. Not ignoring you, just not the top of the queue at the moment :)
fixed in 0.14, thanks!