Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-perl
Navigation:
Lists: gentoo-perl: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-perl@g.o
From: antoine.raillon@...
Subject: r33 - in trunk: bin extra-docs
Date: Mon, 16 May 2005 14:38:28 +0200 (CEST)
Author: mcummings
Date: 2005-05-16 14:38:27 +0200 (Mon, 16 May 2005)
New Revision: 33

Modified:
   trunk/bin/g-cpan.pl
   trunk/extra-docs/Changes
   trunk/extra-docs/g-cpan.pl.1
Log:
updates and cleaning

Modified: trunk/bin/g-cpan.pl
===================================================================
--- trunk/bin/g-cpan.pl	2005-05-15 18:16:39 UTC (rev 32)
+++ trunk/bin/g-cpan.pl	2005-05-16 12:38:27 UTC (rev 33)
@@ -7,10 +7,10 @@
 # modules to use - these will need to be marked as
 # dependencies, and installable by portage
 use strict;
-use diagnostics;
 use File::Spec;
 use File::Path;
 use File::Basename;
+use File::Copy;
 use Term::ANSIColor;
 use Digest::MD5;
 
@@ -57,7 +57,7 @@
 Getopt::Long::Configure("bundling");
 
 # Init all options (has to be done to perform the 'sum test' later)
-my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask, $noclean ) = ( 0, 0, 0, 0, 0, 0, 0, 0 );
+my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask  ) = ( 0, 0, 0, 0, 0, 0, 0 );
 
 #Get & Parse them
 GetOptions(
@@ -68,7 +68,6 @@
     'list|l'    => \$list,
     'pretend|p' => \$pretend,
     'ask|a'     => \$ask,
-    'noclean|n' => \$noclean,
     'help|h'    => sub { exit_usage(); }
   )
   or exit_usage();
@@ -129,7 +128,7 @@
         CPAN::Shell->m("/$expr/");
     }
 
-    clean_the_mess() unless $noclean;
+    clean_up();
     exit;
 }
 
@@ -164,15 +163,31 @@
 }
 
 # Create the ebuild in PORTDIR_OVERLAY, if it is defined and exists
