[pacman-dev] makepkg FS#6708 patch
Scott Horowitz
stonecrest at gmail.com
Tue Mar 27 00:46:47 EDT 2007
As per FS#6708, here is a patch against makepkg to download the first
50kb of the db.tar.gz file. Feel free to tweak the number, I thought
it was a good balance between getting an accurate number and making
dialup users wait.
--- /usr/bin/rankmirrors 2007-03-25 20:07:04.000000000 -0600
+++ rankmirrors 2007-03-26 22:39:23.000000000 -0600
@@ -55,7 +55,8 @@
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,18 @@
elif options.times:
print ' * ',
sys.stdout.flush()
+
+ # add db.tar.gz to server name
+ try:
+ splitted2 = serverUrl.split('/')
+ dbFileName = splitted2[len(splitted2) - 3] + '.db.tar.gz'
+ if serverUrl[-1] != '/':
+ dbFileName = '/' + dbFileName
+ except:
+ dbFileName = ''
+
try:
- serverToTime[serverUrl] = timeCmd(getFuncToTime(serverUrl))
+ serverToTime[serverUrl] = timeCmd(getFuncToTime(serverUrl
+ dbFileName))
if options.verbose:
try:
print "%.2f" % serverToTime[serverUrl]
More information about the pacman-dev
mailing list