You are not logged in.

#1 2009-08-08 05:05:12

bruenig
Member
Registered: 2007-05-20
Posts: 175

Bash port of rankmirrors

The rankmirrors currently depends on python. That is absurd. I rewrote it using bash+coreutils+curl. Curl is a much more comfortable depend than python I do say. If this is up to snuff, I think it should replace the existing rankmirrors in pacman.

It should work the exact same as the previous one with a few differences:

1. When you KeyboardInterrupt, it still shoots out the mirrors it has timed in a sorted manner like the python one, but the behavior is slightly different if you are attempting to redirect that output to a file. I don't think this is significant and shouldn't really affect anyone, but it is there.

2. The rankmirrors -u option works now with a literal url like "http://mirrors.gigenet.com/archlinux/core/os/i686" and a url with the repo variable still there like 'http://mirrors.gigenet.com/archlinux/$repo/os/i686' So this actually adds functionality to the script. Woot!

3. Times are calculated to the milisecond and not the hundredth of a second.

Other than that, it appears to work just the same. All of the times that are reported come from curl's %{total_time} output. The results are sometimes different from the python socket stuff that is used in the python one, but I don't know that it is significant. I mean variations occur in every invocation of either one of the scripts. So just showing that they have different times doesn't prove much. Also I trust libcurl over some python socket lib anyways.

Code at the github, just a single bash script: http://github.com/bruenig/rankmirrors/tree/master


Edit: I misunderstood how -n was supposed to work. Fixed it.

Last edited by bruenig (2009-08-09 17:52:07)

Offline

#2 2009-08-08 06:02:45

Kiwi
Member
Registered: 2008-02-24
Posts: 153

Re: Bash port of rankmirrors

^5

When I suggested you write it in bash I did not expect you to actually do it. Good job!

Hopefully the devs show it some love. big_smile

Offline

#3 2009-08-08 13:37:48

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: Bash port of rankmirrors

nice job breunig , it would be awesome if the script also checks how up to date the mirror is,

Offline

#4 2009-08-08 14:06:28

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Bash port of rankmirrors

Nice bruenig smile.


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#5 2009-08-08 15:46:11

hullap
Member
From: New Delhi, India
Registered: 2008-08-17
Posts: 84
Website

Re: Bash port of rankmirrors

nice work smile

Offline

#6 2009-08-08 18:17:28

Wintervenom
Member
Registered: 2008-08-20
Posts: 1,011

Re: Bash port of rankmirrors

Words cannot describe the sheer awesomeness of this script.

Last edited by Wintervenom (2009-08-08 18:18:07)

Offline

#7 2009-08-08 20:31:55

fogobogo
Member
Registered: 2008-08-24
Posts: 83

Re: Bash port of rankmirrors

just did pacman -Syu. why isnt it already there?!?!! big_smile

Offline

#8 2009-08-08 22:13:43

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Bash port of rankmirrors

You brought the claque bruenig, didn't you? tongue


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#9 2009-08-08 23:22:05

bruenig
Member
Registered: 2007-05-20
Posts: 175

Re: Bash port of rankmirrors

B wrote:

You brought the claque bruenig, didn't you? tongue

These are all unsolicited opinions. No serious person would disagree.

Offline

#10 2009-08-10 03:21:51

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Bash port of rankmirrors

Not bad for a web developer! it's a keeper

vote+1

Offline

#11 2009-08-10 07:06:03

Gen2ly
Member
From: Sevierville, TN
Registered: 2009-03-06
Posts: 1,529
Website

Re: Bash port of rankmirrors

Very nice!  This is a good idea... does it have a name?

Last edited by Gen2ly (2009-08-10 07:09:11)


Setting Up a Scripting Environment | Proud donor to wikipedia - link

Offline

#12 2009-08-10 21:18:18

bruenig
Member
Registered: 2007-05-20
Posts: 175

Re: Bash port of rankmirrors

Gen2ly wrote:

Very nice!  This is a good idea... does it have a name?

rankmirrors is its name, seeking to replace the existing one

Offline

#13 2009-08-10 21:42:50

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Bash port of rankmirrors

The python dependency always irked me just a bit....nice job!
Submitted to flyspray yet?

Offline

#14 2009-08-11 06:23:17

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: Bash port of rankmirrors

Misfit138 wrote:

The python dependency always irked me just a bit....nice job!
Submitted to flyspray yet?

That would be great and makes it more coreutils only.

Offline

#15 2009-09-19 00:16:37

Evanlec
Member
From: NH, USA
Registered: 2007-12-16
Posts: 141
Website

Re: Bash port of rankmirrors

Why not put this on AUR?

Offline

Board footer

Powered by FluxBB