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

Contents of /g-cpan/trunk/bin/g-cpan

Parent Directory Parent Directory | Revision Log Revision Log


Revision 74 - (show annotations) (download)
Tue Jun 6 00:31:09 2006 UTC (9 years, 1 month ago) by mcummings
File size: 27485 byte(s)
Bug 134781 - RDEPEND=DEPEND line in generated ebuilds


1 #!/usr/bin/perl -w
2 package main;
3
4 # Copyright 1999-2005 Gentoo Foundation
5 # Distributed under the terms of the GNU General Public License v2
6 #
7
8 # modules to use - these will need to be marked as
9 # dependencies, and installable by portage
10 use strict;
11 use File::Spec;
12 use File::Path;
13 use File::Basename;
14 use File::Copy;
15 use Term::ANSIColor;
16 use Cwd qw(getcwd abs_path cwd);
17 use YAML;
18 use YAML::Node;
19 use Carp;
20 use IO::File;
21
22 use Gentoo;
23 use Gentoo::UI::Console;
24
25 ##### Establish our tmpdir
26 unless ( $ENV{TMPDIR} ) { $ENV{TMPDIR} = '/var/tmp/g-cpan' }
27
28 our $VERSION = "0.14.0";
29 my $prog = basename($0);
30
31 my %dep_list = ();
32 my @perl_dirs = (
33 "dev-perl", "perl-core", "perl-gcpan", "perl-text",
34 "perl-tools", "perl-xml", "perl-dev"
35 );
36
37 ###############################
38 # Command line interpretation #
39 ###############################
40
41 # Module load & configure
42 use Getopt::Long;
43 Getopt::Long::Configure("bundling");
44
45 # Init all options (has to be done to perform the 'sum test' later)
46 my (
47 $debug, $verbose, $search, $install,
48 $upgrade, $generate, $list, $pretend,
49 $ask, $cpan_reload, $buildpkg, $buildpkgonly
50 )
51 = ( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
52
53 # Set colors here so we can use them at will anywhere :)
54 my $green = color("bold green");
55 my $white = color("bold white");
56 my $cyan = color("bold cyan");
57 my $reset = color("reset");
58
59 #Get & Parse them
60 GetOptions(
61 'verbose|v' => \$verbose,
62 'search|s' => \$search,
63 'install|i' => \$install,
64 'upgrade|u' => \$upgrade,
65 'list|l' => \$list,
66 'pretend|p' => \$pretend,
67 'buildpkg|b' => \$buildpkg,
68 'buildpkgonly|B' => \$buildpkgonly,
69 'ask|a' => \$ask,
70 'generate|g' => \$generate,
71 'debug|d' => \$debug,
72 'cpan_reload' => \$cpan_reload,
73 'help|h' => sub { exit_usage(); }
74 )
75 or exit_usage();
76
77 if ( ( $install or $ask or $buildpkg or $buildpkgonly or $upgrade )
78 and ( $> > 0 )
79 and !$pretend )
80 {
81 print_err( $prog, "ERROR - INSUFFICIENT PERMISSIONS TO RUN EMERGE" );
82 exit();
83 }
84
85 # Array containing the original values passed for installing
86 my @passed_to_install = @ARGV;
87
88 # Array that will contain the portage friendly version of the values passed to install
89 my @really_install;
90
91 # Output error if more than one switch is activated
92 #
93 if ( $search + $list + $install + $generate + $ask + $buildpkg + $buildpkgonly >
94 1 )
95 {
96 print_err( $prog, "You can't combine actions with each other.\n" );
97 print_out(
98 "${white}Please consult ${cyan}$prog ${green}--help${reset} or ${cyan}man $prog${reset} for more information\n\n"
99 );
100 exit();
101 }
102
103 if ( $search + $list + $install + $generate + $upgrade + $pretend + $ask +
104 $buildpkg + $buildpkgonly == 0 )
105 {
106 print_err( $prog, "You haven't told $prog what to do.\n" );
107 print_out(
108 "${white}Please consult ${cyan}$prog ${green}--help${reset} or ${cyan}man $prog${reset} for more information\n\n"
109 );
110
111 exit();
112 }
113
114 # Output error if no arguments
115 if ( ( scalar(@ARGV) == 0 ) and !( defined($upgrade) or defined($list) ) ) {
116 print_err( $prog, "Not even one module name or expression given!\n" );
117 print_out(
118 "${white}Please consult ${cyan}$prog ${green}--help${reset} for more information\n\n"
119 );
120 exit();
121 }
122
123 ######################
124 # CPAN Special Stuff #
125 ######################
126
127 my $GentooCPAN = Gentoo->new();
128
129 # Don't do autointalls via ExtUtils::AutoInstall
130 $ENV{PERL_EXTUTILS_AUTOINSTALL} = "--skipdeps";
131 $ENV{PERL_MM_USE_DEFAULT} = 1;
132
133 # Do we need to generate a config ?
134 eval 'use CPAN::Config;';
135 my $needs_cpan_stub = $@ ? 1 : 0;
136
137 # Test Replacement - ((A&B)or(C&B)) should be the same as ((A or C) and B)
138 if ( ( ($needs_cpan_stub) || ( $> > 0 ) )
139 && ( !-f "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" ) )
140 {
141
142 # In case match comes from the UID test
143 $needs_cpan_stub = 1;
144
145 print_warn("No CPAN Config found, auto-generating a basic one");
146
147 # Generate a fake config for CPAN
148 $GentooCPAN->makeCPANstub();
149 }
150 else {
151 $needs_cpan_stub = 0;
152 }
153
154 use CPAN;
155
156 ##########
157 # main() #
158 ##########
159
160 # Taking care of Searches. This has to be improved a lot, since it uses a call to
161 # CPAN Shell to do the job, thus making it impossible to have a clean output..
162 if ($search) {
163 foreach my $expr (@ARGV) {
164
165 # Assume they gave us module-name instead of module::name
166 # which is bad, because CPAN can't convert it ;p
167
168 print_ok( $prog, "Searching for $expr on CPAN" ) if ($verbose);
169 unless ( CPAN::Shell->i("/$expr/") ) {
170 $expr =~ s/-/::/g;
171 CPAN::Shell->i("/$expr/");
172 }
173 }
174
175 exit;
176 }
177
178 # Confirm that there is an /etc/portage/categories file
179 # and that we have an entry for perl-gcpan in it.
180 my $cat_file = "/etc/portage/categories";
181 if ( -f "$cat_file" ) {
182
183 #
184 # Use braces to localize the $/ assignment, so we don't get bitten later.
185 #
186 local $/ = undef;
187 my $cat_read = IO::File->new( $cat_file, '<' );
188 if ( defined $cat_read ) {
189 my $data = <$cat_read>;
190 undef $cat_read;
191 autoflush STDOUT 1;
192 unless ( grep "gcpan", $data ) {
193 my $cat_write = IO::File->new( $cat_file, '>>' );
194 if ( defined $cat_write ) {
195 print $cat_write "perl-gcpan";
196 undef $cat_write;
197 autoflush STDOUT 1;
198 }
199 else {
200 print_err(
201 "Insufficient permissions to edit /etc/portage/categories");
202 print_err(
203 "Please run $prog as a user with sufficient permissions");
204 exit;
205 }
206 }
207 }
208
209 }
210 else {
211 my $cat_write = IO::File->new( $cat_file, '>' );
212 if ( defined $cat_write ) {
213 print $cat_write "perl-gcpan";
214 }
215 else {
216 print_err("Insufficient permissions to edit /etc/portage/categories");
217 print_err("Please run $prog as a user with sufficient permissions");
218 exit;
219 }
220 }
221
222 my $gcpan_run = Gentoo->new(
223 'cpan_reload' => $cpan_reload,
224 'DEBUG' => $debug,
225 );
226
227 # Grab the keywords - we'll need these when we build the ebuild
228 my $keywords = $gcpan_run->getValue("ACCEPT_KEYWORDS");
229
230 # Get the main portdir
231 $gcpan_run->{'portage_bases'}{ $gcpan_run->getValue("PORTDIR") } = 1;
232
233 # Get the overlays
234 my $overlay = $gcpan_run->getValue("PORTDIR_OVERLAY") || undef;
235
236 # Get the DISTDIR - we'd like store the tarballs in here the one time
237 $gcpan_run->{'sources'} = $gcpan_run->getValue("DISTDIR");
238
239 # Make sure we have write access to the DISTDIR
240 if ( $generate
241 or $install
242 or $pretend
243 or $buildpkg
244 or $buildpkgonly
245 or $ask
246 or $upgrade )
247 {
248 my $test_dist_writes = $gcpan_run->{'sources'} . "/test-gcpan";
249 my $test_distdir = IO::File->new( $test_dist_writes, ">" );
250 if ($test_distdir) {
251 undef $test_distdir;
252 unlink $test_dist_writes;
253 }
254 else {
255 undef $test_distdir;
256 fatal( print_err( $prog, "No write access to DISTDIR: $!" ) );
257 }
258 }
259
260 if ($overlay) {
261 if ( $overlay =~ m/\b\s.*/ ) {
262 my @overlays = map { split ' ' } $overlay;
263 foreach (@overlays) {
264 $gcpan_run->{'portage_bases'}{$_} = 1;
265 }
266
267 }
268 else {
269 $gcpan_run->{'portage_bases'}{$overlay} = 1;
270 }
271 }
272 elsif ( $generate or $pretend ) {
273 print_err( $prog,
274 "The option you have chosen isn't supported without a configured overlay.\n"
275 );
276 exit();
277 }
278
279 # Set portage_categories to our defined list of perl_dirs
280 $gcpan_run->{portage_categories} = \@perl_dirs;
281
282 if ( $list or $upgrade ) {
283 my @overlays = map { split ' ' } $overlay;
284 foreach my $overlay_dir (@overlays) {
285 my $gcpan_dir = File::Spec->catdir( $overlay_dir, "perl-gcpan" );
286 print_ok( $prog, "OVERLAY: $gcpan_dir" )
287 if ($list);
288 if ( opendir PDIR, $gcpan_dir ) {
289 while ( my $file = readdir PDIR ) {
290 next
291 if $file eq '.'
292 or $file eq '..';
293 print_info( $prog, "perl-gcpan/$file" )
294 if ($list);
295 push @passed_to_install, $file
296 if ($upgrade);
297 }
298 closedir PDIR;
299 }
300 else {
301 print_warn( $prog, "Couldn't open folder $gcpan_dir: $!" );
302 }
303 }
304 }
305
306 if ( $generate
307 or $install
308 or $pretend
309 or $buildpkg
310 or $buildpkgonly
311 or $ask
312 or $upgrade )
313 {
314 for my $module (@passed_to_install) {
315 generatePackageInfo($module);
316 }
317 }
318
319 if ( $install or $pretend or $buildpkg or $buildpkgonly or $upgrade or $ask ) {
320 if (@really_install) {
321
322 for my $ebuild (@really_install) {
323 print_ok( $prog, "Calling emerge for $ebuild\n" ) if ($verbose);
324 my @flags;
325 push @flags, "--oneshot";
326 push @flags, "--pretend" if $pretend > 0;
327 push @flags, "--ask" if $ask > 0;
328 push @flags, "--buildpkg" if $buildpkg > 0;
329 push @flags, "--buildpkgonly" if $buildpkgonly > 0;
330
331 print_info( $prog, "Calling: emerge --oneshot @flags $ebuild" )
332 if ($verbose);
333 $gcpan_run->emerge_ebuild( $ebuild, @flags );
334
335 }
336 }
337 else {
338 if ($upgrade) {
339 print_info( $prog, "Everything was up to date, nothing to do!" );
340 }
341 else {
342 print_err( $prog, "Nothing to install!!" );
343 }
344
345 }
346 }
347
348 sub generatePackageInfo {
349
350 # Since all we are concerned with is the final name of the package, this
351 # should be a safe substitution
352 my $ebuild_wanted = shift;
353
354 #In the event this is an upgrade, go ahead and do the lame s/-/::/
355 if ($upgrade) { $ebuild_wanted =~ s{-}{::}gxms }
356
357 # Grab specific info for this module
358 $gcpan_run->getCPANInfo($ebuild_wanted);
359 unless ( $gcpan_run->{'cpan'}{ lc($ebuild_wanted) } ) {
360
361 # Fallback to trying the /-/::/ trick - we avoid this the first time
362 # in case the module actually employs a - in its name
363 $ebuild_wanted =~ s{-}{::}gxms;
364 $gcpan_run->getCPANInfo($ebuild_wanted);
365 }
366
367 # If we found something on cpan, transform the portage_name
368 # It's possible to not find something on cpan at this point - we're just
369 # trying to pre-seed the portage_name
370 if ( $gcpan_run->{'cpan'}{ lc($ebuild_wanted) } ) {
371 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'portage_name'} =
372 $gcpan_run->transformCPANname(
373 $gcpan_run->{'cpan'}{ lc($ebuild_wanted) }{'src_uri'} );
374 }
375 else {
376 print_err( $prog, "$ebuild_wanted is not a CPAN module!" );
377 return;
378 }
379
380 # Save a copy of the originally requested name for later use
381 my $original_ebuild = $ebuild_wanted;
382
383 # Simple transform of name to something portage friendly
384 $ebuild_wanted =~ s{::}{-}xms;
385
386 # Scan portage for the ebuild name
387 &scanTree($ebuild_wanted)
388 unless ( $upgrade && ( grep { /$ebuild_wanted/ } @passed_to_install ) );
389 unless ( $gcpan_run->{'ebuilds'}{'found_ebuild'}{ lc($ebuild_wanted) }
390 or ( $upgrade && ( grep { /$ebuild_wanted/ } @passed_to_install ) ) )
391 {
392
393 # Ebuild wasn't found - scan for the nice version of the module name
394 my $portage_name =
395 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'};
396 next if ( lc($original_ebuild) eq "perl" );
397 &scanTree(
398 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'} );
399
400 # We had success in finding this module under a different name
401 if (
402 $gcpan_run->{'ebuilds'}{'found_ebuild'}{
403 lc(
404 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'}
405 )
406 }
407 )
408 {
409 print_info( $prog,
410 "Found ebuild under CPAN name ("
411 . $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'}
412 . ")" )
413 if ($verbose);
414 $ebuild_wanted =
415 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'};
416 }
417 }
418 else {
419 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'portage_name'} =
420 $ebuild_wanted;
421 }
422
423 # Second round - we've looked for the package in portage two different
424 # ways now, time to get serious and create it ourselves
425 unless ( $gcpan_run->{'ebuilds'}{'found_ebuild'}{ lc($ebuild_wanted) } ) {
426
427 # Generate info - nothing found currently in the tree
428 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'} ) {
434
435 # We have a cpan package that matches the request.
436 # Let's unpack it and get all the deps out of it.
437 $gcpan_run->unpackModule(
438 $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'name'} );
439
440 foreach my $dep (
441 keys
442 %{ $gcpan_run->{'cpan'}{ lc($original_ebuild) }{'depends'} } )
443 {
444 next unless ( defined $dep && $dep ne '' );
445 next if ( $dep eq "perl" );
446
447 # Make sure we have information relevant to each of the deps
448 generatePackageInfo($dep);
449
450 # Remove dep from list of modules to install later on - no
451 # more dup'd installs!
452 if ( grep { /$dep/ } @passed_to_install ) {
453 @really_install = grep { !/$dep/ } @really_install;
454 }
455
456 # Reindex one last time for anything we build after the fact
457 scanTree( $gcpan_run->{'cpan'}{ lc($dep) }{'portage_name'} );
458 }
459
460 # Write ebuild here?
461 if ($debug) { $gcpan_run->debug; }
462 my @overlays = map { split ' ' } $overlay;
463 foreach my $target_dir (@overlays) {
464 if ( -d $target_dir ) {
465 my $gcpan_dir =
466 File::Spec->catdir( $target_dir, "perl-gcpan" );
467 unless ( -d $gcpan_dir ) {
468 print_info( $prog, "Create directory '$gcpan_dir'" )
469 if ($verbose);
470 mkdir( $gcpan_dir, 0755 )
471 or fatal(
472 print_err(
473 $prog, "Couldn't create folder $gcpan_dir: $!"
474 )
475 );
476 }
477 my $ebuild_dir = File::Spec->catdir( $gcpan_dir,
478 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
479 {'portage_name'} );
480 unless ( -d $ebuild_dir ) {
481 print_info( $prog, "Create directory '$ebuild_dir'" )
482 if ($verbose);
483 mkdir( $ebuild_dir, 0755 )
484 or fatal(
485 print_err(
486 $prog, "Couldn't create folder $gcpan_dir: $!"
487 )
488 );
489 }
490 my $files_dir = File::Spec->catdir( $ebuild_dir, 'files' );
491 unless ( -d $files_dir ) {
492 print_info( $prog, "Create directory '$files_dir'" )
493 if ($verbose);
494 mkdir( $files_dir, 0755 )
495 or fatal(
496 print_err(
497 $prog, "Couldn't create folder $gcpan_dir: $!"
498 )
499 );
500 }
501 my $ebuild = File::Spec->catdir( $ebuild_dir,
502 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
503 {'portage_name'} . "-"
504 . $gcpan_run->{'cpan'}{ lc($original_ebuild) }
505 {'version'} . ".ebuild" );
506
507 # Break out if we already have an ebuild (upgrade or
508 # mistake in the code)
509 unless ( -f $ebuild ) {
510 print_info( $prog,
511 "Generating ebuild for "
512 . $gcpan_run->{'cpan'}{ lc($original_ebuild) }
513 {'name'} );
514 my $EBUILD = IO::File->new( $ebuild, '>' )
515 or fatal(
516 print_err(
517 $prog, "Couldn't open(write) file $ebuild: $!"
518 )
519 );
520 print $EBUILD <<"HERE";
521 # Copyright 1999-2005 Gentoo Foundation
522 # Distributed under the terms of the GNU General Public License v2
523 # This ebuild generated by $prog $VERSION
524
525 inherit perl-module
526
527 S=\${WORKDIR}/$gcpan_run->{'cpan'}{lc($original_ebuild)}{'portage_sdir'}
528
529 DESCRIPTION="$gcpan_run->{'cpan'}{lc($original_ebuild)}{'description'}"
530 HOMEPAGE="http://search.cpan.org/search?query=\${PN}"
531 SRC_URI="mirror://cpan/authors/id/$gcpan_run->{'cpan'}{lc($original_ebuild)}{'src_uri'}"
532
533
534 IUSE=""
535
536 SLOT="0"
537 LICENSE="|| ( Artistic GPL-2 )"
538 KEYWORDS="$keywords"
539
540 HERE
541
542 if (
543 keys %{
544 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
545 {'depends'}
546 }
547 )
548 {
549 print $EBUILD "DEPEND=\"";
550 foreach my $dep (
551 keys %{
552 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
553 {'depends'}
554 }
555 )
556 {
557 next unless ( defined $dep && $dep ne '' );
558 next if ( $dep eq "perl" );
559 my $portage_name =
560 lc( $gcpan_run->{'cpan'}{ lc($dep) }
561 {'portage_name'} );
562 print $EBUILD "\t"
563 . $gcpan_run->{ebuilds}{portage}
564 {$portage_name}{'category'} . "/"
565 . $gcpan_run->{ebuilds}{portage}
566 { lc($portage_name) }{'name'} . "\n";
567
568 }
569 print $EBUILD "\"\n";
570 print $EBUILD "RDEPEND=\"\$\{DEPEND\}\"\n";
571 undef $EBUILD;
572 autoflush STDOUT 1;
573 }
574 if ( -f $gcpan_run->{'cpan'}{ lc($original_ebuild) }
575 {'cpan_tarball'} )
576 {
577 print_info( $prog,
578 "Copying $gcpan_run->{'cpan'}{lc($original_ebuild)}{'cpan_tarball'} to $gcpan_run->{'sources'}"
579 )
580 if $verbose;
581 copy(
582 $gcpan_run->{'cpan'}{ lc($original_ebuild) }
583 {'cpan_tarball'},
584 $gcpan_run->{'sources'}
585 );
586 }
587 print_info( $prog,
588 "Ebuild generated for $ebuild_wanted" );
589 $gcpan_run->generate_digest($ebuild);
590 if (
591 !$upgrade
592 or (
593 $upgrade
594 && ( grep { /$ebuild_wanted/ }
595 @passed_to_install )
596 )
597 )
598 {
599 push @really_install, $ebuild_wanted;
600 }
601 last;
602 }
603 else {
604 print_info( $prog, "$ebuild_wanted already up to date" )
605 if ($upgrade);
606 last;
607 }
608 }
609 }
610
611 }
612 }
613 else {
614 print_ok( $prog, "Ebuild already exists for $ebuild_wanted" );
615 if ( grep { /$original_ebuild/ } @passed_to_install ) {
616 push @really_install,
617 $gcpan_run->{'ebuilds'}{'portage'}{ lc($ebuild_wanted) }{'name'};
618 }
619
620 }
621
622 }
623
624 sub scanTree {
625 my $module = shift;
626 return unless ($module);
627 foreach my $portage_root ( keys %{ $gcpan_run->{'portage_bases'} } ) {
628 if ( -d $portage_root ) {
629 print_ok( $prog, "Scanning $portage_root for $module" )
630 if ($verbose);
631 $gcpan_run->getAvailableVersions( $portage_root, $module );
632 }
633
634 # Pop out of the loop if we've found the module
635 last if ( $gcpan_run->{'ebuilds'}{'found_ebuild'}{ lc($module) } );
636 }
637 }
638
639 # cab - Takes care of system's sanity
640 END {
641
642 #Clean out the /tmp tree we were using
643 #I know this looks weird, but since clean_up is invoked on a search, where OVERLAYS isn't ever defined,
644 # we first need to see if it exists, then need to remove only if it has content (the old exists vs. defined)
645
646 if ( defined( $ENV{TMPDIR} ) ) {
647 print_info("Cleaning temporary overlay\n") if $verbose;
648
649 #rmtree( ["$tmp_overlay_dir"] );
650 }
651 }
652
653 # cab - nice help message ! ;)
654 sub exit_usage {
655 print <<"USAGE";
656 ${white}Usage : ${cyan}$prog ${green}<Switch(es)> ${cyan}Module Name(s)${reset}
657
658 ${green}--generate,-g${reset}
659 Generate ebuilds only (Requires working overlays)
660
661 ${green}--install,-i${reset}
662 Try to generate ebuild for the given module name
663 and, if successful, emerge it. Important : installation
664 requires exact CPAN Module Name.
665
666 ${green}--list,-l${reset}
667 This command generates a list of the Perl modules and ebuilds
668 handled by $prog.
669
670 ${green}--search,-s${reset}
671 Search CPAN for the given expression (similar to
672 the "m /EXPR/" from the CPAN Shell). Searches are
673 case insensitive.
674
675 ${green}--upgrade,-u${reset}
676 Try to list and upgrade all Perl modules managed by $prog.
677 It generate up-to-date ebuilds, then emerge then.
678
679 ${green}--verbose,-v${reset}
680 Enable (some) verbose output.
681
682 ${green}--cpan_reload${reset}
683 Reload the CPAN index
684
685 ${white}Portage related options${reset}
686
687 ${green}--ask,-a${reset}
688 Ask before installing
689
690 ${green}--buildpkg,-b${reset}
691 Tells emerge to build binary packages for all ebuilds processed
692 in addition to actually merging the packages.
693
694 ${green}--buildpkgonly,-B${reset}
695 Creates binary packages for all ebuilds processed without actu-
696 ally merging the packages.
697
698 ${green}--pretend,-p${reset}
699 Pretend (show actions, but don't emerge). This still generates
700 new ebuilds.
701
702
703 USAGE
704
705 exit;
706 }
707
708 exit;
709
710 ##############
711
712 __END__
713
714 =pod
715
716 =head1 NAME
717
718 g-cpan - install CPAN-provided Perl modules using Gentoo's Portage
719
720 =head1 SYNOPSIS
721
722 B<g-cpan> [B<-a>| B<--ask>] [B<-g>| B<--generate>] [B<-i>| B<--install>] [B<-l>| B<--list >] [B<-p>| B<--pretend >] [B<-s>| B<--search>] [B<-u>| B<--upgrade >] [B<-v>| B<--verbose>] <I<module-name>>
723
724 =head1 DESCRIPTION
725
726 B<g-cpan> is a perl script that installs a CPAN module (including its dependencies) using Gentoo's Portage. It saves dependency information and stored files as if they were installed through a regular ebuild.
727
728 =head1 CPAN Configuration
729
730 B<~/.cpan/CPAN/MyConfig.pm>
731 B</path/to/perl/CPAN/Config.pm>
732
733 When you run B<g-cpan>, it will check for two configuration files. If you are root, it will check for the presense of an already configured CPAN under your perl install path. If CPAN is not configured, or you are not root, g-cpan will create a generic configuration for CPAN in ~/.cpan/CPAN/ called MyConfig.pm. You can modify this file as needed at any time.
734
735 The CPAN configuration file is used for interacting with CPAN, determining what modules are available, what modules are needed, and performing all basic CPAN functions.
736
737 =head1 g-cpan and Overlays
738
739 B<g-cpan> is now overlay "friendly." B<g-cpan> will scan both the overlays provided in your make.conf as well as any you have set via environment variables, to help determine its course of action. If you have defined overlays, B<g-cpan> will use the first overlay in your list that the user running it can write to. Any ebuilds generated by B<g-cpan> will be stored in this overlay for future use (such as upgrading).
740
741 If no overlays are defined, or the user operating B<g-cpan> cannot write to an overlay, then anything generated will be written to a temporary space and wiped on exit.
742
743 =head1 Arguments
744
745 The following arguments are accepted by g-cpan.
746
747 =over 4
748
749 =item B<-g,--generate>
750
751 Generate ebuilds and drop them in the overlay, but never call portage. Useful for generating a tree of ebuilds without having permissions to portage.
752
753 =item B<-i,--install>
754
755 Install the (list of) modules provided.
756
757 =item B<-l,--list>
758
759 List ebuilds that have been generated by g-cpan and reside in your overlay.
760
761 =item B<-s,--search>
762
763 Search CPAN for the provided module.
764
765 =item B<--cpan_reload>
766
767 Reload CPAN's index online
768
769 =item B<-u,--upgrade>
770
771 Attempt to upgrade any ebuilds generated by g-cpan to newer versions. This option will create new ebuilds for those that exist in your overlay already. If a module name is given, it will attempt to only upgrade the requested module. If no arguments are given, all modules in your g-cpan overlay will be checked.
772
773 =item B<-v,--verbose>
774
775 Enable verbose mode for more feedback on the step by step processes that g-cpan is running
776
777 =back
778
779 =head1 Portage Arguments
780
781 The following portage arguments can be passed to g-cpan. Please read the portage documentation for more information on how they work.
782
783 =over 4
784
785 =item B<-a,--ask>
786
787 Pass the "ask" argument to portage. This will cause portage to prompt you to confirm your installation prior to issuing an emerge
788
789 =item B<-b,--buildpkg>
790 Tells emerge to build binary packages for all ebuilds processed in addition to actually merging the packages.
791
792 =item B<-B,--buildpkgonly>
793 Creates binary packages for all ebuilds processed without actually merging the packages.
794
795 =item B<-p,--pretend>
796
797 Create ebuilds as needed for the (list of) modules provided, but don't perform the actual emerge.
798
799
800 =back
801
802 =head1 Usage
803
804
805 =head2 Here we install Jabber::RPC
806
807 # g-cpan -i Jabber::RPC
808
809 =head2 Performing a search
810
811 # g-cpan -s Clone::Any
812
813 =head2 Upgrading overlay from g-cpan
814
815 # g-cpan -u
816
817 =head2 Upgrading specifc ebuild in overlay from g-cpan
818
819 # g-cpan -u Mickey-Mouse
820
821 =head1 Todo
822
823 Versioned dependency checking - write ebuilds to contain the dep'd version if its greater than 0 in the source.
824
825
826 =head1 See Also
827
828 L<B<emerge>(1)>, L<B<ebuild>(5)>, L<B<make.conf>(5)>, L<B<perl>(1)>
829
830 =head1 Authors
831
832 mcummings <mcummings@gentoo.org> cab <cab@dragou.net> sniper <sniper@mongueurs.net> beu <beu@gentoo.org> J Robert Ray <jrray@gentoo.org> (g-cpan) RAC <rac@gentoo.org> Sven Vermeulen <swift@gentoo.org> (Original manpage)
833
834 =head1 Reporting Bugs
835
836 Please report bugs via http://bugs.gentoo.org/ or https://bugs.gentoo.org/
837
838 =head1 cvs Header $Header: $
839
840 =cut

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20