-if ( $OVERLAYS[0] ) {
-    $tmp_overlay_dir = $OVERLAYS[0];
-    if ($verbose) {
-        print_info ("Setting $tmp_overlay_dir as the PORTDIR_OVERLAY for this session.");
+# Part of this is to find an overlay the user running this session can actually write to
+
+# o_reset will be used to catch if went through all of the overlay dirs successfully - 
+# open to better ways :) mcummings
+my $o_reset = 1;
+
+foreach my $o_dir (@OVERLAYS) {
+    # See if we can create a file
+    if (open (TMP,">$o_dir/g-cpan-test") ) {
+    	close(TMP);
+	unlink("$o_dir/g-cpan-test");
+    	$tmp_overlay_dir = $o_dir;
+	$o_reset = 0;
+    	if ($verbose) { print_info ("Setting $tmp_overlay_dir as the PORTDIR_OVERLAY for this session.") }
+	last;
     }
 }
+if ($o_reset > 0) { 
+	print_err("You don't have permission to work in any of the list overlays.");
+	print_err("Please run $prog as a user with sufficient permissions.");
+	exit();
+}
 
 # Grab the whole available arches list, to include them later in ebuilds
-print "Grabbing arch list" if $verbose;
+print_info ("Grabbing arch list") if $verbose;
 my $arches = do {
         open my $tmp, "<$PORTAGE_DIR/profiles/arch.list"
           or fatal(ERR_OPEN_READ, "$PORTAGE_DIR/profiles/arch.list", $!);
@@ -221,7 +236,7 @@
 }
 
 if($install or $upgrade) {
-    clean_up() unless $noclean;
+    clean_up();
 }
 
 exit;
@@ -277,10 +292,6 @@
 sub get_gcpans {
     my @g_list;
     foreach my $sdir ( grep { -d $_ } ( @PORTAGE_DEV_PERL, @OVERLAY_PERLS ) ) {
-        # FIXME Sniper
-        # Do we really need regexp here ?
-	# Yes - this is potentially a large list of dirs, and we only want the ones containing the tail perl-gcpan
-	# - mcummings
         if ( basename($sdir) eq "perl-gcpan" ) {
     	    print_info ("OVERLAY: $sdir") if $list;
             # FIXME Sniper
@@ -503,7 +514,7 @@
     # FIXME Sniper
     # OH MY GOD !
     unless ( -f "$PORTAGE_DISTDIR/$localfile" ) {
-       system( '/bin/mv', '-f', $localfile, $PORTAGE_DISTDIR );
+       move("$localfile", "$PORTAGE_DISTDIR");
     }
 
     push @ebuild_list, "perl-gcpan/$dir";
@@ -587,7 +598,7 @@
 
     	create_ebuild( $obj, $dir, $file, $build_dir, $prereq_pm, $md5string );
     	unless ( -f "$PORTAGE_DISTDIR/$localfile" ) {
-        	system( '/bin/mv', '-f', $localfile, $PORTAGE_DISTDIR );
+       		move("$localfile", "$PORTAGE_DISTDIR");
     	}
         push @ebuild_list, "perl-gcpan/$dir";
     }
@@ -793,18 +804,16 @@
 
 # cab - Simple useful sub. returns md5 hexdigest of the given argument.
 # awaits a file name.
-# FIXME cab : add a test (if -f $file) ?
 sub file_md5sum {
-    my ($file) = @_;;
+    my ($file) = @_;
+    if (-f $file) {
     print_info ("Computing MD5 Sum of $file") if $verbose;
 
     open DIGIFILE, $file or fatal(ERR_OPEN_READ, $file, $!);
     my $md5digest = Digest::MD5->new->addfile(*DIGIFILE)->hexdigest;
-    # FIXME Sniper
-    # here, check the md5sum
     close DIGIFILE;
-
-    return $md5digest;
+    return $md5digest if $md5digest;
+    }
 }
 
 # In order to parse strange but allowed constructions,
@@ -831,28 +840,15 @@
 
 # cab - Takes care of system's sanity
 # should try to see if it can be merged with clean_up()
-sub clean_the_mess {
-    if ($verbose) {
-        print_info ("Now cleaning up the system of all the junk we put in !");
-    }
-    if ($needs_cpan_stub) {
-        unlink "$ENV{HOME}/.cpan/CPAN/MyConfig.pm";
-
-        #add something here to take care of the .cpan dir, if not empty
-    }
-}
-
 # TODO Sniper
 # maybee put this in END {} block
 sub clean_up {
 
-    #Probably don't need to do this, but for sanity's sake, we reset this var
-    #     $ENV{'PORTDIR_OVERLAY'} = $OVERLAYS[0];
-
-    if ($needs_cpan_stub) { unlink "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" }
-
     #Clean out the /tmp tree we were using
-    rmtree( ["$tmp_overlay_dir"] ) if ( !$OVERLAYS[0] );
+    #I know this looks weird, but since clean_up is invoked on a search, where OVERLAYS isn't ever defined,
+    # we first need to see if it exists, then need to remove only if it has content (the old exists vs. defined)
+    if (@OVERLAYS) { rmtree( ["$tmp_overlay_dir"] ) if ( scalar(@OVERLAYS) > 0 ) }
+    rmtree( ["$ENV{HOME}/.cpan/build"]) if ( -d "$ENV{HOME}/.cpan/build" );
 }
 
 # cab - nice help message ! ;)
@@ -877,9 +873,6 @@
     This command generates a list of the Perl modules and ebuilds
     handled by $prog.
 
-${green}--noclean,-n${reset}
-    Don't clean up temporary areas after running install or upgrade.
-
 ${green}--pretend,-p${reset}
     Pretend (show actions, but don't emerge). This still generates
     new ebuilds.

Modified: trunk/extra-docs/Changes
===================================================================
--- trunk/extra-docs/Changes	2005-05-15 18:16:39 UTC (rev 32)
+++ trunk/extra-docs/Changes	2005-05-16 12:38:27 UTC (rev 33)
@@ -1,3 +1,9 @@
+16/05/2005 - mcummings
+
+- Checks for write privs in overlays and choosing the correct overlay based on that
+- cleaned up the multiple cleanup blocks
+- Updated the man pages. Left out cab's and sniper's email in case they didn't want them published (so fill it in if you do :) )
+
 15/05/2005 - mcummings
 
 - Added check to make sure @ebuild_list had contents before trying to run emerge - less chance of emerge just junking out on us.

Modified: trunk/extra-docs/g-cpan.pl.1
===================================================================
--- trunk/extra-docs/g-cpan.pl.1	2005-05-15 18:16:39 UTC (rev 32)
+++ trunk/extra-docs/g-cpan.pl.1	2005-05-16 12:38:27 UTC (rev 33)
@@ -1,33 +1,106 @@
 .TH "G-CPAN.PL" "1" "Feb 2004" "Portage 2.0.51" "Portage"
 .SH NAME
-g-cpan.pl \- install CPAN-provided Perl modules using Gentoo's Portage
+g-cpan \- install CPAN-provided Perl modules using Gentoo's Portage
 .SH SYNOPSIS
-\fBg-cpan.pl\fR [\ \fB\-v\fR\ ] <\fImodule-name\fR>
+\fBg-cpan.pl\fR 
+[\ \fB\-a\fR\ | \fB\--ask\fR\ ] 
+[\ \fB\-i\fR\ | \fB\--install\fR\ ] 
+[\ \fB\-l\fR\ | \fB\--list \fR\ ] 
+[\ \fB\-p\fR\ | \fB\--pretend \fR\ ]
+[\ \fB\-s\fR\ | \fB\--search \fR\ ]
+[\ \fB\-u\fR\ | \fB\--upgrade \fR\ ]
+[\ \fB\-v\fR\ | \fB\--verbose\fR\ ] 
+<\fImodule-name\fR>
 .SH "DESCRIPTION"
-.B g-cpan.pl
+.IX HEADER "DESCRIPTION"
+.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.
+stored files as if they were installed through a regular ebuild. 
 
-The first time you run \fBg-cpan.pl\fR, it will ask you to setup your CPAN
-environment.  Most users can agree with the defaults asked.
+.SH "CPAN CONFIGURATION"
+.IX HEADER "CPAN CONFIGURATION"
+
+\fB~/.cpan/CPAN/MyConfig.pm\fR
+
+\fB/path/to/perl/CPAN/Config.pm\fR
+
+When you run \fBg-cpan\fR, 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.
+
+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.
+
+.SH "G-CPAN AND OVERLAYS"
+.IX HEADER "G-CPAN AND OVERLAYS"
+
+\fBg-cpan\fR is now overlay "friendly." \fBg-cpan\fR 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, \fBg-cpan\fR will use the first overlay in your list that the user running it can write to.
+Any ebuilds generated by \fBg-cpan\fR will be stored in this overlay for future use (such as upgrading).
+
+If no overlays are defined, or the user operating \fBg-cpan\fR cannot write to an overlay, then anything generated will be written to a temporary space and wiped on exit.
+
 .SH "ARGUMENTS"
-.B -v
+.IX HEADER "ARGUMENTS"
+
+.IP "\fB\-a,\-\-ask\fR" 4
+.IX Item "-a,--ask"
+Pass the "ask" argument to portage. This will cause portage to prompt you to confirm your installation prior to issuing an emerge
+
+.IP "\fB\-i,\-\-install\fR" 4
+.IX Item "-i,--install"
+Install the (list of) modules provided.
+
+.IP "\fB\-l,\-\-list\fR" 4
+.IX Item "-l,--list"
+List ebuilds that have been generated by g-cpan and reside in your overlay.
+
+.IP "\fB\-p,\-\-pretend\fR" 4
+.IX Item "-p,--pretend"
+Create ebuilds as needed for the (list of) modules provided, but don't perform the actual emerge.
+
+.IP "\fB\-s,\-\-search\fR" 4
+.IX Item "-s,--search"
+Search CPAN for the provided module.
+
+.IP "\fB\-u,\-\-upgrade\fR" 4
+.IX Item "-u,--upgrade"
+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.
+
+.IP "\fB\-v,\-\-verbose\fR" 4
+.IX Item "-v,--verbose"
 Enable verbose mode for more feedback on the step by step processes that
 g-cpan is running
-.SH "EXAMPLES"
-Here we install Jabber::RPC
 
-# \fBg-cpan.pl Jabber::RPC\fR
+.SH "USAGE"
+.IX HEADER "USAGE"
+
+.IP "Here we install Jabber::RPC" 4
+# \fBg-cpan -i Jabber::RPC\fR
+
+.IP "Performing a search" 4
+# \fBg-cpan -s Clone::Any\fR
+
+.IP "Upgrading overlay from g-cpan" 4
+# \fBg-cpan -u\fR
+
+.IP "Upgrading specifc ebuild in overlay from g-cpan" 4
+# \fBg-cpan -u Mickey-Mouse\fR
+
 .SH "AUTHORS"
+mcummings <mcummings@g.o>
+.br
+cab
+.br
+sniper
+.br
+beu <beu@g.o>
+.br
 J Robert Ray <jrray@g.o> (g-cpan.pl)
 .br
 RAC <rac@g.o> 
 .br
-mcummings <mcummings@g.o>
-.br
-Sven Vermeulen <swift@g.o> (manpage)
+Sven Vermeulen <swift@g.o> (Original manpage)
 .SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/
+Please report bugs via http://bugs.gentoo.org/ or https://bugs.gentoo.org/
 .SH "CVS HEADER"
-$Header: /var/cvsroot/gentoo/users/mcummings/g-cpan/g-cpan-0.12/man/g-cpan.pl.1,v 1.1 2005/04/30 21:44:15 mcummings Exp $
+$Header: $


-- 
gentoo-perl@g.o mailing list

Replies:
Réf. : r33 - in trunk: bin extra-docs
-- antoine . raillon
Navigation:
Lists: gentoo-perl: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
[g-cpan] last call for bugs
Next by thread:
Réf. : r33 - in trunk: bin extra-docs
Previous by date:
Réf. : Re: [g-cpan] last call for bugs
Next by date:
Réf. : r33 - in trunk: bin extra-docs


Updated Jun 17, 2009

Summary: Archive of the gentoo-perl mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.