[pacman-dev] makepkg FS#6708 patch
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]
On 3/26/07, Scott Horowitz <stonecrest@gmail.com> wrote:
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.
Sorry, patch got wrapped on one line. Try the attachment. Scott
As pointed out to me, the subject should have read rankmirrors, not makepkg. I blame my cat. And here is an updated patch, disregard the previous one. This fixes a problem if the server url has a trailing slash, adds more comments, and makes the voodoo magic a bit more explicit. Scott
participants (1)
-
Scott Horowitz