1 |
oh so strange to receive emails from yourself without being the one sending |
2 |
them.. :) |
3 |
|
4 |
is it ready (after testing ;p) for .13 release ? |
5 |
(isn't 0.13 a bit weak, considering the changes ? :p) |
6 |
|
7 |
|
8 |
|
9 |
|
10 |
antoine.raillon@ |
11 |
dragou.net |
12 |
Pour |
13 |
16/05/2005 14:38 gentoo-perl@l.g.o |
14 |
cc |
15 |
|
16 |
Veuillez Objet |
17 |
répondre à [gentoo-perl] r33 - in trunk: bin |
18 |
gentoo-perl@gent extra-docs |
19 |
oo.org |
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
Author: mcummings |
30 |
Date: 2005-05-16 14:38:27 +0200 (Mon, 16 May 2005) |
31 |
New Revision: 33 |
32 |
|
33 |
Modified: |
34 |
trunk/bin/g-cpan.pl |
35 |
trunk/extra-docs/Changes |
36 |
trunk/extra-docs/g-cpan.pl.1 |
37 |
Log: |
38 |
updates and cleaning |
39 |
|
40 |
Modified: trunk/bin/g-cpan.pl |
41 |
=================================================================== |
42 |
--- trunk/bin/g-cpan.pl 2005-05-15 18:16:39 UTC (rev 32) |
43 |
+++ trunk/bin/g-cpan.pl 2005-05-16 12:38:27 UTC (rev 33) |
44 |
@@ -7,10 +7,10 @@ |
45 |
# modules to use - these will need to be marked as |
46 |
# dependencies, and installable by portage |
47 |
use strict; |
48 |
-use diagnostics; |
49 |
use File::Spec; |
50 |
use File::Path; |
51 |
use File::Basename; |
52 |
+use File::Copy; |
53 |
use Term::ANSIColor; |
54 |
use Digest::MD5; |
55 |
|
56 |
@@ -57,7 +57,7 @@ |
57 |
Getopt::Long::Configure("bundling"); |
58 |
|
59 |
# Init all options (has to be done to perform the 'sum test' later) |
60 |
-my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask, |
61 |
$noclean ) = ( 0, 0, 0, 0, 0, 0, 0, 0 ); |
62 |
+my ( $verbose, $search, $install, $upgrade, $list, $pretend, $ask ) = ( |
63 |
0, 0, 0, 0, 0, 0, 0 ); |
64 |
|
65 |
#Get & Parse them |
66 |
GetOptions( |
67 |
@@ -68,7 +68,6 @@ |
68 |
'list|l' => \$list, |
69 |
'pretend|p' => \$pretend, |
70 |
'ask|a' => \$ask, |
71 |
- 'noclean|n' => \$noclean, |
72 |
'help|h' => sub { exit_usage(); } |
73 |
) |
74 |
or exit_usage(); |
75 |
@@ -129,7 +128,7 @@ |
76 |
CPAN::Shell->m("/$expr/"); |
77 |
} |
78 |
|
79 |
- clean_the_mess() unless $noclean; |
80 |
+ clean_up(); |
81 |
exit; |
82 |
} |
83 |
|
84 |
@@ -164,15 +163,31 @@ |
85 |
} |
86 |
|
87 |
# Create the ebuild in PORTDIR_OVERLAY, if it is defined and exists |
88 |
-if ( $OVERLAYS[0] ) { |
89 |
- $tmp_overlay_dir = $OVERLAYS[0]; |
90 |
- if ($verbose) { |
91 |
- print_info ("Setting $tmp_overlay_dir as the PORTDIR_OVERLAY for |
92 |
this session."); |
93 |
+# Part of this is to find an overlay the user running this session can |
94 |
actually write to |
95 |
+ |
96 |
+# o_reset will be used to catch if went through all of the overlay dirs |
97 |
successfully - |
98 |
+# open to better ways :) mcummings |
99 |
+my $o_reset = 1; |
100 |
+ |
101 |
+foreach my $o_dir (@OVERLAYS) { |
102 |
+ # See if we can create a file |
103 |
+ if (open (TMP,">$o_dir/g-cpan-test") ) { |
104 |
+ close(TMP); |
105 |
+ unlink("$o_dir/g-cpan-test"); |
106 |
+ $tmp_overlay_dir = $o_dir; |
107 |
+ $o_reset = 0; |
108 |
+ if ($verbose) { print_info ("Setting $tmp_overlay_dir as the |
109 |
PORTDIR_OVERLAY for this session.") } |
110 |
+ last; |
111 |
} |
112 |
} |
113 |
+if ($o_reset > 0) { |
114 |
+ print_err("You don't have permission to work in any of the |
115 |
list overlays."); |
116 |
+ print_err("Please run $prog as a user with sufficient |
117 |
permissions."); |
118 |
+ exit(); |
119 |
+} |
120 |
|
121 |
# Grab the whole available arches list, to include them later in ebuilds |
122 |
-print "Grabbing arch list" if $verbose; |
123 |
+print_info ("Grabbing arch list") if $verbose; |
124 |
my $arches = do { |
125 |
open my $tmp, "<$PORTAGE_DIR/profiles/arch.list" |
126 |
or fatal(ERR_OPEN_READ, "$PORTAGE_DIR/profiles/arch.list", $!); |
127 |
@@ -221,7 +236,7 @@ |
128 |
} |
129 |
|
130 |
if($install or $upgrade) { |
131 |
- clean_up() unless $noclean; |
132 |
+ clean_up(); |
133 |
} |
134 |
|
135 |
exit; |
136 |
@@ -277,10 +292,6 @@ |
137 |
sub get_gcpans { |
138 |
my @g_list; |
139 |
foreach my $sdir ( grep { -d $_ } ( @PORTAGE_DEV_PERL, @OVERLAY_PERLS |
140 |
) ) { |
141 |
- # FIXME Sniper |
142 |
- # Do we really need regexp here ? |
143 |
- # Yes - this is potentially a large list of dirs, and we only |
144 |
want the ones containing the tail perl-gcpan |
145 |
- # - mcummings |
146 |
if ( basename($sdir) eq "perl-gcpan" ) { |
147 |
print_info ("OVERLAY: $sdir") if $list; |
148 |
# FIXME Sniper |
149 |
@@ -503,7 +514,7 @@ |
150 |
# FIXME Sniper |
151 |
# OH MY GOD ! |
152 |
unless ( -f "$PORTAGE_DISTDIR/$localfile" ) { |
153 |
- system( '/bin/mv', '-f', $localfile, $PORTAGE_DISTDIR ); |
154 |
+ move("$localfile", "$PORTAGE_DISTDIR"); |
155 |
} |
156 |
|
157 |
push @ebuild_list, "perl-gcpan/$dir"; |
158 |
@@ -587,7 +598,7 @@ |
159 |
|
160 |
create_ebuild( $obj, $dir, $file, $build_dir, $prereq_pm, |
161 |
$md5string ); |
162 |
unless ( -f "$PORTAGE_DISTDIR/$localfile" ) { |
163 |
- system( '/bin/mv', '-f', $localfile, $PORTAGE_DISTDIR ); |
164 |
+ move("$localfile", "$PORTAGE_DISTDIR"); |
165 |
} |
166 |
push @ebuild_list, "perl-gcpan/$dir"; |
167 |
} |
168 |
@@ -793,18 +804,16 @@ |
169 |
|
170 |
# cab - Simple useful sub. returns md5 hexdigest of the given argument. |
171 |
# awaits a file name. |
172 |
-# FIXME cab : add a test (if -f $file) ? |
173 |
sub file_md5sum { |
174 |
- my ($file) = @_;; |
175 |
+ my ($file) = @_; |
176 |
+ if (-f $file) { |
177 |
print_info ("Computing MD5 Sum of $file") if $verbose; |
178 |
|
179 |
open DIGIFILE, $file or fatal(ERR_OPEN_READ, $file, $!); |
180 |
my $md5digest = Digest::MD5->new->addfile(*DIGIFILE)->hexdigest; |
181 |
- # FIXME Sniper |
182 |
- # here, check the md5sum |
183 |
close DIGIFILE; |
184 |
- |
185 |
- return $md5digest; |
186 |
+ return $md5digest if $md5digest; |
187 |
+ } |
188 |
} |
189 |
|
190 |
# In order to parse strange but allowed constructions, |
191 |
@@ -831,28 +840,15 @@ |
192 |
|
193 |
# cab - Takes care of system's sanity |
194 |
# should try to see if it can be merged with clean_up() |
195 |
-sub clean_the_mess { |
196 |
- if ($verbose) { |
197 |
- print_info ("Now cleaning up the system of all the junk we put in |
198 |
!"); |
199 |
- } |
200 |
- if ($needs_cpan_stub) { |
201 |
- unlink "$ENV{HOME}/.cpan/CPAN/MyConfig.pm"; |
202 |
- |
203 |
- #add something here to take care of the .cpan dir, if not empty |
204 |
- } |
205 |
-} |
206 |
- |
207 |
# TODO Sniper |
208 |
# maybee put this in END {} block |
209 |
sub clean_up { |
210 |
|
211 |
- #Probably don't need to do this, but for sanity's sake, we reset this |
212 |
var |
213 |
- # $ENV{'PORTDIR_OVERLAY'} = $OVERLAYS[0]; |
214 |
- |
215 |
- if ($needs_cpan_stub) { unlink "$ENV{HOME}/.cpan/CPAN/MyConfig.pm" } |
216 |
- |
217 |
#Clean out the /tmp tree we were using |
218 |
- rmtree( ["$tmp_overlay_dir"] ) if ( !$OVERLAYS[0] ); |
219 |
+ #I know this looks weird, but since clean_up is invoked on a search, |
220 |
where OVERLAYS isn't ever defined, |
221 |
+ # we first need to see if it exists, then need to remove only if it |
222 |
has content (the old exists vs. defined) |
223 |
+ if (@OVERLAYS) { rmtree( ["$tmp_overlay_dir"] ) if ( scalar(@OVERLAYS) |
224 |
> 0 ) } |
225 |
+ rmtree( ["$ENV{HOME}/.cpan/build"]) if ( -d "$ENV{HOME}/.cpan/build" |
226 |
); |
227 |
} |
228 |
|
229 |
# cab - nice help message ! ;) |
230 |
@@ -877,9 +873,6 @@ |
231 |
This command generates a list of the Perl modules and ebuilds |
232 |
handled by $prog. |
233 |
|
234 |
-${green}--noclean,-n${reset} |
235 |
- Don't clean up temporary areas after running install or upgrade. |
236 |
- |
237 |
${green}--pretend,-p${reset} |
238 |
Pretend (show actions, but don't emerge). This still generates |
239 |
new ebuilds. |
240 |
|
241 |
Modified: trunk/extra-docs/Changes |
242 |
=================================================================== |
243 |
--- trunk/extra-docs/Changes 2005-05-15 18:16:39 UTC (rev 32) |
244 |
+++ trunk/extra-docs/Changes 2005-05-16 12:38:27 UTC (rev 33) |
245 |
@@ -1,3 +1,9 @@ |
246 |
+16/05/2005 - mcummings |
247 |
+ |
248 |
+- Checks for write privs in overlays and choosing the correct overlay |
249 |
based on that |
250 |
+- cleaned up the multiple cleanup blocks |
251 |
+- Updated the man pages. Left out cab's and sniper's email in case they |
252 |
didn't want them published (so fill it in if you do :) ) |
253 |
+ |
254 |
15/05/2005 - mcummings |
255 |
|
256 |
- Added check to make sure @ebuild_list had contents before trying to run |
257 |
emerge - less chance of emerge just junking out on us. |
258 |
|
259 |
Modified: trunk/extra-docs/g-cpan.pl.1 |
260 |
=================================================================== |
261 |
--- trunk/extra-docs/g-cpan.pl.1 2005-05-15 18:16:39 UTC (rev 32) |
262 |
+++ trunk/extra-docs/g-cpan.pl.1 2005-05-16 12:38:27 UTC (rev 33) |
263 |
@@ -1,33 +1,106 @@ |
264 |
.TH "G-CPAN.PL" "1" "Feb 2004" "Portage 2.0.51" "Portage" |
265 |
.SH NAME |
266 |
-g-cpan.pl \- install CPAN-provided Perl modules using Gentoo's Portage |
267 |
+g-cpan \- install CPAN-provided Perl modules using Gentoo's Portage |
268 |
.SH SYNOPSIS |
269 |
-\fBg-cpan.pl\fR [\ \fB\-v\fR\ ] <\fImodule-name\fR> |
270 |
+\fBg-cpan.pl\fR |
271 |
+[\ \fB\-a\fR\ | \fB\--ask\fR\ ] |
272 |
+[\ \fB\-i\fR\ | \fB\--install\fR\ ] |
273 |
+[\ \fB\-l\fR\ | \fB\--list \fR\ ] |
274 |
+[\ \fB\-p\fR\ | \fB\--pretend \fR\ ] |
275 |
+[\ \fB\-s\fR\ | \fB\--search \fR\ ] |
276 |
+[\ \fB\-u\fR\ | \fB\--upgrade \fR\ ] |
277 |
+[\ \fB\-v\fR\ | \fB\--verbose\fR\ ] |
278 |
+<\fImodule-name\fR> |
279 |
.SH "DESCRIPTION" |
280 |
-.B g-cpan.pl |
281 |
+.IX HEADER "DESCRIPTION" |
282 |
+.B g-cpan |
283 |
is a perl script that installs a CPAN module (including its |
284 |
dependencies) using Gentoo's Portage. It saves dependency information and |
285 |
|
286 |
-stored files as if they were installed through a regular ebuild. |
287 |
+stored files as if they were installed through a regular ebuild. |
288 |
|
289 |
-The first time you run \fBg-cpan.pl\fR, it will ask you to setup your CPAN |
290 |
-environment. Most users can agree with the defaults asked. |
291 |
+.SH "CPAN CONFIGURATION" |
292 |
+.IX HEADER "CPAN CONFIGURATION" |
293 |
+ |
294 |
+\fB~/.cpan/CPAN/MyConfig.pm\fR |
295 |
+ |
296 |
+\fB/path/to/perl/CPAN/Config.pm\fR |
297 |
+ |
298 |
+When you run \fBg-cpan\fR, it will check for two configuration files. If |
299 |
you are root, it will check for the presense of an already configured CPAN |
300 |
under your perl install path. If CPAN is not configured, or you are not |
301 |
root, g-cpan will create a generic configuration for CPAN in ~/.cpan/CPAN/ |
302 |
called MyConfig.pm. You can modify this file as needed at any time. |
303 |
+ |
304 |
+The CPAN configuration file is used for interacting with CPAN, determining |
305 |
what modules are available, what modules are needed, and performing all |
306 |
basic CPAN functions. |
307 |
+ |
308 |
+.SH "G-CPAN AND OVERLAYS" |
309 |
+.IX HEADER "G-CPAN AND OVERLAYS" |
310 |
+ |
311 |
+\fBg-cpan\fR is now overlay "friendly." \fBg-cpan\fR will scan both the |
312 |
overlays provided in your make.conf |
313 |
+as well as any you have set via environment variables, to help determine |
314 |
its course of action. If you have |
315 |
+defined overlays, \fBg-cpan\fR will use the first overlay in your list |
316 |
that the user running it can write to. |
317 |
+Any ebuilds generated by \fBg-cpan\fR will be stored in this overlay for |
318 |
future use (such as upgrading). |
319 |
+ |
320 |
+If no overlays are defined, or the user operating \fBg-cpan\fR cannot |
321 |
write to an overlay, then anything generated will be written to a temporary |
322 |
space and wiped on exit. |
323 |
+ |
324 |
.SH "ARGUMENTS" |
325 |
-.B -v |
326 |
+.IX HEADER "ARGUMENTS" |
327 |
+ |
328 |
+.IP "\fB\-a,\-\-ask\fR" 4 |
329 |
+.IX Item "-a,--ask" |
330 |
+Pass the "ask" argument to portage. This will cause portage to prompt you |
331 |
to confirm your installation prior to issuing an emerge |
332 |
+ |
333 |
+.IP "\fB\-i,\-\-install\fR" 4 |
334 |
+.IX Item "-i,--install" |
335 |
+Install the (list of) modules provided. |
336 |
+ |
337 |
+.IP "\fB\-l,\-\-list\fR" 4 |
338 |
+.IX Item "-l,--list" |
339 |
+List ebuilds that have been generated by g-cpan and reside in your |
340 |
overlay. |
341 |
+ |
342 |
+.IP "\fB\-p,\-\-pretend\fR" 4 |
343 |
+.IX Item "-p,--pretend" |
344 |
+Create ebuilds as needed for the (list of) modules provided, but don't |
345 |
perform the actual emerge. |
346 |
+ |
347 |
+.IP "\fB\-s,\-\-search\fR" 4 |
348 |
+.IX Item "-s,--search" |
349 |
+Search CPAN for the provided module. |
350 |
+ |
351 |
+.IP "\fB\-u,\-\-upgrade\fR" 4 |
352 |
+.IX Item "-u,--upgrade" |
353 |
+Attempt to upgrade any ebuilds generated by g-cpan to newer versions. This |
354 |
option will create new ebuilds for those that exist in your overlay |
355 |
already. If a module name is given, it will attempt to only upgrade the |
356 |
requested module. If no arguments are given, all modules in your g-cpan |
357 |
overlay will be checked. |
358 |
+ |
359 |
+.IP "\fB\-v,\-\-verbose\fR" 4 |
360 |
+.IX Item "-v,--verbose" |
361 |
Enable verbose mode for more feedback on the step by step processes that |
362 |
g-cpan is running |
363 |
-.SH "EXAMPLES" |
364 |
-Here we install Jabber::RPC |
365 |
|
366 |
-# \fBg-cpan.pl Jabber::RPC\fR |
367 |
+.SH "USAGE" |
368 |
+.IX HEADER "USAGE" |
369 |
+ |
370 |
+.IP "Here we install Jabber::RPC" 4 |
371 |
+# \fBg-cpan -i Jabber::RPC\fR |
372 |
+ |
373 |
+.IP "Performing a search" 4 |
374 |
+# \fBg-cpan -s Clone::Any\fR |
375 |
+ |
376 |
+.IP "Upgrading overlay from g-cpan" 4 |
377 |
+# \fBg-cpan -u\fR |
378 |
+ |
379 |
+.IP "Upgrading specifc ebuild in overlay from g-cpan" 4 |
380 |
+# \fBg-cpan -u Mickey-Mouse\fR |
381 |
+ |
382 |
.SH "AUTHORS" |
383 |
+mcummings <mcummings@g.o> |
384 |
+.br |
385 |
+cab |
386 |
+.br |
387 |
+sniper |
388 |
+.br |
389 |
+beu <beu@g.o> |
390 |
+.br |
391 |
J Robert Ray <jrray@g.o> (g-cpan.pl) |
392 |
.br |
393 |
RAC <rac@g.o> |
394 |
.br |
395 |
-mcummings <mcummings@g.o> |
396 |
-.br |
397 |
-Sven Vermeulen <swift@g.o> (manpage) |
398 |
+Sven Vermeulen <swift@g.o> (Original manpage) |
399 |
.SH "REPORTING BUGS" |
400 |
-Please report bugs via http://bugs.gentoo.org/ |
401 |
+Please report bugs via http://bugs.gentoo.org/ or https://bugs.gentoo.org/ |
402 |
.SH "CVS HEADER" |
403 |
-$Header: /var/cvsroot/gentoo/users/mcummings/g-cpan/g-cpan-0.12 |
404 |
/man/g-cpan.pl.1,v 1.1 2005/04/30 21:44:15 mcummings Exp $ |
405 |
+$Header: $ |
406 |
|
407 |
|
408 |
-- |
409 |
gentoo-perl@g.o mailing list |
410 |
|
411 |
|
412 |
|
413 |
|
414 |
-- |
415 |
gentoo-perl@g.o mailing list |