check-mirrors check-mirrors.py,1.5,1.6
Seth Vidal (skvidal)
fedora-extras-commits at redhat.com
Tue Jul 11 15:57:43 UTC 2006
- Previous message (by thread): rpms/xsp/devel xsp.spec,1.8,1.9
- Next message (by thread): rpms/octave-forge/devel octave-forge-2006.07.09-legend.patch, NONE, 1.1 octave-forge.spec, 1.25, 1.26 octave-forge-2006.03.17-octcdf.patch, 1.1, NONE octave-forge-2006.03.17-zplane.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: skvidal
Update of /cvs/fedora/check-mirrors
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2151
Modified Files:
check-mirrors.py
Log Message:
- make sure files overwrite the old ones
- add FIXME for potential problem
Index: check-mirrors.py
===================================================================
RCS file: /cvs/fedora/check-mirrors/check-mirrors.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- check-mirrors.py 11 Jul 2006 14:39:47 -0000 1.5
+++ check-mirrors.py 11 Jul 2006 15:57:41 -0000 1.6
@@ -22,11 +22,14 @@
# 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
# - have it accept an option which specifies a section in the config file
# to operate on - rather than doing all of them.
+#FIXME
+# when writing out the new country-specific files - if a country no longer
+# has any valid mirrors then that country-specific file will still exist
+# something needs to happen clean up the old/invalid country files
+
debug = True
__revision__ = '$Id$'
@@ -345,19 +348,33 @@
# 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_urls = []
+ country_specific = {}
+
for m in mirrors:
if m.timestamps.has_key(arch):
if m.timestamps[arch] == canon.timestamps[arch]:
- glob_fo.write('%s\n' % m.url)
+ glob_urls.append(m.url)
if m.country:
- country = '%s/%s-%s-%s.txt' % (s.outputpath, s.mirrorid, m.country, arch)
- country_fo = open(country, 'a')
- country_fo.write('%s\n' % m.url)
- country_fo.close()
+ if not country_specific.has_key(m.country):
+ country_specific[m.country] = []
+
+ country_specific[m.country].append(m.url)
+
+ glob = '%s/%s-global-%s.txt' % (s.outputpath, s.mirrorid, arch)
+ glob_fo = open(glob, 'w')
+ for url in glob_urls:
+ glob_fo.write('%s\n' % url)
glob_fo.close()
+ for code in country_specific.keys():
+ country = '%s/%s-%s-%s.txt' % (s.outputpath, s.mirrorid, code, arch)
+ country_fo = open(country, 'w')
+ for url in country_specific[code]:
+ country_fo.write('%s\n' % url)
+ country_fo.close()
+
+
if __name__ == '__main__':
if len(sys.argv) < 2:
- Previous message (by thread): rpms/xsp/devel xsp.spec,1.8,1.9
- Next message (by thread): rpms/octave-forge/devel octave-forge-2006.07.09-legend.patch, NONE, 1.1 octave-forge.spec, 1.25, 1.26 octave-forge-2006.03.17-octcdf.patch, 1.1, NONE octave-forge-2006.03.17-zplane.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list