Hello community, here is the log from the commit of package perl-App-perlbrew for openSUSE:Factory checked in at 2019-10-30 14:44:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-App-perlbrew (Old) and /work/SRC/openSUSE:Factory/.perl-App-perlbrew.new.2990 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-App-perlbrew" Wed Oct 30 14:44:02 2019 rev:24 rq:743755 version:0.87 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-App-perlbrew/perl-App-perlbrew.changes 2019-01-21 11:03:22.899040805 +0100 +++ /work/SRC/openSUSE:Factory/.perl-App-perlbrew.new.2990/perl-App-perlbrew.changes 2019-10-30 14:44:04.537943516 +0100 @@ -1,0 +2,17 @@ +Mon Oct 28 10:45:36 UTC 2019 - <timueller+p...@suse.de> + +- updated to 0.87 + see /usr/share/doc/packages/perl-App-perlbrew/Changes + + 0.87 + - Released at 2019-10-25T22:55:40+0900 + - Thanks to our contributors: Branislav ZahradnĂk, Christopher Chavez, Jon Jacobson, Konstantin S. Uvarin, Pali, Shoichi Kaji, Tomasz Konojacki, jkjacobson, rage311 + - Use the new official repo url for fetching perl blead. Github issue #677 + - Add `--min` and `--max` options to `exec` command. Github PR #656 + - Fix "ERROR: Cannot find the tarball for perl-$version". Github PR #669 + - Fix calling patchperl on readonly files. Github PR #674 + - Fix installation from local tarbal files. See https://rt.cpan.org/Ticket/Display.html?id=129871 + - Internal refactoring. Github PR #667, #662 + - Various corrections of documentation. Github PR #676, #660 + +------------------------------------------------------------------- Old: ---- App-perlbrew-0.86.tar.gz New: ---- App-perlbrew-0.87.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-App-perlbrew.spec ++++++ --- /var/tmp/diff_new_pack.jIC15E/_old 2019-10-30 14:44:05.761944817 +0100 +++ /var/tmp/diff_new_pack.jIC15E/_new 2019-10-30 14:44:05.765944822 +0100 @@ -17,7 +17,7 @@ Name: perl-App-perlbrew -Version: 0.86 +Version: 0.87 Release: 0 %define cpan_name App-perlbrew Summary: Manage perl installations in your C<$HOME> @@ -30,10 +30,10 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(CPAN::Perl::Releases) >= 3.66 +BuildRequires: perl(CPAN::Perl::Releases) >= 4.12 BuildRequires: perl(Capture::Tiny) >= 0.36 -BuildRequires: perl(Devel::PatchPerl) >= 1.52 -BuildRequires: perl(ExtUtils::MakeMaker) >= 6.86 +BuildRequires: perl(Devel::PatchPerl) >= 1.54 +BuildRequires: perl(ExtUtils::MakeMaker) >= 7.22 BuildRequires: perl(File::Temp) >= 0.2304 BuildRequires: perl(File::Which) >= 1.21 BuildRequires: perl(IO::All) >= 0.51 @@ -50,10 +50,10 @@ BuildRequires: perl(Test::Spec) >= 0.47 BuildRequires: perl(Test::TempDir::Tiny) >= 0.016 BuildRequires: perl(local::lib) >= 2.000014 -Requires: perl(CPAN::Perl::Releases) >= 3.66 +Requires: perl(CPAN::Perl::Releases) >= 4.12 Requires: perl(Capture::Tiny) >= 0.36 -Requires: perl(Devel::PatchPerl) >= 1.52 -Requires: perl(ExtUtils::MakeMaker) >= 6.86 +Requires: perl(Devel::PatchPerl) >= 1.54 +Requires: perl(ExtUtils::MakeMaker) >= 7.22 Requires: perl(File::Temp) >= 0.2304 Requires: perl(JSON::PP) Requires: perl(Pod::Parser) >= 1.63 ++++++ App-perlbrew-0.86.tar.gz -> App-perlbrew-0.87.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/Build.PL new/App-perlbrew-0.87/Build.PL --- old/App-perlbrew-0.86/Build.PL 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/Build.PL 2019-10-25 16:15:13.000000000 +0200 @@ -1,4 +1,4 @@ -# This Build.PL for App-perlbrew was generated by mbtiny 0.023. +# This Build.PL for App-perlbrew was generated by mbtiny 0.026. use 5.006; use Module::Build::Tiny 0.034; Build_PL(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/Changes new/App-perlbrew-0.87/Changes --- old/App-perlbrew-0.86/Changes 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/Changes 2019-10-25 16:15:13.000000000 +0200 @@ -1,3 +1,14 @@ +0.87 + - Released at 2019-10-25T22:55:40+0900 + - Thanks to our contributors: Branislav ZahradnĂk, Christopher Chavez, Jon Jacobson, Konstantin S. Uvarin, Pali, Shoichi Kaji, Tomasz Konojacki, jkjacobson, rage311 + - Use the new official repo url for fetching perl blead. Github issue #677 + - Add `--min` and `--max` options to `exec` command. Github PR #656 + - Fix "ERROR: Cannot find the tarball for perl-$version". Github PR #669 + - Fix calling patchperl on readonly files. Github PR #674 + - Fix installation from local tarbal files. See https://rt.cpan.org/Ticket/Display.html?id=129871 + - Internal refactoring. Github PR #667, #662 + - Various corrections of documentation. Github PR #676, #660 + 0.86 - Released at 2019-01-19T09:39:55+0900 - Thanks to our contributors: Olaf Alders, Paul Cochrane diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/MANIFEST new/App-perlbrew-0.87/MANIFEST --- old/App-perlbrew-0.86/MANIFEST 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/MANIFEST 2019-10-25 16:15:13.000000000 +0200 @@ -16,6 +16,7 @@ lib/App/Perlbrew/Path/Installation.pm lib/App/Perlbrew/Path/Installations.pm lib/App/Perlbrew/Path/Root.pm +lib/App/Perlbrew/Util.pm lib/App/perlbrew.pm metamerge.json script/perlbrew @@ -58,7 +59,9 @@ t/command-help.t t/command-info.t t/command-install-cpanm.t +t/command-install-from-archive.t t/command-install-patchperl.t +t/command-install.t t/command-lib.t t/command-list.t t/current_perl.t @@ -67,7 +70,6 @@ t/failure-command-install-cpanm.t t/failure-command-install-patchperl.t t/fake-bin/curl -t/get_blead_perl.t t/home.t t/http-program-control.t t/http-ua-detect-non-curl.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/META.json new/App-perlbrew-0.87/META.json --- old/App-perlbrew-0.86/META.json 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/META.json 2019-10-25 16:15:13.000000000 +0200 @@ -4,7 +4,7 @@ "Kang-min Liu C<< <gu...@gugod.org> >>" ], "dynamic_config" : 0, - "generated_by" : "App::ModuleBuildTiny version 0.023", + "generated_by" : "App::ModuleBuildTiny version 0.026", "license" : [ "mit" ], @@ -21,16 +21,16 @@ }, "develop" : { "requires" : { - "App::ModuleBuildTiny" : "0.023", + "App::ModuleBuildTiny" : "0.026", "Pod::Markdown" : "2.002" } }, "runtime" : { "requires" : { - "CPAN::Perl::Releases" : "3.66", + "CPAN::Perl::Releases" : "4.12", "Capture::Tiny" : "0.36", - "Devel::PatchPerl" : "1.52", - "ExtUtils::MakeMaker" : "6.86", + "Devel::PatchPerl" : "1.54", + "ExtUtils::MakeMaker" : "7.22", "File::Temp" : "0.2304", "JSON::PP" : "0", "Pod::Parser" : "1.63", @@ -66,9 +66,12 @@ "App::Perlbrew::Path::Root" : { "file" : "lib/App/Perlbrew/Path/Root.pm" }, + "App::Perlbrew::Util" : { + "file" : "lib/App/Perlbrew/Util.pm" + }, "App::perlbrew" : { "file" : "lib/App/perlbrew.pm", - "version" : "0.86" + "version" : "0.87" } }, "release_status" : "stable", @@ -79,7 +82,8 @@ "web" : "https://github.com/gugod/App-perlbrew" } }, - "version" : "0.86", + "version" : "0.87", "x_serialization_backend" : "JSON::PP version 2.97001", + "x_spdx_expression" : "MIT", "x_static_install" : "1" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/META.yml new/App-perlbrew-0.87/META.yml --- old/App-perlbrew-0.86/META.yml 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/META.yml 2019-10-25 16:15:13.000000000 +0200 @@ -16,7 +16,7 @@ configure_requires: Module::Build::Tiny: '0.034' dynamic_config: 0 -generated_by: 'App::ModuleBuildTiny version 0.023, CPAN::Meta::Converter version 2.150010' +generated_by: 'App::ModuleBuildTiny version 0.026, CPAN::Meta::Converter version 2.150010' license: mit meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -31,14 +31,16 @@ file: lib/App/Perlbrew/Path/Installations.pm App::Perlbrew::Path::Root: file: lib/App/Perlbrew/Path/Root.pm + App::Perlbrew::Util: + file: lib/App/Perlbrew/Util.pm App::perlbrew: file: lib/App/perlbrew.pm - version: '0.86' + version: '0.87' requires: - CPAN::Perl::Releases: '3.66' + CPAN::Perl::Releases: '4.12' Capture::Tiny: '0.36' - Devel::PatchPerl: '1.52' - ExtUtils::MakeMaker: '6.86' + Devel::PatchPerl: '1.54' + ExtUtils::MakeMaker: '7.22' File::Temp: '0.2304' JSON::PP: '0' Pod::Parser: '1.63' @@ -46,6 +48,7 @@ local::lib: '2.000014' resources: repository: https://github.com/gugod/App-perlbrew.git -version: '0.86' +version: '0.87' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' +x_spdx_expression: MIT x_static_install: '1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/cpanfile new/App-perlbrew-0.87/cpanfile --- old/App-perlbrew-0.86/cpanfile 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/cpanfile 2019-10-25 16:15:13.000000000 +0200 @@ -1,13 +1,13 @@ -requires 'CPAN::Perl::Releases' => '3.66'; +requires 'CPAN::Perl::Releases' => '4.12'; requires 'Capture::Tiny' => '0.36'; -requires 'Devel::PatchPerl' => '1.52'; +requires 'Devel::PatchPerl' => '1.54'; requires 'Pod::Parser' => '1.63'; requires 'Pod::Usage' => '1.68'; requires 'File::Temp' => '0.2304'; requires 'JSON::PP' => '0'; requires 'local::lib' => '2.000014'; -requires 'ExtUtils::MakeMaker' => '6.86'; - +requires 'ExtUtils::MakeMaker' => '7.22'; + on test => sub { requires 'File::Temp' => '0.2304'; requires 'File::Which' => '1.21'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/lib/App/Perlbrew/Util.pm new/App-perlbrew-0.87/lib/App/Perlbrew/Util.pm --- old/App-perlbrew-0.86/lib/App/Perlbrew/Util.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/App-perlbrew-0.87/lib/App/Perlbrew/Util.pm 2019-10-25 16:15:13.000000000 +0200 @@ -0,0 +1,43 @@ +package App::Perlbrew::Util; +use strict; +use warnings; +use 5.008; + +use Exporter 'import'; +our @EXPORT = qw(uniq min editdist); + +sub uniq { + my %seen; + grep { !$seen{$_}++ } @_; +} + +sub min(@) { + my $m = $_[0]; + for(@_) { + $m = $_ if $_ < $m; + } + return $m; +} + +# straight copy of Wikipedia's "Levenshtein Distance" +sub editdist { + my @a = split //, shift; + my @b = split //, shift; + + # There is an extra row and column in the matrix. This is the + # distance from the empty string to a substring of the target. + my @d; + $d[$_][0] = $_ for (0 .. @a); + $d[0][$_] = $_ for (0 .. @b); + + for my $i (1 .. @a) { + for my $j (1 .. @b) { + $d[$i][$j] = ($a[$i-1] eq $b[$j-1] ? $d[$i-1][$j-1] + : 1 + min($d[$i-1][$j], $d[$i][$j-1], $d[$i-1][$j-1])); + } + } + + return $d[@a][@b]; +} + +1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/lib/App/perlbrew.pm new/App-perlbrew-0.87/lib/App/perlbrew.pm --- old/App-perlbrew-0.86/lib/App/perlbrew.pm 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/lib/App/perlbrew.pm 2019-10-25 16:15:13.000000000 +0200 @@ -2,7 +2,7 @@ use strict; use warnings; use 5.008; -our $VERSION = "0.86"; +our $VERSION = "0.87"; use Config; BEGIN { @@ -23,21 +23,10 @@ use CPAN::Perl::Releases; use JSON::PP 'decode_json'; +use App::Perlbrew::Util; use App::Perlbrew::Path; use App::Perlbrew::Path::Root; -sub min(@) { - my $m = $_[0]; - for(@_) { - $m = $_ if $_ < $m; - } - return $m; -} - -sub uniq { - my %seen; grep { !$seen{$_}++ } @_; -} - ### global variables # set $ENV{SHELL} to executable path of parent process (= shell) if it's missing @@ -246,29 +235,7 @@ return $v[1]*1000000 + $v[2]*1000 + $v[3]; } -# straight copy of Wikipedia's "Levenshtein Distance" -sub editdist { - my @a = split //, shift; - my @b = split //, shift; - - # There is an extra row and column in the matrix. This is the - # distance from the empty string to a substring of the target. - my @d; - $d[$_][0] = $_ for (0 .. @a); - $d[0][$_] = $_ for (0 .. @b); - - for my $i (1 .. @a) { - for my $j (1 .. @b) { - $d[$i][$j] = ($a[$i-1] eq $b[$j-1] ? $d[$i-1][$j-1] - : 1 + min($d[$i-1][$j], $d[$i][$j-1], $d[$i-1][$j-1])); - } - } - - return $d[@a][@b]; -} - ### methods - sub new { my($class, @argv) = @_; @@ -418,7 +385,7 @@ } sub builddir { - my ($self) = @_; + my ($self) = @_; return $self->{builddir} || $self->root->build; } @@ -728,8 +695,8 @@ } sub _firstrcfile { - my ($self) = @_; - foreach my $path (@_) { + my ($self, @files) = @_; + foreach my $path (@files) { return $path if -f App::Perlbrew::Path->new ($self->env('HOME'), $path); } return; @@ -981,7 +948,7 @@ } } - my $json = http_get("https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}"); + my $json = http_get("'https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}'"); my $result; unless ($json and $result = decode_json($json)->{hits}{hits}[0]) { @@ -1057,7 +1024,7 @@ } } - my $json = http_get("https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}"); + my $json = http_get("'https://fastapi.metacpan.org/v1/release/_search?size=1&q=name:perl-${version}'"); my $result; unless ($json and $result = decode_json($json)->{hits}{hits}[0]) { @@ -1205,11 +1172,11 @@ elsif ($shell =~ m/zsh\d?$/) { $code = "source $root_dir/etc/bashrc"; $yourshrc = $self->_firstrcfile(qw( - zshenv + .zshenv .bash_profile .bash_login .profile - )) || "zshenv"; + )) || ".zshenv"; } elsif ($shell =~ m/fish/) { $code = ". $root_dir/etc/perlbrew.fish"; @@ -1308,7 +1275,7 @@ require File::Spec; my $dist_extracted_dir = File::Spec->rel2abs($dist); - $self->do_install_this($dist_extracted_dir, $dist_version, "$dist_name-$dist_version"); + $self->do_install_this(App::Perlbrew::Path->new ($dist_extracted_dir), $dist_version, "$dist_name-$dist_version"); return; } @@ -1319,7 +1286,11 @@ my ($dist_version) = $dist =~ m/-([\d.]+(?:-RC\d+)?|git)\./; my ($dist_tarball) = $dist =~ m{/([^/]*)$}; - my $dist_tarball_path = $self->root->dists ($dist_tarball); + if (! $dist_version && $dist =~ /blead\.tar.gz$/) { + $dist_version = "blead"; + } + + my $dist_tarball_path = $self->root->dists($dist_tarball); my $dist_tarball_url = $dist; $dist = "$dist_name-$dist_version"; # we install it as this name later @@ -1373,74 +1344,15 @@ return $extracted_dir; } -# Search for directories inside a extracted tarball downloaded as perl "blead" -# Use a Schwartzian Transform in case there are lots of dirs that -# look like "perl-$SHA1", which is what's inside blead.tar.gz, -# so we stat each one only once, ordering (descending )the directories per mtime -# Expects as parameters: -# - the path to the extracted "blead" tarball -# - an array reference, that will be used to cache all contents from the read directory -# Returns the most recent directory which name matches the expected one. -sub search_blead_dir { - my ($build_dir, $contents_ref) = @_; - local *DIRH; - opendir DIRH, $build_dir or die "Couldn't open ${build_dir}: $!"; - @{$contents_ref} = grep {!/^\./ && -d $build_dir->child ($_)} readdir DIRH; - closedir DIRH or warn "Couldn't close ${build_dir}: $!"; - my @candidates = grep { m/^perl-blead-[0-9a-f]{4,40}$/ } @{$contents_ref}; - @candidates = map { $_->[0] } - sort { $b->[1] <=> $a->[1] } # descending - map { [ $_, (stat( $build_dir->child ($_) ))[9] ] } @candidates; - if (scalar(@candidates) > 0) { - # take the newest one - return $candidates[0]; - } else { - return; - } -} - sub do_install_blead { - my ($self, $dist) = @_; - my $dist_name = 'perl'; - my $dist_git_describe = 'blead'; - my $dist_version = 'blead'; + my ($self) = @_; # We always blindly overwrite anything that's already there, # because blead is a moving target. - my $dist_tarball = 'blead.tar.gz'; - my $dist_tarball_path = $self->root->dists ($dist_tarball); - print "Fetching $dist_git_describe as $dist_tarball_path\n"; - - my $error = http_download("http://perl5.git.perl.org/perl.git/snapshot/$dist_tarball", $dist_tarball_path); + my $dist_tarball_path = $self->root->dists("blead.tar.gz"); + unlink($dist_tarball_path) if -f $dist_tarball_path; - if ($error) { - die "\nERROR: Failed to download perl-blead tarball.\n\n"; - } - - # Returns the wrong extracted dir for blead - $self->do_extract_tarball($dist_tarball_path); - - my $build_dir = $self->builddir; - my @contents; - my $dist_extracted_subdir = search_blead_dir($build_dir, \@contents); - - # there might be an additional level on $build_dir - unless (defined($dist_extracted_subdir)) { - warn "No candidate found at $build_dir, trying a level deeper"; - for my $item (@contents) { - my $another_sub = $build_dir->child ($item); - $dist_extracted_subdir = search_blead_dir($another_sub); - if (defined($dist_extracted_subdir)) { - $build_dir = $another_sub; - last; - } - } - } - - die "Could not identify where is the source code to build under $build_dir, aborting..." unless (defined($dist_extracted_subdir)); - my $dist_extracted_dir = $build_dir->child ($dist_extracted_subdir); - $self->do_install_this($dist_extracted_dir, $dist_version, "$dist_name-$dist_version"); - return; + $self->do_install_url("https://github.com/Perl/perl5/archive/blead.tar.gz"); } sub resolve_stable_version { @@ -1500,7 +1412,6 @@ my ($dist_type, $dist_version); if (($dist_type, $dist_version) = $dist =~ /^(?:(c?perl)-?)?([\d._]+(?:-RC\d+)?|git|stable|blead)$/) { - my $dist_version = ($dist_version eq 'stable' ? $self->resolve_stable_version : $2); $dist_version = $self->resolve_stable_version if $dist_version eq 'stable'; $dist_type ||= "perl"; $dist = "${dist_type}-${dist_version}"; # normalize dist name @@ -1511,7 +1422,7 @@ } if ($dist_type eq 'perl' && $dist_version eq 'blead') { - $self->do_install_blead($dist); + $self->do_install_blead(); } else { $self->do_install_release($dist, $dist_version); @@ -1523,7 +1434,7 @@ $self->do_install_git($dist); } elsif (-f $dist) { - $self->do_install_archive($dist); + $self->do_install_archive(App::Perlbrew::Path->new ($dist)); } elsif ($dist =~ m/^(?:https?|ftp|file)/) { # more protocols needed? $self->do_install_url($dist); @@ -1733,8 +1644,8 @@ } my $dist_extracted_path = $self->do_extract_tarball($dist_tarball_path); + $self->do_install_this($dist_extracted_path, $dist_version, $installation_name); - return; } sub do_install_this { @@ -1805,7 +1716,7 @@ "cd $dist_extracted_dir", "rm -f config.sh Policy.sh", ); - push @preconfigure_commands, $patchperl unless $self->{"no-patchperl"} || $looks_like_we_are_installing_cperl; + push @preconfigure_commands, 'chmod -R +w .', $patchperl unless $self->{"no-patchperl"} || $looks_like_we_are_installing_cperl; my $configure_flags = $self->env("PERLBREW_CONFIGURE_FLAGS") || '-de'; @@ -2167,7 +2078,7 @@ my $is_verbose = $self->{verbose}; for my $i ($self->installed_perls) { - printf "%2s %-20s %-20s %s\n", + printf "%-2s%-20s %-20s %s\n", $i->{is_current} ? '*' : '', $i->{name}, ( $is_verbose ? @@ -2468,7 +2379,7 @@ local (@ARGV) = @{$self->{original_argv}}; Getopt::Long::Configure ('require_order'); - my @command_options = ('with=s', 'halt-on-error'); + my @command_options = ('with=s', 'halt-on-error', 'min=s', 'max=s'); $self->parse_cmdline (\%opts, @command_options); shift @ARGV; # "exec" @@ -2491,6 +2402,16 @@ @exec_with = map { ($_, @{$_->{libs}}) } $self->installed_perls; } + if ($opts{min}) { + # TODO use comparable version. + # For now, it doesn't produce consistent results for 5.026001 and 5.26.1 + @exec_with = grep { $_->{orig_version} >= $opts{min} } @exec_with; + }; + + if ($opts{max}) { + @exec_with = grep { $_->{orig_version} <= $opts{max} } @exec_with; + }; + if (0 == @exec_with) { print "No perl installation found.\n" unless $self->{quiet}; } @@ -2801,7 +2722,7 @@ 'perl', '-MExtUtils::Installed', '-le', - sprintf('BEGIN{@INC=grep {$_ ne q!.!} @INC}; %s print {%s} $_ for ExtUtils::Installed->new->modules;', + sprintf('BEGIN{@INC=grep {$_ ne q!.!} @INC}; %s print {%s} $_ for grep {$_ ne q!Perl!} ExtUtils::Installed->new->modules;', $output_filename ? sprintf('open my $output_fh, \'>\', "%s"; ', $output_filename) : '', $output_filename ? '$output_fh' : 'STDOUT') ); @@ -3291,14 +3212,14 @@ return <<'WRAPPER'; set perlbrew_exit_status=0 -if ( $1 =~ -* ) then - set perlbrew_short_option=$1 +if ( "$1" =~ -* ) then + set perlbrew_short_option="$1" shift else set perlbrew_short_option="" endif -switch ( $1 ) +switch ( "$1" ) case use: if ( $%2 == 0 ) then if ( $?PERLBREW_PERL == 0 ) then @@ -3312,8 +3233,8 @@ endif else set perlbrew_line_count=0 - foreach perlbrew_line ( "`\perlbrew env $2`" ) - eval $perlbrew_line + foreach perlbrew_line ( "`\perlbrew env $2:q`" ) + eval "$perlbrew_line" @ perlbrew_line_count++ end if ( $perlbrew_line_count == 0 ) then @@ -3328,27 +3249,27 @@ if ( $%2 == 0 ) then \perlbrew switch else - perlbrew use $2 && source $PERLBREW_ROOT/etc/csh_reinit $2 + perlbrew use "$2" && source "$PERLBREW_ROOT/etc/csh_reinit" "$2" endif breaksw case off: unsetenv PERLBREW_PERL foreach perlbrew_line ( "`\perlbrew env`" ) - eval $perlbrew_line + eval "$perlbrew_line" end - source $PERLBREW_ROOT/etc/csh_set_path + source "$PERLBREW_ROOT/etc/csh_set_path" echo "perlbrew is turned off." breaksw case switch-off: unsetenv PERLBREW_PERL - source $PERLBREW_ROOT/etc/csh_reinit '' + source "$PERLBREW_ROOT/etc/csh_reinit" '' echo "perlbrew is switched off." breaksw default: - \perlbrew $perlbrew_short_option $argv + \perlbrew $perlbrew_short_option:q $argv:q set perlbrew_exit_status=$? breaksw endsw @@ -3412,7 +3333,7 @@ endif source "$PERLBREW_ROOT/etc/csh_set_path" -alias perlbrew 'source $PERLBREW_ROOT/etc/csh_wrapper' +alias perlbrew 'source "$PERLBREW_ROOT/etc/csh_wrapper"' CSHRC } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/script/perlbrew new/App-perlbrew-0.87/script/perlbrew --- old/App-perlbrew-0.86/script/perlbrew 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/script/perlbrew 2019-10-25 16:15:13.000000000 +0200 @@ -384,7 +384,15 @@ =head1 COMMAND: EXEC -Usage: perlbrew exec [--with perl-name[,perl-name...]] <command> <args...> +Usage: perlbrew exec [options] <command> <args...> + +Options for C<exec> command: + + --with perl-version,... - only use these versions + --min n.nnnnn - minimum perl version + (format is the same as in 'use 5.012') + --max n.nnnnn - maximum perl version + --halt-on-error - stop on first nonzero exit status Execute command for each perl installations, one by one. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/08.error_install_blead.t new/App-perlbrew-0.87/t/08.error_install_blead.t --- old/App-perlbrew-0.86/t/08.error_install_blead.t 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/t/08.error_install_blead.t 2019-10-25 16:15:13.000000000 +0200 @@ -21,7 +21,7 @@ my $app = App::perlbrew->new("install", "perl-blead"); $app->run; }, - qr[ERROR: Failed to download perl-blead tarball.] + qr[ERROR: Failed to download https://.+/blead\.tar\.gz] ); throws_ok( @@ -29,7 +29,7 @@ my $app = App::perlbrew->new("install", "blead"); $app->run; }, - qr[ERROR: Failed to download perl-blead tarball.] + qr[ERROR: Failed to download https://.+/blead\.tar\.gz] ); done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/11.editdist.t new/App-perlbrew-0.87/t/11.editdist.t --- old/App-perlbrew-0.86/t/11.editdist.t 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/t/11.editdist.t 2019-10-25 16:15:13.000000000 +0200 @@ -2,14 +2,13 @@ use strict; use warnings; use Test::More; -use App::perlbrew; +use App::Perlbrew::Util qw< editdist >; -*ed = *App::perlbrew::editdist; -is ed(qw/Joe Jim/), 2; -is ed(qw/Jack Jill/), 3; -is ed(qw/Jim Jimmy/), 2; -is ed(qw/superman supergirl/), 4; -is ed(qw/supercalifragilisticexpyalligocious superman/), 29; -is ed(qw/foo bar/), 3; +is editdist(qw/Joe Jim/), 2; +is editdist(qw/Jack Jill/), 3; +is editdist(qw/Jim Jimmy/), 2; +is editdist(qw/superman supergirl/), 4; +is editdist(qw/supercalifragilisticexpyalligocious superman/), 29; +is editdist(qw/foo bar/), 3; done_testing; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/command-exec.t new/App-perlbrew-0.87/t/command-exec.t --- old/App-perlbrew-0.86/t/command-exec.t 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/t/command-exec.t 2019-10-25 16:15:13.000000000 +0200 @@ -265,7 +265,49 @@ }; }; +describe "minimal perl version" => sub { + it "only executes the needed version" => sub { + my @perl_paths; + my $app = App::perlbrew->new(qw(exec --min 5.014), qw(perl -E), "say 42"); + $app->expects("do_system_with_exit_code")->exactly(2)->returns(sub { + my ($self, @args) = @_; + my ($perlbrew_bin_path, $perlbrew_perl_bin_path, @paths) = split(":", $ENV{PATH}); + push @perl_paths, $perlbrew_perl_bin_path; + return 0; + }); + + $app->run; + + # Don't care about the order, just the fact all of them were visited + is_deeply [sort @perl_paths], [sort ( + App::Perlbrew::Path->new($App::perlbrew::PERLBREW_ROOT, "perls", "perl-5.14.2", "bin"), + App::Perlbrew::Path->new($App::perlbrew::PERLBREW_ROOT, "perls", "perl-5.14.1", "bin"), + )]; + }; +}; + +describe "maximum perl version" => sub { + it "only executes the needed version" => sub { + + my @perl_paths; + my $app = App::perlbrew->new(qw(exec --max 5.014), qw(perl -E), "say 42"); + $app->expects("do_system_with_exit_code")->exactly(2)->returns(sub { + my ($self, @args) = @_; + my ($perlbrew_bin_path, $perlbrew_perl_bin_path, @paths) = split(":", $ENV{PATH}); + push @perl_paths, $perlbrew_perl_bin_path; + return 0; + }); + + $app->run; + + # Don't care about the order, just the fact all of them were visited + is_deeply [sort @perl_paths], [sort ( + App::Perlbrew::Path->new($App::perlbrew::PERLBREW_ROOT, "perls", "perl-5.12.4", "bin"), + App::Perlbrew::Path->new($App::perlbrew::PERLBREW_ROOT, "perls", "perl-5.12.3", "bin"), + )]; + }; +}; runtests unless caller; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/command-install-from-archive.t new/App-perlbrew-0.87/t/command-install-from-archive.t --- old/App-perlbrew-0.86/t/command-install-from-archive.t 1970-01-01 01:00:00.000000000 +0100 +++ new/App-perlbrew-0.87/t/command-install-from-archive.t 2019-10-25 16:15:13.000000000 +0200 @@ -0,0 +1,148 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use Test::Spec 0.49; # with_deep +use Test::Deep; + +use FindBin; +use lib $FindBin::Bin; + +use App::perlbrew; + +use Hash::Util; + +require 'test_helpers.pl'; + +sub arrange_file; +sub arrange_available_perls; +sub arrange_command_line; +sub expect_dispatch_via; +sub should_install_from_archive; +sub is_path; + +describe "command install <archive>" => sub { + should_install_from_archive "with perl source archive" => ( + filename => 'perl-5.28.0.tar.gz', + dist_version => '5.28.0', + installation_name => 'perl-5.28.0', + ); + + should_install_from_archive "with perfixed perl source archive" => ( + filename => 'downloaded-perl-5.28.0.tar.gz', + dist_version => '5.28.0', + installation_name => 'perl-5.28.0', + ); + + should_install_from_archive "with cperl source archive" => ( + filename => 'cperl-5.28.0.tar.gz', + dist_version => '5.28.0', + installation_name => 'cperl-5.28.0', + ); + + should_install_from_archive "with prefixed cperl source archive" => ( + filename => 'downloaded-cperl-5.28.0.tar.gz', + dist_version => '5.28.0', + installation_name => 'cperl-5.28.0', + ); + +}; + +runtests unless caller; + +sub should_install_from_archive { + my ($title, %params) = @_; + + Hash::Util::lock_keys %params, + 'filename', + 'dist_version', + 'installation_name', + ; + + context $title => sub { + my $file; + + before each => sub { + $file = arrange_file + name => $params{filename},, + tempdir => 1, + ; + + arrange_command_line install => $file; + }; + + expect_dispatch_via + method => 'do_install_archive', + with_args => [ + is_path (methods (basename => $params{filename})) + ]; + + expect_dispatch_via method => 'do_extract_tarball', + stubs => { do_install_this => '' }, + with_args => [ + is_path (methods (basename => $params{filename})) + ]; + + expect_dispatch_via method => 'do_install_this', + stubs => { do_extract_tarball => sub { $_[-1]->dirname->child ('foo') } }, + with_args => [ + is_path (methods (basename => 'foo')), + $params{dist_version}, + $params{installation_name}, + ]; + }; +}; + +sub is_path { + my (@tests) = @_; + + all ( + obj_isa ('App::Perlbrew::Path'), + @tests, + ); +} + +sub arrange_file { + my (%params) = @_; + + my $dir; + $dir ||= $params{dir} if $params{dir}; + $dir ||= tempdir (CLEANUP => 1) if $params{tempdir}; + $dir ||= '.'; + + my $file = file ($dir, $params{name}); + + open my $fh, '>', $file; + close $fh; + + return $file; +} + +sub arrange_command_line { + my (@command_line) = @_; + + share my %shared; + + # Enforce stringification + $shared{app} = App::perlbrew->new (map "$_", @command_line); +} + +sub expect_dispatch_via { + my (%params) = @_; + + it "should dispatch via $params{method}()" => sub { + share my %shared; + + App::perlbrew->stubs (%{ $params{stubs} }) + if $params{stubs}; + + my $expectation = App::perlbrew->expects ($params{method}); + $expectation = $expectation->with_deep (@{ $params{with_args} }) + if $params{with_args}; + + $shared{app}->run; + + ok $expectation->verify; + }; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/command-install.t new/App-perlbrew-0.87/t/command-install.t --- old/App-perlbrew-0.86/t/command-install.t 1970-01-01 01:00:00.000000000 +0100 +++ new/App-perlbrew-0.87/t/command-install.t 2019-10-25 16:15:13.000000000 +0200 @@ -0,0 +1,111 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use Test::Spec 0.49; # with_deep +use Test::Deep; + +use FindBin; +use lib $FindBin::Bin; + +use App::perlbrew; + +require 'test_helpers.pl'; + +sub arrange_available_perls; +sub arrange_command_line; +sub expect_dispatch_via; + +describe "command install" => sub { + it "should install exact perl version" => sub { + arrange_command_line install => 'perl-5.12.1'; + + expect_dispatch_via do_install_release => [ 'perl-5.12.1', '5.12.1' ]; + }; + + it "should install exact cperl version" => sub { + arrange_command_line install => 'cperl-5.26.4'; + + expect_dispatch_via do_install_release => [ 'cperl-5.26.4', '5.26.4' ]; + }; + + it "should install stable version of perl" => sub { + arrange_command_line install => 'perl-stable'; + + arrange_available_perls qw[ + perl-5.12.2 + perl-5.12.3 + perl-5.14.1 + perl-5.14.2 + perl-5.29.0 + ]; + + expect_dispatch_via do_install_release => [ 'perl-5.14.2', '5.14.2' ]; + }; + + it "should install blead perl" => sub { + arrange_command_line install => 'perl-blead'; + expect_dispatch_via do_install_blead => []; + }; + + it "should install git checkout" => sub { + my $checkout = tempdir (CLEANUP => 1); + dir ($checkout, '.git')->mkpath; + + arrange_command_line install => $checkout; + + expect_dispatch_via do_install_git => [ $checkout ]; + }; + + it "should install from archive" => sub { + my $checkout = tempdir (CLEANUP => 1); + my $file = file ($checkout, 'archive.tar.gz')->stringify; + + open my $fh, '>', $file; + close $fh; + + arrange_command_line install => $file; + + expect_dispatch_via do_install_archive => [ all ( + obj_isa ('App::Perlbrew::Path'), + methods (stringify => $file), + ) ]; + }; + + it "should install from uri" => sub { + arrange_command_line install => 'http://example.com/foo/bar'; + + expect_dispatch_via do_install_url => [ 'http://example.com/foo/bar' ]; + }; +}; + +runtests unless caller; + +sub arrange_available_perls { + my (@list) = @_; + + App::perlbrew->stubs (available_perls => sub { $_[0]->sort_perl_versions (@list) }); +} + +sub arrange_command_line { + my (@command_line) = @_; + + share my %shared; + + $shared{app} = App::perlbrew->new (@command_line); +} + +sub expect_dispatch_via { + my ($method, $arguments) = @_; + + share my %shared; + + my $expectation = App::perlbrew->expects ($method); + $expectation = $expectation->with_deep (@$arguments) + if $arguments; + + + $shared{app}->run; + + ok $expectation->verify; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/command-list.t new/App-perlbrew-0.87/t/command-list.t --- old/App-perlbrew-0.86/t/command-list.t 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/t/command-list.t 2019-10-25 16:15:13.000000000 +0200 @@ -32,7 +32,7 @@ describe "when there no libs under PERLBREW_HOME,", sub { it "displays a list of perl installation names", sub { my $app = App::perlbrew->new("list"); - stdout_like sub { $app->run(); }, qr/^(\s\*)?\s{1,3}c?perl-?\d\.\d{1,3}[_.]\d{1,2}\s+/, 'Cannot find Perl in output' + stdout_like sub { $app->run(); }, qr/^(\s|\*)\sc?perl-?\d\.\d{1,3}[_.]\d{1,2}\s+/, 'Cannot find Perl in output' }; }; @@ -48,13 +48,13 @@ it "displays lib names" => sub { my $app = App::perlbrew->new("list"); - stdout_like sub { $app->run(); }, qr/^(\s\*)?\s{1,3}c?perl-?\d\.\d{1,3}[_.]\d{1,2}(@\w+)?/, 'Cannot find Perl with libraries in output' + stdout_like sub { $app->run(); }, qr/^(\s|\*)\sc?perl-?\d\.\d{1,3}[_.]\d{1,2}(@\w+)?/, 'Cannot find Perl with libraries in output' }; it "marks currently activated lib", sub { $ENV{PERLBREW_LIB} = "nobita"; my $app = App::perlbrew->new("list"); - stdout_like sub { $app->run(); }, qr/^(\s\*)?\s{1,3}c?perl-?\d\.\d{1,3}[_.]\d{1,2}(\@nobita)?/, 'Cannot find Perl with libraries in output' + stdout_like sub { $app->run(); }, qr/^(\s|\*)\sc?perl-?\d\.\d{1,3}[_.]\d{1,2}(\@nobita)?/, 'Cannot find Perl with libraries in output' }; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/App-perlbrew-0.86/t/get_blead_perl.t new/App-perlbrew-0.87/t/get_blead_perl.t --- old/App-perlbrew-0.86/t/get_blead_perl.t 2019-01-19 01:44:06.000000000 +0100 +++ new/App-perlbrew-0.87/t/get_blead_perl.t 1970-01-01 01:00:00.000000000 +0100 @@ -1,34 +0,0 @@ -use warnings; -use strict; -use Test::More tests => 6; -use App::perlbrew; -use Test::TempDir::Tiny 0.016; - -my $dir = tempdir(); -mkdir("$dir/build"); -mkdir("$dir/build/blead"); -touch( "$dir/build/blead", 'OYFTV_51234' ); -touch( "$dir/build/blead", 'Hwefwo8124' ); -touch( "$dir/build/blead", 'perl-blead-hsf743r' ); -my $blead = 'perl-blead-e7e8ce8'; -mkdir("$dir/build/blead/$blead"); - -my @content; -my $found_dir = App::perlbrew::search_blead_dir( App::Perlbrew::Path->new ("$dir/build"), \@content ); -is( $found_dir, undef, 'no candidate directory is found' ); -is( scalar(@content), 1, 'there are only directories on content cache' ); -is( $content[0], 'blead', 'have the expected directory in the content cache' ); -$found_dir = App::perlbrew::search_blead_dir( App::Perlbrew::Path->new ("$dir/build/blead"), \@content ); -is( $found_dir, $blead, 'the expected directory is found' ); -is( scalar(@content), 1, 'there are only directories on content cache' ); -is( $content[0], $blead, 'have the expected directory in the content cache' ); - -# creating files to make sure search_blead_dir only considers directories -sub touch { - my ( $dir, $file ) = @_; - my $path = "$dir/$file"; - open( my $out, '>', $path ) or die "Cannot create $path: $!"; - print $out '...'; - close($out); -} -