Package: devscripts
Version: 2.9.8
Severity: wishlist
Tags: patch

I have been encountering problems lately with www.cpan.org as it often
takes a very long time to respond (it always get there in the end
though). The hard-wired default timeout for uscan of 20 seconds often
is not sufficient. I have written a patch for uscan which allows the
LWP timeout to be specified from the command line or a config file. I
would be most grateful if you would consider it for inclusion.

Thanks,

Stephen Quinney

--- /usr/bin/uscan      2005-10-16 13:54:44.000000000 +0100
+++ ./uscan     2005-10-22 12:43:08.000000000 +0100
@@ -76,6 +76,8 @@
     --no-download  Report on newer and absent versions, but don\'t download
     --pasv         Use PASV mode for FTP connections
     --no-pasv      Do not use PASV mode for FTP connections (default)
+    --timeout 20   Specifies how much time, in seconds, we give remote
+                   servers to respond (default 20 seconds)
     --symlink      Make an orig.tar.gz symlink to downloaded file (default)
     --rename       Rename to orig.tar.gz instead of symlinking
                    (Both will use orig.tar.bz2 if appropriate)
@@ -145,6 +147,7 @@
 my $dehs_end_output = 0;
 my $dehs_start_output = 0;
 my $pkg_report_header = '';
+my $timeout = 20;
 
 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
     $modified_conf_msg = "  (no configuration files read)";
@@ -152,6 +155,7 @@
 } else {
     my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
     my %config_vars = (
+                       'USCAN_TIMEOUT' => 20,
                       'USCAN_DOWNLOAD' => 'yes',
                       'USCAN_PASV' => 'default',
                       'USCAN_SYMLINK' => 'symlink',
@@ -179,6 +183,8 @@
        or $config_vars{'USCAN_DOWNLOAD'}='yes';
     $config_vars{'USCAN_PASV'} =~ /^(yes|no|default)$/
        or $config_vars{'USCAN_PASV'}='default';
+    $config_vars{'USCAN_TIMEOUT'} =~ m/^\d+$/
+        or $config_vars{'USCAN_TIMEOUT'}=20;
     $config_vars{'USCAN_SYMLINK'} =~ /^(yes|no|symlinks?|rename)$/
        or $config_vars{'USCAN_SYMLINK'}='yes';
     $config_vars{'USCAN_SYMLINK'}='symlink'
@@ -190,7 +196,6 @@
        or $config_vars{'USCAN_DEHS_OUTPUT'}='no';
     $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'} =~ /^[012]$/
        or $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'}=1;
-
     foreach my $var (sort keys %config_vars) {
        if ($config_vars{$var} ne $config_default{$var}) {
            $modified_conf_msg .= "  $var=$config_vars{$var}\n";
@@ -202,6 +207,7 @@
     $download = $config_vars{'USCAN_DOWNLOAD'} eq 'no' ? 0 : 1;
     $passive = $config_vars{'USCAN_PASV'} eq 'yes' ? 1 :
        $config_vars{'USCAN_PASV'} eq 'no' ? 0 : 'default';
+    $timeout = $config_vars{'USCAN_TIMEOUT'};
     $symlink = $config_vars{'USCAN_SYMLINK'};
     $verbose = $config_vars{'USCAN_VERBOSE'} eq 'yes' ? 1 : 0;
     $dehs = $config_vars{'USCAN_DEHS_OUTPUT'} eq 'yes' ? 1 : 0;
@@ -213,7 +219,7 @@
 my $debug = 0;
 my ($opt_h, $opt_v, $opt_download, $opt_report, $opt_passive, $opt_symlink);
 my ($opt_verbose, $opt_ignore, $opt_level, $opt_regex, $opt_noconf);
-my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs);
+my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs, $opt_timeout);
 
 GetOptions("help" => \$opt_h,
           "version" => \$opt_v,
@@ -221,6 +227,7 @@
           "report" => sub { $opt_download = 0; },
           "report-status" => sub { $opt_download = 0; $opt_report = 1; },
           "passive|pasv!" => \$opt_passive,
+           "timeout=i" => \$opt_timeout,
           "symlink!" => sub { $opt_symlink = $_[1] ? 'symlink' : 'no'; },
           "rename" => sub { $opt_symlink = 'rename'; },
           "package=s" => \$opt_package,
@@ -248,6 +255,7 @@
 $download = $opt_download if defined $opt_download;
 $report = $opt_report if defined $opt_report;
 $passive = $opt_passive if defined $opt_passive;
+$timeout = $opt_timeout if defined $opt_timeout;
 $symlink = $opt_symlink if defined $opt_symlink;
 $verbose = $opt_verbose if defined $opt_verbose;
 $dehs = $opt_dehs if defined $opt_dehs;
@@ -305,7 +313,7 @@
 # to restore $ENV{'FTP_PASSIVE'} to what it was at this point
 
 my $user_agent = LWP::UserAgent->new(env_proxy => 1);
-$user_agent->timeout("20");
+$user_agent->timeout($timeout);
 
 if (defined $opt_watchfile) {
     die "Can't have directory arguments if using --watchfile" if @ARGV;


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12.6
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages devscripts depends on:
ii  debianutils                   2.15       Miscellaneous utilities specific t
ii  dpkg-dev                      1.13.11    package building tools for Debian
ii  libc6                         2.3.5-7    GNU C Library: Shared libraries an
ii  perl                          5.8.7-7    Larry Wall's Practical Extraction 
ii  sed                           4.1.4-4    The GNU sed stream editor

Versions of packages devscripts recommends:
ii  fakeroot                      1.5.4      Gives a fake root environment

-- no debconf information


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

Reply via email to