Package: debmirror
Version: 20041209
Severity: wishlist

The included patch adds an option --max-bytes to the ftp/http/hftp methods of 
debmirror that allows to limit the amount of data downloaded.

This feature is convenient e.g. for volume based DSL subscriptions to max
out the remaining bandwidth at the end of a statement period.



--- debmirror.orig      2005-01-29 11:48:48.000000000 +0100
+++ debmirror   2005-01-29 12:58:20.000000000 +0100
@@ -222,6 +222,10 @@
 
 Download at most max-batch number of files (and ignore rest).
 
+=item --max-bytes=number
+
+Download at most max-bytes bytes of data (and ignore rest).
+
 =item --rsync-batch=number
 
 Download at most number of files with each rsync call and then loop.
@@ -316,6 +320,7 @@
 my $timeout=300;
 my $max_batch=0;
 my $rsync_batch=200;
+my $max_bytes=0;
 my $num_errors=0;
 my $bytes_to_get=0;
 my $bytes_gotten=0;
@@ -360,6 +365,7 @@
           'timeout|t=s'  => \$timeout,
           'max-batch=s'  => \$max_batch,
           'rsync-batch=s'  => \$rsync_batch,
+          'max-bytes=s'  => \$max_bytes,
           'ignore-missing-release' => \$ignore_release,
           'ignore-release-gpg' => \$ignore_release_gpg,
           'dry-run'      => \$dry_run_var,
@@ -398,6 +404,7 @@
 }
 say("Proxy: $proxy.") if $proxy;
 say("Download at most $max_batch files.") if ($max_batch > 0);
+say("Download at most $max_bytes bytes of data.") if ($max_bytes > 0);
 say("Download at most $rsync_batch files per rsync call.") if 
($download_method eq "rsync");
 say("Dry run.") if $dry_run_var;
 
@@ -731,6 +738,11 @@
          $num_errors++;
          last;
        }
+       if ($max_bytes > 0 && $bytes_gotten >= $max_bytes) {
+         push (@errlog,"Bytes limit exceeded, mirror run was partial\n");
+         $num_errors++;
+         last;
+       }
       }
     }
     last DOWNLOAD;
@@ -751,6 +763,11 @@
          $num_errors++;
          last;
        }
+       if ($max_bytes > 0 && $bytes_gotten >= $max_bytes) {
+         push (@errlog,"Bytes limit exceeded, mirror run was partial\n");
+         $num_errors++;
+         last;
+       }
       }
     }
     last DOWNLOAD;
@@ -771,6 +788,11 @@
          $num_errors++;
          last;
        }
+       if ($max_bytes > 0 && $bytes_gotten >= $max_bytes) {
+         push (@errlog,"Bytes limit exceeded, mirror run was partial\n");
+         $num_errors++;
+         last;
+       }
       }
     }
     last DOWNLOAD;




-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: LANG=C, [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages debmirror depends on:
ii  bzip2                         1.0.2-1    A high-quality block-sorting file 
ii  libcompress-zlib-perl         1.33-3     Perl module for creation and manip
ii  liblockfile-simple-perl       0.2.5-4    Simple advisory file locking
ii  libwww-perl                   5.803-3    WWW client/server library for Perl
ii  perl [libdigest-md5-perl]     5.8.4-5    Larry Wall's Practical Extraction 
ii  perl-modules [libnet-perl]    5.8.4-5    Core Perl modules
ii  rsync                         2.6.3-2    fast remote file copy program (lik

-- no debconf information

-- 
Christoph Scheurer                                  GnuPG key Id: 0x6128C6B6


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to