[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: state of the cdrom mirrors report



Josip Rodin wrote:
> That would be much better, indeed!
> 
> Or maybe just keep the checked sites normal, and the rest in
> <small><small>... (could not be verified, beware!)</small></small>.

Only problem with <small> is text mode browsers, which can generally at
least display bold. Hmm, doing both doesn't look too bad though.

Here is a patch. This will support cdimage-http-status lines in the
status file if someone ever writes a checker, as well.

-- 
see shy jo
? english/mirror/Mirrors.masterlist.status
? english/mirror/check_cd_mirrors.pl
Index: english/CD/http-ftp/index.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/CD/http-ftp/index.wml,v
retrieving revision 1.15
diff -u -r1.15 index.wml
--- english/CD/http-ftp/index.wml	16 Oct 2002 20:30:45 -0000	1.15
+++ english/CD/http-ftp/index.wml	5 Dec 2002 19:39:24 -0000
@@ -42,9 +42,9 @@
 
 <h2><a name="stable">Official CD images of the "stable" releases</a></h2>
 
-<p>Note that <strong>some mirrors are not up to date</strong> -
-before downloading, check the version number of the images is the
-same as the one listed <a href="../#latest">on this site</a>!</p>
+<p>Mirrors listed below in <b>bold</b> have recently been verified to
+contain at least the first CD image for the i386 architecture.
+Mirrors not listed in bold may be out of date or down.</p>
 
 #use wml::debian::countries
 #include "$(ENGLISHDIR)/CD/http-ftp/cdimage_mirrors.list"
Index: english/distrib/netinst.wml
===================================================================
RCS file: /cvs/webwml/webwml/english/distrib/netinst.wml,v
retrieving revision 1.6
Index: english/mirror/mirror_list.pl
===================================================================
RCS file: /cvs/webwml/webwml/english/mirror/mirror_list.pl,v
retrieving revision 1.44
diff -u -r1.44 mirror_list.pl
@@ -477,18 +477,50 @@
     foreach $site (sort @{ $countries{$country} }) {
       (my $countrycode = $country) =~ s/^(..) .*/$1/;
       if ($which eq "httpftp") {
-        if (defined $mirror{$site}{method}{'cdimage-ftp'} ||
-            defined $mirror{$site}{method}{'cdimage-http'}) {
-          print "<li><${countrycode}c>: $site: ";
+        if (defined $mirror{$site}{method}{'cdimage-ftp'}) {
+	  print "<li>";
+	  my $closetag="";
+	  if ((defined $mirror{$site}{status}{'cdimage-ftp-status'} &&
+	      $mirror{$site}{status}{'cdimage-ftp-status'} eq 'good') ||
+              (defined $mirror{$site}{status}{'cdimage-http-status'} &&
+	      $mirror{$site}{status}{'cdimage-http-status'} eq 'good')) {
+            # Put known-good mirrors in bold.
+            print "<b>";
+	    $closetag="</b>";
+	  }
+	  else {
+            print "<small>";
+	    $closetag="</small>";
+	  }
+          print "<${countrycode}c>: $site: ";
+	  print $closetag;
+	  
           if (defined $mirror{$site}{method}{'cdimage-ftp'}) {
-            print <<END;
-    <a href="ftp://$site$mirror{$site}{method}{'cdimage-ftp'}">FTP</a>
-END
+	    if (defined $mirror{$site}{status}{'cdimage-ftp-status'} &&
+	       $mirror{$site}{status}{'cdimage-ftp-status'} eq 'good') { 
+              print "<b>";
+	      $closetag="</b>";
+	    }
+	    else {
+              print "<small>";
+	      $closetag="</small>";
+	    }
+            print qq{<a href="ftp://$site$mirror{$site}{method}{'cdimage-ftp'}">FTP</a> };
+	    print $closetag;
           }
-          if (defined $mirror{$site}{method}{'cdimage-http'}) {
-            print <<END;
-    <a href="http://$site$mirror{$site}{method}{'cdimage-http'}">HTTP</a>
-END
+          
+	  if (defined $mirror{$site}{method}{'cdimage-http'}) {
+	    if (defined $mirror{$site}{status}{'cdimage-http-status'} &&
+	       $mirror{$site}{status}{'cdimage-http-status'} eq 'good') { 
+              print "<b>";
+	      $closetag="</b>";
+	    }
+	    else {
+              print "<small>";
+	      $closetag="</small>";
+	    }
+            print qq{<a href="http://$site$mirror{$site}{method}{'cdimage-http'}">HTTP</a> };
+	    print $closetag;
           }
           print "</li>\n";
         }
@@ -913,7 +945,7 @@
 	exit;
 }
 
-open SRC, "<$mirror_source" ||
+open SRC, "<$mirror_source" or
   die "Error: problem opening mirror source file, $mirror_source\n"
      ."Use the -m option?\n";
 
@@ -944,6 +976,23 @@
 }
 if ($current ne "") {
 	process_line($current);
+}
+
+open(STATUS, "<$mirror_source.status") ||
+  die "Error: problem opening mirror status file, $mirror_source.status\n"
+     ."Use the -m option?\n";
+{
+	local $/="\n\n";
+	while (<STATUS>) {
+                if (/Site:\s+(.*)/i) {
+                        my $site=$1;
+                        foreach my $line (split("\n", $_)) {
+                                my ($key, $value) = $line =~ /^(.*): (.*)/;
+				$key=lc($key);
+				$mirror{$site}{status}{$key}=$value;
+			}
+		}
+	}
 }
 
 # count the number of mirrors

Attachment: pgppjn2nvevZV.pgp
Description: PGP signature


Reply to: