[carton] 58/472: Display tree for superflous modules in local

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:32 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 dbb3ce29c83d04ed2c25430c54bcd32596436973
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Sun Jun 26 17:33:08 2011 -0700

    Display tree for superflous modules in local
---
 lib/Carton.pm     |  7 +++----
 lib/Carton/CLI.pm | 15 +++++++++------
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index 7d89b7a..e8629db 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -171,17 +171,16 @@ sub is_core {
 };
 
 sub walk_down_tree {
-    my($self, $lock, $cb) = @_;
+    my($self, $tree, $cb) = @_;
 
     my %seen;
-    my $tree = $self->build_tree($lock->{modules});
     $tree->walk_down(sub {
         my($node, $depth, $parent) = @_;
         return $tree->abort if $seen{$node->key}++;
 
         if ($node->metadata->{dist}) {
             $cb->($node->metadata, $depth);
-        } elsif ($self->is_core($node->key, 0)) {
+        } elsif (!$self->is_core($node->key, 0)) {
             warn "Couldn't find ", $node->key, "\n";
         }
     });
@@ -314,7 +313,7 @@ sub check_satisfies {
 
     return {
         unsatisfied => \@unsatisfied,
-        superflous  => [ values %pool ],
+        superflous  => $self->build_tree(\%pool),
     };
 }
 
diff --git a/lib/Carton/CLI.pm b/lib/Carton/CLI.pm
index 621ff2b..e7e44c5 100644
--- a/lib/Carton/CLI.pm
+++ b/lib/Carton/CLI.pm
@@ -175,7 +175,8 @@ sub cmd_show {
         or $self->error("Can't find carton.lock: Run `carton install` to rebuild the spec file.\n");
 
     if ($tree_mode) {
-        $self->carton->walk_down_tree($lock, sub {
+        my $tree = $self->carton->build_tree($lock->{modules});
+        $self->carton->walk_down_tree($tree, sub {
             my($module, $depth) = @_;
             print "  " x $depth;
             print "$module->{dist}\n";
@@ -207,16 +208,18 @@ sub cmd_check {
     if (@{$res->{unsatisfied}}) {
         $self->print("Following dependencies are not satisfied. Run `carton install` to install them.\n", WARN);
         for my $dep (@{$res->{unsatisfied}}) {
-            $self->print("  $dep->{module} " . ($dep->{version} ? "($dep->{version})" : "") . "\n");
+            $self->print("$dep->{module} " . ($dep->{version} ? "($dep->{version})" : "") . "\n");
         }
         $ok = 0;
     }
 
-    if (@{$res->{superflous}}) {
+    if ($res->{superflous}) {
         $self->print("Following modules are found in $self->{path} but couldn't be tracked from your $file\n", WARN);
-        for my $dep (@{$res->{superflous}}) {
-            $self->print("  $dep->{module} " . ($dep->{version} ? "($dep->{version})" : "") . "\n");
-        }
+        $self->carton->walk_down_tree($res->{superflous}, sub {
+            my($module, $depth) = @_;
+            print "  " x $depth;
+            print "$module->{dist}\n";
+        });
         $ok = 0;
     }
 

-- 
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