[carton] 299/472: Honor newer versions of install if there are multiples that both satisfy cpanfile requirements

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 453642d603522bee0e9fb5fbcc0b4f4fb79d6a5d
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Wed Jun 5 19:10:28 2013 +0900

    Honor newer versions of install if there are multiples that both satisfy cpanfile requirements
---
 lib/Carton/Lock.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/Carton/Lock.pm b/lib/Carton/Lock.pm
index e243367..cb83025 100644
--- a/lib/Carton/Lock.pm
+++ b/lib/Carton/Lock.pm
@@ -127,7 +127,17 @@ sub find_installs {
         my $module = Carton::Util::load_json($file->[0]);
         my $mymeta = -f $file->[1] ? CPAN::Meta->load_file($file->[1])->as_struct({ version => "2" }) : {};
         if ($reqs->accepts_module($module->{name}, $module->{provides}{$module->{name}}{version})) {
-            $installs{ $module->{name} } = { %$module, mymeta => $mymeta };
+            if (my $exist = $installs{$module->{name}}) {
+                my $old_ver = version->new($exist->{provides}{$module->{name}}{version});
+                my $new_ver = version->new($module->{provides}{$module->{name}}{version});
+                if ($new_ver >= $old_ver) {
+                    $installs{ $module->{name} } = { %$module, mymeta => $mymeta };
+                } else {
+                    # Ignore same distributions older than the one we have
+                }
+            } else {
+                $installs{ $module->{name} } = { %$module, mymeta => $mymeta };
+            }
         } else {
             # Ignore installs because cpanfile doesn't accept it
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git



More information about the Pkg-perl-cvs-commits mailing list