You are not logged in.

#26 2006-03-06 17:23:34

MAC!EK
Member
Registered: 2005-09-27
Posts: 267

Re: script to find fastest repository

Mayby when mirrors are synced the last file synced should by the db file.

Offline

#27 2006-11-25 02:56:33

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

Re: script to find fastest repository

Hi drakosha!

Are there any dependencies required to run your script? I mean of course except of python.
I tried to run your script but python stopped it and gave me this error message:

# repository_test.py
  File "/usr/local/bin/repository_test.py", line 3
    import urllib2
    ^
SyntaxError: invalid syntax

Offline

#28 2006-11-25 13:31:22

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: script to find fastest repository

No problems here, maybe a copy&paste problem? By the way, I run it with 'python repotest.py'.


1000

Offline

#29 2006-11-25 13:39:12

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: script to find fastest repository

drakosha: You may want to use http://pastebin.archlinux.org/ for your code. There is a download button which people can use instead of chancing errors from a copy.

Offline

#30 2006-12-02 07:27:45

cyberpatrol
Member
From: Germany
Registered: 2006-11-22
Posts: 68

Re: script to find fastest repository

byte wrote:

No problems here, maybe a copy&paste problem? By the way, I run it with 'python repotest.py'.

I don't think that it's a copy & paste problem because the syntax error is in the third line and the first three lines in my copy are identical to the first three lines in the script posted above.

And you don't need to explicitly call python because the necessary interpreter is given in the first line of a script by "#!<path_to_interpreter>". So if you just run an executable file, in this case just `repotest.py`, Linux - I can't remember which program exactly - first looks at the first line of the script or reads the magic number - I think that's what it's called - of a binary and calls automagically the correct script interpreter or runs it natively if it's a binary.

Offline

#31 2006-12-03 23:15:42

sabooky
Member
Registered: 2006-11-02
Posts: 89

Re: script to find fastest repository

drakosha, I've written a python script for the same thing about a month ago. However, I lost interest before I got it good enough for other people to use. It works fine for me, it just takes a long time.

Since, your working on this now, maybe you can take a look at my script and see if there's anything in there thats useful to you.

http://pastebin.archlinux.org/273

Its not really commented, so dunno how helpful it will be.

Basically this is what my script does:

1. It downloads the [reponame].db.tar.gz file from ftp.archlinux.org.
2. It downloads that file from every mirror in your repo list. while tracking how long the download took.
3. it compares the mirror db file to the archlinux.org db file, and flags it as outdated if they don't match
4. it sorts working mirrors in order, followed by outdated mirrors in order. then lastly it has the non working mirrors commented out at the bottom.
5. it backs up your mirror list file and saves the new list as the new one.

The thing I didn't like about my script is it took a very long time, since its downloading a db file from every mirror. I tried getting the mdtm from servers, but found that not all servers have that command. So I just resorted to doing everything manually. I was hoping to find a reliable way of getting an accurate mdtm and thus maybe having mirrors that are less then 1 day behind marked as up to date. As it stands now, if the files don't match up exactly that mirror is downgraded to out of date.

If you have any questions about my script, feel free to pm me.

Offline

#32 2006-12-06 22:03:40

yankees26
Member
From: Connecticut, USA
Registered: 2006-09-29
Posts: 190

Re: script to find fastest repository

I made a companion script that will take the url of a server and test just that repo so you don't have to go through a whole file of repo's and adding or deleting a repo just to test it and go through the whole file.

pastebin.archlinux

Offline

#33 2006-12-10 10:57:22

islamguide.com
Member
Registered: 2006-12-08
Posts: 98

Re: script to find fastest repository

I got the same error as above;

python repotest.py

  File "repotest.py", line 3
    import urllib2
    ^
SyntaxError: invalid syntax

What do u mean by copy paste problem?

Thanks in advance!


Thanks in advance!

Offline

#34 2006-12-10 17:22:23

drakosha
Member
Registered: 2006-01-03
Posts: 253
Website

Re: script to find fastest repository

Python is sensitive to spaces/tabs. While doing copy-paste you by accident added some spaces/tabs. Look above and take from the pastebin smile

Offline

Board footer

Powered by FluxBB