check-mirrors check-mirrors.py,1.9,1.10

Seth Vidal (skvidal) fedora-extras-commits at redhat.com
Wed Jul 12 15:30:09 UTC 2006


Author: skvidal

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

Modified Files:
	check-mirrors.py 
Log Message:

fix removal of old files:
note: /var/www/mirrors/foo != /var/lib/mirrors//foo

*sigh*




Index: check-mirrors.py
===================================================================
RCS file: /cvs/fedora/check-mirrors/check-mirrors.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- check-mirrors.py	12 Jul 2006 12:45:54 -0000	1.9
+++ check-mirrors.py	12 Jul 2006 15:30:06 -0000	1.10
@@ -322,8 +322,14 @@
             errorprint('Error creating output path %s for %s' % (s.outputpath, s.mirrorid))
             continue
 
-
-
+        # get the list of the old files
+        new_file_list = []
+        old_file_list = []
+        filematch = '%s/%s*' % (s.outputpath, s.mirrorid)
+        if debug: print filematch
+        old_file_list.extend(glob.glob(filematch))
+        if debug: print old_file_list
+        
         canon = MirrorContainer(s.canonical, ug, s.archlist, gi)
         if len(canon.timestamps.keys()) < len(s.archlist):
             # if we can't get info for all arches for the canonical mirror, exit
@@ -342,9 +348,6 @@
             m = MirrorContainer(url, ug, s.archlist, gi)
             if m:
                 mirrors.append(m)
-        new_file_list = []
-        filematch = '%s/%s*' % (s.outputpath, s.mirrorid)
-        old_file_list = glob.glob(filematch)
         
         # print them out per-arch and per-country
         for arch in s.archlist:
@@ -367,7 +370,7 @@
             for url in glob_urls:
                 glob_fo.write('%s\n' % url)
             glob_fo.close()
-            new_file_list.append(global_file)
+            new_file_list.append(os.path.normpath(global_file))
             
             for code in country_specific.keys():
                 country_file = '%s/%s-%s-%s.txt' % (s.outputpath, s.mirrorid, code, arch)
@@ -375,10 +378,11 @@
                 for url in country_specific[code]:
                     country_fo.write('%s\n' % url)
                 country_fo.close()
-                new_file_list.append(country_file)
+                new_file_list.append(os.path.normpath(country_file))
         
         # clean up
         for fn in old_file_list:
+            fn = os.path.normpath(fn)
             if fn not in new_file_list:
                 if debug: print "removing old file %s" % fn 
                 os.unlink(fn)




More information about the fedora-extras-commits mailing list