#598382 debmirror: better progress reporting would be nice

#598382#5
Date:
2010-09-28 15:46:03 UTC
From:
To:
It would be nice if debmirror could report progress better. Two things
would improve this a lot:

* count total bytes to download rather than number of files to download
* report per-file progress as well
* estimate remaining time (bytes to download divided by speed so far)

I need to learn how to count, though.

#598382#10
Date:
2010-09-29 20:02:57 UTC
From:
To:
Lars Wirzenius wrote:

The percentage printed with -v is based on the bytes that need
downloaded.


This would be nice.

#598382#15
Date:
2010-09-29 21:06:45 UTC
From:
To:
Oh. I wonder why I thought differently? Never mind.

I don't seem to get any visible difference for http with the -p option.
Would it be hard to add it to http?

#598382#20
Date:
2010-09-29 21:29:55 UTC
From:
To:
Lars Wirzenius wrote:

Oh, I guess it's supported for ftp and rsync. This patch seems all that
would be needed for http. I haven't tested it, ENOBANDWIDTH.

diff --git a/debmirror b/debmirror
index ff4bd08..5b4e931 100755
--- a/debmirror
+++ b/debmirror
@@ -800,6 +800,7 @@ sub init_connection {
     $ua = LWP::UserAgent->new(keep_alive => 1);
     $ua->proxy('http', $ENV{http_proxy}) if $ENV{http_proxy};
     $ua->proxy('http', $proxy) if $proxy;
+    $ua->show_progress($progress);
     return;
   };

@@ -1507,7 +1508,8 @@ sub http_get {
   my $ret=1;

   print "$url => " if ($debug);
-  print_percent "Getting: $file... " if $progress or $verbose;
+  print_percent "Getting: $file" if $progress or $verbose;
+  print $progress ? "\t #" : "... ";
   if (! $do_dry_run) {
     unlink($file) if (-f $file);
     $ret = $ua->mirror($url, $file);

#598382#25
Date:
2010-10-07 12:03:52 UTC
From:
To:
I am testing it now. It does seem to work. Yay.