check-mirrors return-mirrorlist.conf, 1.2, 1.3 return-mirrorlist.py, 1.3, 1.4
Seth Vidal (skvidal)
fedora-extras-commits at redhat.com
Tue Jul 11 15:17:38 UTC 2006
Author: skvidal
Update of /cvs/fedora/check-mirrors
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv938
Modified Files:
return-mirrorlist.conf return-mirrorlist.py
Log Message:
add file_prefix config option to keep naming flexible
Index: return-mirrorlist.conf
===================================================================
RCS file: /cvs/fedora/check-mirrors/return-mirrorlist.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- return-mirrorlist.conf 11 Jul 2006 14:39:47 -0000 1.2
+++ return-mirrorlist.conf 11 Jul 2006 15:17:36 -0000 1.3
@@ -1,3 +1,5 @@
[core-5]
path=/tmp/foopath
+file_prefix=core-5 # prefix for the mirrorlist filenames - defaults to the
+ # section name (the name in brackets)
Index: return-mirrorlist.py
===================================================================
RCS file: /cvs/fedora/check-mirrors/return-mirrorlist.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- return-mirrorlist.py 11 Jul 2006 15:05:42 -0000 1.3
+++ return-mirrorlist.py 11 Jul 2006 15:17:36 -0000 1.4
@@ -50,11 +50,16 @@
conf.read(CONFIG)
config = ConfigHolder()
config.paths = {}
+ config.prefixes = {}
for section in conf.sections():
if conf.has_option(section, 'path'):
config.paths[section] = conf.get(section, 'path')
-
+ if conf.has_option(section, 'file_prefix'):
+ config.prefixes[section] = conf.get(section, 'file_prefix')
+ else:
+ config.prefixes[section] = '%s' % section
+
return config
@@ -102,6 +107,7 @@
# path to mirrorlists
lists_path = config.paths[repo]
+ prefix = config.prefixes[repo]
# get geoip resolution
# if country-specific file exists
@@ -119,7 +125,7 @@
if not country:
country = 'global'
- return_file = '%s/%s-%s-%s.txt' % (lists_path, repo, country, arch)
+ return_file = '%s/%s-%s-%s.txt' % (lists_path, prefix, country, arch)
rp = os.path.realpath(return_file)
if not rp.startswith(lists_path):
@@ -128,7 +134,9 @@
if not os.path.exists(return_file):
print '# no file found for repo = %s, country = %s, arch = %s' % (repo, country,arch)
-
+ print '# filename was: %s' % os.path.basename(return_file)
+ sys.exit()
+
print '# repo = %s country = %s arch = %s ' % (repo, country, arch)
fo = open(return_file, 'r')
for line in fo.readlines():
More information about the fedora-extras-commits
mailing list