use vars qw( @EXPORT @ISA $VERSION );
@EXPORT = qw( shell fetch get install );
@ISA = qw( Exporter );
- $VERSION = "0.8601"; #have to hardcode or cpan.org gets unhappy
+ $VERSION = "0.87_01"; #have to hardcode or cpan.org gets unhappy
}
### purely for backward compatibility, so we can call it from the commandline:
use FileHandle;
use File::Spec ();
use File::Spec::Unix ();
+use File::Basename ();
use Params::Check qw[check];
use Locale::Maketext::Simple Class => 'CPANPLUS', Style => 'gettext';
=pod
-=head2 $mod_obj = $cb->parse_module( module => $modname|$distname|$modobj|URI )
+=head2 $mod_obj = $cb->parse_module( module => $modname|$distname|$modobj|URI|PATH )
C<parse_module> tries to find a C<CPANPLUS::Module> object that
matches your query. Here's a list of examples you could give to
=item file:///tmp/Text-Bastardize-1.06.tar.gz
+=item /tmp/Text-Bastardize-1.06
+
+=item ./Text-Bastardize-1.06
+
+=item .
+
=back
These items would all come up with a C<CPANPLUS::Module> object for
would give back a C<CPANPLUS::Module> object of that version.
Even if the version on CPAN is currently higher.
+The last three are examples of PATH resolution. In the first, we supply
+an absolute path to the unwrapped distribution. In the second the
+distribution is relative to the current working directory.
+In the third, we will use the current working directory.
+
If C<parse_module> is unable to actually find the module you are looking
for in its module tree, but you supplied it with an author, module
and version part in a distribution name or URI, it will create a fake
return $maybe if IS_MODOBJ->( module => $maybe );
}
+ ### Special case arbitary file paths such as '.' etc.
+ if (-d File::Spec->rel2abs($mod) ) {
+ my $dir = File::Spec->rel2abs($mod);
+ my $parent = File::Spec->rel2abs( File::Spec->catdir( $dir, '..' ) );
+
+ my $dist = $mod = File::Basename::basename($dir);
+ $dist .= '-0' unless $dist =~ /\-[0-9._]+$/;
+ $dist .= '.tar.gz' unless $dist =~ /\.[A-Za-z]+$/;
+
+ my $modobj = CPANPLUS::Module::Fake->new(
+ module => $mod,
+ version => 0,
+ package => $dist,
+ path => $parent,
+ author => CPANPLUS::Module::Author::Fake->new
+ );
+
+ ### better guess for the version
+ $modobj->version( $modobj->package_version )
+ if defined $modobj->package_version;
+
+ ### better guess at module name, if possible
+ if ( my $pkgname = $modobj->package_name ) {
+ $pkgname =~ s/-/::/g;
+
+ ### no sense replacing it unless we changed something
+ $modobj->module( $pkgname )
+ if ($pkgname ne $modobj->package_name) || $pkgname !~ /-/;
+ }
+
+ $modobj->status->fetch( $parent );
+ $modobj->status->extract( $dir );
+ $modobj->get_installer_type;
+ return $modobj;
+ }
+
### ok, so it looks like a distribution then?
my @parts = split '/', $mod;
my $dist = pop @parts;
=item editor
A string holding the path to your editor of choice. Defaults to your
-$ENV{EDITOR}, $ENV{VISIUAL}, 'vi' or 'pico' programs, in that order.
+$ENV{EDITOR}, $ENV{VISUAL}, 'vi' or 'pico' programs, in that order.
=cut
unless( $doc ) {
error(loc( "Could not read %1: '%2'", $meta, $@ ));
- return;
+ return $configure_requires; # Causes problems if we don't return a hashref
}
### read the configure_requires key, make sure not to throw
package CPANPLUS::Dist::MM;
+use warnings;
use strict;
use vars qw[@ISA $STATUS];
use base 'CPANPLUS::Dist::Base';
}
my $args;
- my( $force, $verbose, $perl, $mmflags, $prereq_target, $prereq_format,
+ my( $force, $verbose, $perl, @mmflags, $prereq_target, $prereq_format,
$prereq_build );
{ local $Params::Check::ALLOW_UNKNOWN = 1;
my $tmpl = {
perl => { default => $^X, store => \$perl },
makemakerflags => { default =>
$conf->get_conf('makemakerflags') || '',
- store => \$mmflags },
+ store => \$mmflags[0] },
force => { default => $conf->get_conf('force'),
store => \$force },
verbose => { default => $conf->get_conf('verbose'),
# my $cmd = "$perl $flush $makefile_pl $mmflags";
my $run_perl = $conf->get_program('perlwrapper');
- my $cmd = "$perl $run_perl $makefile_pl $mmflags";
+ my $cmd = [$perl, $run_perl, $makefile_pl, @mmflags];
### set ENV var to tell underlying code this is what we're
### executing.
my $args;
my( $force, $verbose, $make, $makeflags, $skiptest, $prereq_target, $perl,
- $mmflags, $prereq_format, $prereq_build);
+ @mmflags, $prereq_format, $prereq_build);
{ local $Params::Check::ALLOW_UNKNOWN = 1;
my $tmpl = {
perl => { default => $^X, store => \$perl },
CPANPLUS::Internals::Report
];
-$VERSION = "0.8601";
+$VERSION = "0.87_01";
=pod
return join '::', (caller(2+$lvl))[3]
};
use constant PERL_CORE => 'perl';
+use constant STORABLE_EXT => '.stored';
use constant GET_XS_FILES => sub { my $dir = $_[0] or return;
require File::Find;
uptodate => $uptodate,
path => $path,
verbose => $verbose,
- );
+ ) or return;
### and now the module tree
$self->_create_mod_tree(
uptodate => $uptodate,
path => $path,
verbose => $verbose,
- );
+ ) or return;
}
### XXX unpleasant hack. since custom sources uses ->parse_module, we
$ae->extract( to => $out ) or return;
}
- my $cont = $self->_get_file_contents( file => $out ) or return;
+ my $content = $self->_get_file_contents( file => $out ) or return;
+ my $lines = $content =~ tr/\n/\n/;
### don't need it anymore ###
unlink $out;
- my $flag;
-
- for ( split /\n/, $cont ) {
+ my($past_header, $count);
+ for ( split /\n/, $content ) {
### quick hack to read past the header of the file ###
### this is still rather evil... fix some time - Kane
- $flag = 1 if m|^\s*$|;
- next unless $flag;
-
+ if( m|^\s*$| ) {
+ unless( $count ) {
+ error(loc("Could not determine line count from %1", $file));
+ return;
+ }
+ $past_header = 1;
+ }
+
+ ### we're still in the header -- find the amount of lines we expect
+ unless( $past_header ) {
+
+ ### if the line count doesn't match what we expect, bail out
+ ### this should address: #45644: detect broken index
+ $count = $1 if /^Line-Count:\s+(\d+)/;
+ if( $count ) {
+ if( $lines < $count ) {
+ error(loc("Expected to read at least %1 lines, but %2 ".
+ "contains only %3 lines!",
+ $count, $file, $lines ));
+ return;
+ }
+ }
+ ### still in the header, keep moving
+ next;
+ }
+
### skip empty lines ###
next unless /\S/;
chomp;
File::Spec->catfile(
$path, #base dir
$conf->_get_source('stored') #file
- . '.' .
+ . '.s' .
$Storable::VERSION #the version of storable
- . '.stored' #append a suffix
+ . '.c' .
+ $self->VERSION #the version of CPANPLUS
+ . STORABLE_EXT #append a suffix
)
);
### ok, so it's a 'build' installer, but you don't /have/ module build
### XXX duplicated from CPANPLUS::Selfupdate. fix somehow?
- if( $type eq INSTALLER_BUILD and (
+ if( $type and $type eq INSTALLER_BUILD and (
not CPANPLUS::Dist->has_dist_type( INSTALLER_BUILD )
or not $cb->module_tree( INSTALLER_BUILD )
->is_uptodate( version => '0.24' )
BEGIN {
use vars qw[ $VERSION @ISA ];
@ISA = qw[ CPANPLUS::Shell::_Base::ReadLine ];
- $VERSION = "0.8601";
+ $VERSION = "0.87_01";
}
load CPANPLUS::Shell;
cpanp> i Acme::Foo # install Acme::Foo
cpanp> i Acme-Foo-1.3 # install version 1.3 of Acme::Foo
cpanp> i <URI> # install from URI, like ftp://foo.com/X.tgz
+ cpanp> i <DIR> # install from an absolute or relative directory
cpanp> i 1 3..5 # install search results 1, 3, 4 and 5
cpanp> i * # install all search results
cpanp> a KANE; i *; # find modules by kane, install all results
loc('[Operations]' ),
loc(' i MODULE | NUMBER ... # install module(s), by name or by search number' ),
loc(' i URI | ... # install module(s), by URI (ie http://foo.com/X.tgz)' ),
-loc(' t MODULE | NUMBER ... # test module(s), by name or by search number' ),
+loc(' i DIR | ... # install module(s), by path (ie ./Module-1.0)' ),
+\loc(' t MODULE | NUMBER ... # test module(s), by name or by search number' ),
loc(' u MODULE | NUMBER ... # uninstall module(s), by name or by search number' ),
loc(' d MODULE | NUMBER ... # download module(s)' ),
loc(' l MODULE | NUMBER ... # display detailed information about module(s)' ),
'IO-Stty',
'.02',
],
+ '.' => [
+ 'CPANPLUS',
+ 't',
+ '',
+ ],
);
while ( my($guess, $attr) = splice @map, 0, 2 ) {
SKIP: { ### EU::Installed tests ###
+ ### EU::I sometimes fails. See:
+ ### #43292: ~/CPANPLUS-0.85_04 fails t/20_CPANPLUS-Dist-MM.t
+ ### #46890: ExtUtils::Installed + EU::MM PREFIX= don't always work
+ ### well together
+ skip( "ExtUtils::Installed issue #46890 prevents these tests from running reliably", 8 );
+
skip( "Old perl on cygwin detected " .
"-- tests will fail due to known bugs", 8
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz lib/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("%_EO$4``S`Q;6%I;')C+G1X=`!+S,E,+%9P#8T(5@`#)=>*DM"2S)QB
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("!1%OT4"`T)U;F1L92U&;V\M0F%R+3`N,#$N=&%R`.V7:V_:,!2&^8I_
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL(`#P*BD<``^V:;6_B1A"`\WE_Q214(I$.QQ@;)*<YE;M"$^E(JB37GG0]
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/perl5.005_03.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/perl5.005_03.tar.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL(`'3DO44``^W/,0J`,`Q`T1RE)Y"T-O4XXN"DB%2]OR(*NNC4[;_E#\F0
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/EUXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/EUXS/Foo-Bar-0.01.tar.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("`DY34("`T9O;RU"87(M,"XP,2YT87(`[5IK3]M(%,U7YE=<H%5``A.;
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/MBNOXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/MBNOXS/Foo-Bar-0.01.tar.gz.packed
-Created at Sun Apr 26 20:33:20 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("-<X34(``T9O;RU"87(M,"XP,2YT87(`[9E;;]HP%,=Y]J<X+9722@-R
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/authors/id/MBXS/Foo-Bar-0.01.tar.gz lib/CPANPLUS/t/dummy-CPAN/authors/id/MBXS/Foo-Bar-0.01.tar.gz.packed
-Created at Sun Apr 26 20:33:21 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("-\X34(``T9O;RU"87(M,"XP,2YT87(`[5K_3QI)%/=7YZ]XU39H(BN[
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz lib/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz.packed
-Created at Sun Apr 26 20:33:21 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
-M'XL("-"H)4<``S`R<&%C:V%G97,N9&5T86EL<RYT>'0`G=-1;],P$`#@=_^*
-M>^`!I,;Q4D63_$136@2T8Z)$VQORXEMKD=B1?5DHOQY[9=JH*#!.EB+9Y\]W
-M5KPT+4IX"%'TJOFJMABX1E*F#9R^$:L_K1YS8$?4RSP?QY'WZ%O>N"Z?7\XN
-M\L[IH<60GU#>8&B\Z<DX&[7+0PI8U6&`6S=8#<:"-AX;<GX/+^Y--=#.^9`;
-MG;.Y:X?.AI^E]$^`"=RA#Q&>Q&G:L7>6T&K4V=)Y";.!7*<(-=PB-3OP;B!C
-M,4P.AT<(0;MFZ-"22N5Q=N4-12*K]NFTKM4FT*C2YI=W4/"I*%[!S1YF5GM4
-M@7]P:,WVM;*F4[%GMHI\-H\]4=I^)L[+DJU4H*SN=2I$PA7J"4P%O%<6"B$*
-M$*4LXCB'M^O/C"V=D[)27LI%+>7U!HY"<'&6OHOZ>I/'Y"SF9FF2D_)\^_T)
-ML*[^!*RK?P(N/AX3CT!:^PN1FCA-+.IG$%)NAIO_(8YOX!E$%7_.^$SD*>J(
-B.*1GOY/FHSY5QWT4OTKI?95<B/*+F#X0[`?@'LWVLP,`````
+M'XL("#=P,DH``S`R<&%C:V%G97,N9&5T86EL<RYT>'0`G=-1;],P$`#@=_^*
+M>^`!I,;Q4E5,?J(I+0+:;:)$V]ODQ;?6(K$C^[)0?CWVRK1146`[68IDGS_?
+M6?'"-"CA(431J?J;VF#@&DF9)G#Z3JSZLGS,@2U1)_-\&`;>H6]X[=I\=C$]
+MRUNG^P9#?D1YCZ'VIB/C;-0N]BE@58L!;EUO-1@+VGBLR?D=O+HW54];YT-N
+M=,YFKNE;&WZ5TCT!1G"'/D1X%*=IRSY:0JM19POG)4Q[<JTBU'"+5&_!NYZ,
+MQ3#:'QXA!.WJOD5+*I7'V:4W%(FLW*73VD:;0(-*FU_?0<''HG@#-SN86NU1
+M!?[9H36;=\J:5L6>V3+RV2SV1&G[R2E;JD!9U>E4A81+U",8"_BD+!1"%"`F
+MLHCC+7Q8?65LX9R4I?)2SBLIK]9P$(*+D_2=5U?K/"9G,3=+DYR4YYL?3X!5
+M^3=@5?X7<'9^2#P":>T?1&KB.#&OGD%(N>YO7D(<WL`SB#+^F?&-R&/4`;%/
+@S_XDS09]K([[*'Z7TN.:<"$FUV+\0+"?<7X";+`#````
uupacktool.pl -p lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz lib/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz.packed
-Created at Sun Apr 26 20:33:21 2009
+Created at Fri Jun 12 19:08:08 2009
#########################################################################
__UU__
M'XL("#'FO$4``S`S;6]D;&ES="YD871A`%U3_6O;,!#].?HKCBXC"20A=<@&