r74902 - in /branches/upstream/perlbrew/current: ./ bin/ lib/App/ t/ t/mock_perlbrew_root/ t/mock_perlbrew_root/perls/ t/mock_perlbrew_root/perls/perl-5.14.0/ t/mock_perlbrew_root/perls/perl-5.14.0/bin/ t/mock_perlbrew_root/perls/the-dude/ t/mock_perlbrew_root/perls/the-dude/bin/
ghedo-guest at users.alioth.debian.org
ghedo-guest at users.alioth.debian.org
Fri May 27 16:18:41 UTC 2011
Author: ghedo-guest
Date: Fri May 27 16:18:27 2011
New Revision: 74902
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74902
Log:
[svn-upgrade] new version perlbrew (0.22)
Added:
branches/upstream/perlbrew/current/t/07.argv.t
branches/upstream/perlbrew/current/t/installation.t
branches/upstream/perlbrew/current/t/mock_perlbrew_root/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl (with props)
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/
branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl (with props)
Modified:
branches/upstream/perlbrew/current/Changes
branches/upstream/perlbrew/current/MANIFEST
branches/upstream/perlbrew/current/META.yml
branches/upstream/perlbrew/current/Makefile.PL
branches/upstream/perlbrew/current/bin/perlbrew
branches/upstream/perlbrew/current/lib/App/perlbrew.pm
branches/upstream/perlbrew/current/t/05.get_current_perl.t
Modified: branches/upstream/perlbrew/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/Changes?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/Changes (original)
+++ branches/upstream/perlbrew/current/Changes Fri May 27 16:18:27 2011
@@ -1,3 +1,9 @@
+0.22:
+- Fix ccache support on Linux with bash.. GH #87.
+- `install` command no longer clobbers existing installations.
+- New commands: uninstall, alias, self-upgrade
+- See more on http://perlbrew.pl/Release-0.22.html
+
0.21:
- oylenshpeegul++ Let version numbers alone mean installation names. For example, 5.12.3 means perl-5.12.3
- audreyt++ fixed `perlbrew install <URL>` that might installs to a wrong path.
Modified: branches/upstream/perlbrew/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/MANIFEST?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/MANIFEST (original)
+++ branches/upstream/perlbrew/current/MANIFEST Fri May 27 16:18:27 2011
@@ -26,3 +26,7 @@
t/04.test_uniq.t
t/05.get_current_perl.t
t/06.installed_perls.t
+t/07.argv.t
+t/installation.t
+t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl
+t/mock_perlbrew_root/perls/the-dude/bin/perl
Modified: branches/upstream/perlbrew/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/META.yml?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/META.yml (original)
+++ branches/upstream/perlbrew/current/META.yml Fri May 27 16:18:27 2011
@@ -4,6 +4,8 @@
- 'Kang-min Liu C<< <gugod at gugod.org> >>'
build_requires:
ExtUtils::MakeMaker: 6.42
+ Path::Class: 0
+ Test::Exception: 0
Test::More: 0
Test::Output: 0
Test::Simple: 0
@@ -28,4 +30,4 @@
resources:
license: http://opensource.org/licenses/mit-license.php
repository: git://github.com/gugod/App-perlbrew.git
-version: 0.21
+version: 0.22
Modified: branches/upstream/perlbrew/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/Makefile.PL?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/Makefile.PL (original)
+++ branches/upstream/perlbrew/current/Makefile.PL Fri May 27 16:18:27 2011
@@ -54,6 +54,8 @@
test_requires 'Test::Simple';
test_requires 'Test::More';
test_requires 'Test::Output';
+test_requires 'Test::Exception';
+test_requires 'Path::Class';
install_script 'bin/perlbrew';
Modified: branches/upstream/perlbrew/current/bin/perlbrew
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/bin/perlbrew?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/bin/perlbrew (original)
+++ branches/upstream/perlbrew/current/bin/perlbrew Fri May 27 16:18:27 2011
@@ -19,6 +19,7 @@
Commonly used commands:
init Initialize perlbrew environment.
install Install perl
+ uninstall Uninstall the given installation
list List installed perls
use Use the specified perl in current shell
available List perls available to install
@@ -39,6 +40,7 @@
perlbrew switch /path/to/special/perl
perlbrew switch /path/to/special/perl special-perl
+
# later
perlbrew switch special-perl
@@ -91,6 +93,10 @@
Build and install from the given URL. Supported URL schemes are C<http://>,
C<https://>, C<ftp://> and C<file://>.
+
+=item B<uninstall> <target>
+
+Uninstalls the given version.
=item B<mirror>
@@ -126,6 +132,17 @@
Without a parameter, shows the version of perl currently selected.
+=item B<alias> [-f] create <name> <alias>
+
+Create an alias for the installation named <name>.
+
+=item B<alias> [-f] rename <old_alias> <new_alias>
+
+Rename the alias to a new name.
+
+=item B<alias> delete <alias>
+
+Delete the given alias.
=item B<off>
@@ -196,6 +213,9 @@
Install the C<cpanm> standalone executable in C<$PERLBREW_ROOT/bin>.
+=item B<self-upgrade>
+
+This command upgrades Perlbrew to its latest version.
=item B<version>
Modified: branches/upstream/perlbrew/current/lib/App/perlbrew.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/lib/App/perlbrew.pm?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/lib/App/perlbrew.pm (original)
+++ branches/upstream/perlbrew/current/lib/App/perlbrew.pm Fri May 27 16:18:27 2011
@@ -5,7 +5,7 @@
use Getopt::Long ();
use File::Spec::Functions qw( catfile );
-our $VERSION = "0.21";
+our $VERSION = "0.22";
our $CONF;
my $ROOT = $ENV{PERLBREW_ROOT} || "$ENV{HOME}/perl5/perlbrew";
@@ -100,7 +100,7 @@
;;
(*)
- command perlbrew $short_option $*
+ command perlbrew $short_option "$@"
exit_status=$?
;;
esac
@@ -638,6 +638,11 @@
unless ($dist) {
$self->run_command_install_perlbrew();
return
+ }
+
+ my $installation_name = $self->{as} || $dist;
+ if ($self->is_installed( $installation_name )) {
+ die "\nABORT: $installation_name is already installed.\n\n";
}
my $help_message = "Unknown installation target \"$dist\", abort.\nPlease see `perlbrew help` for the instruction on using the install command.\n\n";
@@ -791,14 +796,14 @@
my @result;
for (<$ROOT/perls/*>) {
- next if m/current/;
my ($name) = $_ =~ m/\/([^\/]+$)/;
my $executable = catfile($_, 'bin', 'perl');
push @result, {
name => $name,
version => $self->format_perl_version(`$executable -e 'print \$]'`),
- is_current => (current_perl eq $name)
+ is_current => (current_perl eq $name),
+ is_external => 0
};
}
@@ -812,11 +817,18 @@
push @result, {
name => $_,
version => $current_perl_executable_version,
- is_current => $current_perl_executable && ($_ eq $current_perl_executable)
+ is_current => $current_perl_executable && ($_ eq $current_perl_executable),
+ is_external => 1
} unless index($_, $ROOT) == 0;
}
return @result;
+}
+
+sub is_installed {
+ my ($self, $name) = @_;
+ my @installed = grep { !$_->{is_external} } $self->installed_perls;
+ return grep { $name eq $_->{name} } @installed;
}
# Return a hash of PERLBREW_* variables
@@ -1019,6 +1031,41 @@
print "cpanm is installed to $ROOT/bin/cpanm\n" if $self->{verbose};
}
+sub run_command_self_upgrade {
+ my ($self) = @_;
+
+ my $perlbrew_install = http_get('http://xrl.us/perlbrewinstall');
+ open my $fh, '>', '/tmp/perlbrewinstall';
+ print $fh $perlbrew_install;
+ close $fh;
+ exec 'bash', '/tmp/perlbrewinstall';
+}
+
+sub run_command_uninstall {
+ my ( $self, $target ) = @_;
+
+ unless($target) {
+ die <<USAGE
+
+Usage: perlbrew uninstall <name>
+
+ The name is the installation name as in the output of `perlbrew list`
+
+USAGE
+ }
+
+ my $dir = "$ROOT/perls/$target";
+
+ if (-l $dir) {
+ die "\nThe given name `$target` is an alias, not a real installation. Cannot perform uninstall.\nTo delete the alias, run:\n\n perlbrew alias delete $target\n\n";
+ }
+
+ unless(-d $dir) {
+ die "'$target' is not installed\n";
+ }
+ exec 'rm', '-rf', $dir;
+}
+
sub run_command_exec {
my ($self, @args) = @_;
@@ -1052,6 +1099,65 @@
}
print "\nDone\n";
+}
+
+sub run_command_alias {
+ my ($self, $cmd, $name, $alias) = @_;
+
+ if (!$cmd) {
+ print <<USAGE;
+
+Usage: perlbrew alias [-f] <action> <name> [<alias>]
+
+ perlbrew alias create <name> <alias>
+ perlbrew alias delete <alias>
+ perlbrew alias rename <old_alias> <new_alias>
+
+USAGE
+ return;
+ }
+
+ unless ( $self->is_installed($name) ) {
+ die "\nABORT: The installation `${name}` does not exist.\n\n";
+ }
+
+ my $path_name = catfile($ROOT, "perls", $name);
+ my $path_alias = catfile($ROOT, "perls", $alias) if $alias;
+
+ if ($alias && -e $path_alias && !-l $path_alias) {
+ die "\nABORT: The installation name `$alias` is not an alias, cannot override.\n\n";
+ }
+
+ if ($cmd eq 'create') {
+ if ( $self->is_installed($alias) && !$self->{force} ) {
+ die "\nABORT: The installation `${alias}` already exists. Cannot override.\n\n";
+ }
+
+
+ unlink($path_alias) if -e $path_alias;
+ symlink($path_name, $path_alias);
+ }
+ elsif($cmd eq 'delete') {
+ unless (-l $path_name) {
+ die "\nABORT: The installation name `$name` is not an alias, cannot remove.\n\n";
+ }
+
+ unlink($path_name);
+ }
+ elsif($cmd eq 'rename') {
+ unless (-l $path_name) {
+ die "\nABORT: The installation name `$name` is not an alias, cannot rename.\n\n";
+ }
+
+ if (-l $path_alias && !$self->{force}) {
+ die "\nABORT: The alias `$alias` already exists, cannot rename to it.\n\n";
+ }
+
+ rename($path_name, $path_alias);
+ }
+ else {
+ die "\nERROR: Unrecognized action: `${cmd}`.\n\n";
+ }
}
sub conf {
Modified: branches/upstream/perlbrew/current/t/05.get_current_perl.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/05.get_current_perl.t?rev=74902&op=diff
==============================================================================
--- branches/upstream/perlbrew/current/t/05.get_current_perl.t (original)
+++ branches/upstream/perlbrew/current/t/05.get_current_perl.t Fri May 27 16:18:27 2011
@@ -7,11 +7,12 @@
use Test::Output;
my $app = App::perlbrew->new();
+my $version = $App::perlbrew::VERSION;
stdout_is(
sub {
$app->run_command('version');
},
- "t/05.get_current_perl.t - App::perlbrew/0.21\n",
+ "t/05.get_current_perl.t - App::perlbrew/$version\n",
'Test version'
);
Added: branches/upstream/perlbrew/current/t/07.argv.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/07.argv.t?rev=74902&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/07.argv.t (added)
+++ branches/upstream/perlbrew/current/t/07.argv.t Fri May 27 16:18:27 2011
@@ -1,0 +1,24 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use App::perlbrew;
+
+{
+ my $app = App::perlbrew->new("-Dcc=ccache gcc");
+ is $app->{D}[0], 'cc=ccache gcc';
+}
+
+{
+ my $app = App::perlbrew->new("-Dcc=ccache gcc", "-Dld=gcc");
+ is $app->{D}[0], 'cc=ccache gcc';
+ is $app->{D}[1], 'ld=gcc';
+}
+
+{
+ my $app = App::perlbrew->new("install", "-v", "perl-5.14.0", "-Dcc=ccache gcc", "-Dld=gcc");
+ is $app->{D}[0], 'cc=ccache gcc';
+ is $app->{D}[1], 'ld=gcc';
+}
+
+done_testing;
Added: branches/upstream/perlbrew/current/t/installation.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/installation.t?rev=74902&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/installation.t (added)
+++ branches/upstream/perlbrew/current/t/installation.t Fri May 27 16:18:27 2011
@@ -1,0 +1,90 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Path::Class;
+use IO::All;
+BEGIN {
+ $ENV{PERLBREW_ROOT} = file(__FILE__)->dir->subdir("mock_perlbrew_root");
+}
+
+use Test::More;
+use Test::Exception;
+use App::perlbrew;
+use Try::Tiny;
+
+## setup
+
+App::perlbrew::rmpath( $ENV{PERLBREW_ROOT} );
+
+## mock
+
+no warnings 'redefine';
+
+sub App::perlbrew::do_install_release {
+ my ($self, $name) = @_;
+
+ $name = $self->{as} if $self->{as};
+
+ my $root = dir($ENV{PERLBREW_ROOT});
+ my $installation_dir = $root->subdir("perls", $name);
+ App::perlbrew::mkpath($installation_dir);
+ App::perlbrew::mkpath($root->subdir("perls", $name, "bin"));
+
+ my $perl = $root->subdir("perls", $name, "bin")->file("perl");
+ io($perl)->print("#!/bin/sh\nperl \"\$@\";\n");
+ chmod 0755, $perl;
+}
+
+use warnings;
+
+## main
+
+note "PERLBREW_ROOT set to $ENV{PERLBREW_ROOT}";
+{
+ my $app = App::perlbrew->new;
+ my @installed = grep { !$_->{is_external} } $app->installed_perls;
+ is 0+ at installed, 0;
+}
+
+{
+ my $app = App::perlbrew->new("install", "perl-5.14.0");
+ $app->run;
+
+ my @installed = grep { !$_->{is_external} } $app->installed_perls;
+ is 0+ at installed, 1;
+
+ is $installed[0]->{name}, "perl-5.14.0";
+
+ dies_ok {
+ my $app = App::perlbrew->new("install", "perl-5.14.0");
+ $app->run;
+ } "should die when doing install with existing distribution name.";
+}
+
+subtest "App::perlbrew#is_installed method." => sub {
+ my $app = App::perlbrew->new;
+ ok $app->can("is_installed");
+ ok $app->is_installed("perl-5.14.0");
+ ok !$app->is_installed("perl-5.13.0");
+
+ done_testing;
+};
+
+subtest "do not clobber exitsing user-specified name." => sub {
+ my $app = App::perlbrew->new("install", "perl-5.14.0", "--as", "the-dude");
+ $app->run;
+
+ my @installed = grep { !$_->{is_external} } $app->installed_perls;
+ is 0+ at installed, 2;
+
+ ok grep { $_->{name} eq 'the-dude' } $app->installed_perls;
+
+ dies_ok {
+ my $app = App::perlbrew->new("install", "perl-5.14.0", "--as", "the-dude");
+ $app->run;
+ } "should die when doing install with existing user-specified name.";
+
+ done_testing;
+};
+
+done_testing;
Added: branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl?rev=74902&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl (added)
+++ branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl Fri May 27 16:18:27 2011
@@ -1,0 +1,2 @@
+#!/bin/sh
+perl "$@";
Propchange: branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/perl-5.14.0/bin/perl
------------------------------------------------------------------------------
svn:executable = *
Added: branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl?rev=74902&op=file
==============================================================================
--- branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl (added)
+++ branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl Fri May 27 16:18:27 2011
@@ -1,0 +1,2 @@
+#!/bin/sh
+perl "$@";
Propchange: branches/upstream/perlbrew/current/t/mock_perlbrew_root/perls/the-dude/bin/perl
------------------------------------------------------------------------------
svn:executable = *
More information about the Pkg-perl-cvs-commits
mailing list