[carton] 449/472: format 02package like PAUSE does

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:39:35 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 47e54791e34c587a864b4a83a3208b632eb96768
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Sat Apr 25 06:32:03 2015 -0700

    format 02package like PAUSE does
---
 lib/Carton/Index.pm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lib/Carton/Index.pm b/lib/Carton/Index.pm
index 7c7b6cf..f59a65b 100644
--- a/lib/Carton/Index.pm
+++ b/lib/Carton/Index.pm
@@ -35,10 +35,25 @@ Last-Updated: @{[ scalar localtime ]}
 
 EOF
     for my $p ($self->packages) {
-        print $fh sprintf "%s %s  %s\n", pad($p->name, 32), pad($p->version || 'undef', 10, 1), $p->pathname;
+        print $fh $self->_format_line($p->name, $p->version || 'undef', $p->pathname);
     }
 }
 
+sub _format_line {
+    my($self, @row) = @_;
+
+    # from PAUSE::mldistwatch::rewrite02
+    my $one = 30;
+    my $two = 8;
+
+    if (length $row[0] > $one) {
+        $one += 8 - length $row[1];
+        $two = length $row[1];
+    }
+
+    sprintf "%-${one}s %${two}s  %s\n", @row;
+}
+
 sub pad {
     my($str, $len, $left) = @_;
 

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