Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2007-09-17 19:04:54 +0200
committerDan McGee <dan@archlinux.org>2007-09-17 19:32:39 -0500
commit3955858a2d75592ff3f7e2636b39841fc7269174 (patch)
treec285d7e4bf1cbe2282c1906244e1f91cf0788bba
parent708488f6fe8bf5e06ae724243381b40586301633 (diff)
rankmirrors : add support for the $repo var in url.
To keep working correctly with url like : ftp://ftp.archlinux.org/$repo/os/i686 rankmirrors will now replace $repo by core. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/rankmirrors.py.in10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/rankmirrors.py.in b/scripts/rankmirrors.py.in
index b68bc548..04a490ac 100644
--- a/scripts/rankmirrors.py.in
+++ b/scripts/rankmirrors.py.in
@@ -22,6 +22,7 @@
#
import os, sys, datetime, time, socket, urllib2
from optparse import OptionParser
+from string import Template
def createOptParser():
usage = "usage: %prog [options] MIRRORFILE | URL"
@@ -149,12 +150,15 @@ if __name__ == "__main__":
print ' * ',
sys.stdout.flush()
+ # if the $repo var is used in the url, replace it by core
+ tempUrl = Template(serverUrl).safe_substitute(repo='core')
+
# add *.db.tar.gz to server name. the repo name is parsed
# from the mirror url; it is the third (or fourth) dir
# from the end, where the url is http://foo/bar/REPO/os/arch
try:
- splitted2 = serverUrl.split('/')
- if serverUrl[-1] != '/':
+ splitted2 = tempUrl.split('/')
+ if tempUrl[-1] != '/':
repoName = splitted2[-3]
dbFileName = '/' + repoName + '.db.tar.gz'
else:
@@ -164,7 +168,7 @@ if __name__ == "__main__":
dbFileName = ''
try:
- serverToTime[serverUrl] = timeCmd(getFuncToTime(serverUrl + dbFileName))
+ serverToTime[serverUrl] = timeCmd(getFuncToTime(tempUrl + dbFileName))
if options.verbose:
try:
print "%.2f" % serverToTime[serverUrl]