Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-04-23 04:09:00 +0000
committerDan McGee <dan@archlinux.org>2007-04-23 04:09:00 +0000
commit4f2ecfdee3c19a9a5990513bc3940755d951f91b (patch)
tree7cf456cc20d82a83ca8891ad6844cbceb45d6f8e /scripts
parent5299115020d377fb6a6e4e1094e3a09c2abf88c1 (diff)
rankmirrors: download first 50KB of DB to get more reliable numbers
Scott Horowitz <stonecrest@gmail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rankmirrors20
1 files changed, 18 insertions, 2 deletions
diff --git a/scripts/rankmirrors b/scripts/rankmirrors
index b2cfd18c..3eb10b5a 100644
--- a/scripts/rankmirrors
+++ b/scripts/rankmirrors
@@ -55,7 +55,8 @@ def timeCmd(cmd):
def talkToServer(serverUrl):
opener = urllib2.build_opener()
- tmp = opener.open(serverUrl).read()
+ # retrieve first 50,000 bytes only
+ tmp = opener.open(serverUrl).read(50000)
def getFuncToTime(serverUrl):
return lambda : talkToServer(serverUrl)
@@ -139,8 +140,23 @@ if __name__ == "__main__":
elif options.times:
print ' * ',
sys.stdout.flush()
+
+ # 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] != '/':
+ repoName = splitted2[-3]
+ dbFileName = '/' + repoName + '.db.tar.gz'
+ else:
+ repoName = splitted2[-4]
+ dbFileName = repoName + '.db.tar.gz'
+ except:
+ dbFileName = ''
+
try:
- serverToTime[serverUrl] = timeCmd(getFuncToTime(serverUrl))
+ serverToTime[serverUrl] = timeCmd(getFuncToTime(serverUrl + dbFileName))
if options.verbose:
try:
print "%.2f" % serverToTime[serverUrl]