check-mirrors check-mirrors.conf, NONE, 1.1 check-mirrors.py, 1.1.1.1, 1.2 mirror-check.conf, 1.1.1.1, NONE

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Sun Jul 9 23:41:32 UTC 2006


Author: skvidal

Update of /cvs/fedora/check-mirrors
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv23416

Modified Files:
	check-mirrors.py 
Added Files:
	check-mirrors.conf 
Removed Files:
	mirror-check.conf 
Log Message:

remove mirror-check.conf
add check-mirrors.conf to make the naming consistent
check in new version of script



--- NEW FILE check-mirrors.conf ---
[core-5]
inputfile = /tmp/core-5-mirror-list
outputpath = /tmp/mirrorlists
archlist = i386, x86_64, ppc
timeout = 10
canonical = http://redhat.download.fedoraproject.org/pub/fedora/linux/core/5/$ARCH/os/


Index: check-mirrors.py
===================================================================
RCS file: /cvs/fedora/check-mirrors/check-mirrors.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- check-mirrors.py	9 Jul 2006 23:21:59 -0000	1.1.1.1
+++ check-mirrors.py	9 Jul 2006 23:41:30 -0000	1.2
@@ -12,30 +12,30 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# written by seth vidal - skvidal at fedoraproject.org
 
 # take a definitive repomd.xml
 # compare it to set of them retrieved from mirrors
 # specifically compare the timestamp on the primary.xml on each
-
 # output list of good mirrors for a given path.
 
+# TODO:
+# - better error handling
+# - push into a db?
+# - make sure we're overwriting the mirror lists output files, not simply 
+#    appending to the old ones
+# - separate cgi script needed to return the proper geoip-based file for
+#    the requesting client's country, if it exists, otherwise return the global 
+#    file.
+#     - cgi should accept a get-variable which allows you to only output the
+#       global mirrorlist - not the country-specific one and/or specify 
+#       a country.
+# - have it default to a config file in /etc/mirror-check.conf
+# - have it accept an option which specifies a section in the config file
+#    to operate on - rather than doing all of them.
 
 debug = True
 
-# TODO:
-# better error handling
-# push into a db?
-# read from a config file for various mirrors
-#   config info:
-#    mirrorlist-input-file
-#    mirrorlist-output-path
-#    path-to-repodata
-#    archlist
-#    canonical repo's baseurlfor this mirrorlist
-#    timeout for mirror check
-#    close-enough time for 'good' mirrors
-#use geoip module to figure out country of-origin per-mirror and write
-#   out per-country lists as well as a global list.
 
 import os
 import sys
@@ -176,6 +176,8 @@
             print 'open checksum: %s - %s' %  thisdata.openchecksum
 
 class MirrorContainer(object):
+    """Holder for info about a specific mirror"""
+    
     def __init__(self, url, grabber, archlist, gi):
         self.url = url
         self.grabber = grabber
@@ -212,10 +214,6 @@
                 del fo
     
     def get_country(self, url):
-        # unparse url
-        # resolve out ip
-        # get county by addr
-        
         url_parts = urlparse.urlparse(url)
         h = url_parts[1]
         addr = socket.gethostbyname(h)
@@ -226,6 +224,9 @@
 
 
 class MirrorListInfo(object):
+    """Holder for config info from the configuration file about the 
+       mirrorlist being checked"""
+       
     def __init__(self):
         self.archlist = ['i386', 'x86_64', 'ppc']
         self.mirrorid = None
@@ -304,7 +305,7 @@
     gi = GeoIP.new(GeoIP.GEOIP_STANDARD)
     
     # grab the canonical mirrors info
-    for s in sections:    
+    for s in sections:
 
         s.populate_mirrorlist()
         if len(s.mirrorlist) < 1:
@@ -329,23 +330,17 @@
                 if canon.timestamps.has_key(arch):
                     print '  %s: %s' % (arch, canon.timestamps[arch])
 
-        
-        # get the info for all the mirrors        
+        # get the info for all the mirrors
             
         for url in s.mirrorlist:
             m = MirrorContainer(url, ug, s.archlist, gi)
             if m:
                 mirrors.append(m)
 
-        # output should be:
-        # s.outputpath/s.mirrorid-$country-$arch.txt
-        # s.outputpath/s.mirrorid-global-$arch.txt
-        
-        
-        # print them out per-arch
+        # print them out per-arch and per-country
         for arch in s.archlist:
             glob = '%s/%s-global-%s.txt' % (s.outputpath, s.mirrorid, arch)
-            glob_fo = open(glob, 'w+')
+            glob_fo = open(glob, 'w')
             for m in mirrors:
                 if m.timestamps.has_key(arch):
                     if m.timestamps[arch] == canon.timestamps[arch]:
@@ -361,4 +356,3 @@
 if __name__ == '__main__':
     main(sys.argv[1])
 
-


--- mirror-check.conf DELETED ---




More information about the fedora-extras-commits mailing list