/[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 75 - (show annotations) (download)
Tue Jun 6 21:54:58 2006 UTC (8 years, 6 months ago) by mcummings
File size: 27993 byte(s)
bug 135783


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

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20