diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:50:30 +0100 |
| commit | 8b46b0c4bdfbaa07972311b1cf19616d5c5aff04 (patch) | |
| tree | 59167b2b8c1d331bfebf072d5ba84dd154f0b373 /utils | |
| parent | 6c1711a80a8a7d011f4d5f49618ff396ad2f5722 (diff) | |
| parent | 85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff) | |
| download | python-apt-8b46b0c4bdfbaa07972311b1cf19616d5c5aff04.tar.gz | |
merge from the debian experimental branch
Diffstat (limited to 'utils')
| -rwxr-xr-x | utils/get_debian_mirrors.py | 14 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors.py | 20 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors_from_lp.py | 26 | ||||
| -rwxr-xr-x | utils/mirrortest | 4 |
4 files changed, 44 insertions, 20 deletions
diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index ccddf8ed..2e3c7296 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -2,23 +2,23 @@ # # get_debian_mirrors.py # -# Download the latest list with available mirrors from the Debian +# Download the latest list with available mirrors from the Debian # website and extract the hosts from the raw page # # Copyright (c) 2006 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -39,11 +39,13 @@ req = urllib2.Request("http://www.debian.org/mirror/mirrors_full") match = re.compile("^.*>([A-Za-z0-9-.\/_]+)<\/a>.*\n$") match_location = re.compile('^<strong><a name="([A-Z]+)">.*') + def add_sites(line, proto, sites, mirror_type): path = match.sub(r"\1", line) for site in sites: mirror_type.append("%s://%s%s\n" % (proto, site.lstrip(), path)) + try: print "Downloading mirrors list from the Debian website..." uri=urllib2.urlopen(req) diff --git a/utils/get_ubuntu_mirrors.py b/utils/get_ubuntu_mirrors.py index 80586e64..6248ece4 100755 --- a/utils/get_ubuntu_mirrors.py +++ b/utils/get_ubuntu_mirrors.py @@ -8,17 +8,17 @@ # Copyright (c) 2006 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 @@ -42,10 +42,10 @@ try: uri=urllib2.urlopen(req) p = re.compile('^.*((http|ftp):\/\/[A-Za-z0-9-.:\/_]+).*\n*$') for line in uri.readlines(): - if r"[[Anchor(dvd-images)]]" in line: - break - if "http://" in line or "ftp://" in line: - mirrors.append(p.sub(r"\1", line)) + if r"[[Anchor(dvd-images)]]" in line: + break + if "http://" in line or "ftp://" in line: + mirrors.append(p.sub(r"\1", line)) uri.close() except: print "Failed to download or extract the mirrors list!" @@ -57,5 +57,3 @@ for mirror in mirrors: list.write("%s\n" % mirror) list.close() print "Done." - - diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index fc47d708..e10f6864 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -1,4 +1,28 @@ -#!/usr/bin/python +#!/usr/bin/env python +# +# get_ubuntu_lp_mirrors.py +# +# Download the latest list with available Ubuntu mirrors from Launchpad.net +# and extract the hosts from the raw page +# +# Copyright (c) 2006 Free Software Foundation Europe +# +# Author: Sebastian Heinlein <glatzor@ubuntu.com> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA import feedparser import sys diff --git a/utils/mirrortest b/utils/mirrortest index 75ef917b..a724c81f 100755 --- a/utils/mirrortest +++ b/utils/mirrortest @@ -24,8 +24,8 @@ class MirrorTest: host = mirror.hostname except: continue - print "Pinging (Worker %s) %s (%s) ..." % (self.id, - host, + print "Pinging (Worker %s) %s (%s) ..." % (self.id, + host, MirrorTest.completed_pings) commando = os.popen("ping -q -c 4 -W 2 -i 0.3 %s" % host, "r") |
