diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2009-06-07 22:38:25 -0300 |
|---|---|---|
| committer | Otavio Salvador <otavio@ossystems.com.br> | 2009-06-07 22:38:25 -0300 |
| commit | 30097eb0ca355c6c1b2fe8308badeb68097c4aff (patch) | |
| tree | 26f83b31ec395c297be6360efecfe0618f53c2dc | |
| parent | b285f7334fc4aa735993a057c8788876620e55cb (diff) | |
| download | python-apt-30097eb0ca355c6c1b2fe8308badeb68097c4aff.tar.gz | |
utils/get_debian_mirrors.py: updated to support current mirror page.
| -rw-r--r-- | debian/changelog | 3 | ||||
| -rwxr-xr-x | utils/get_debian_mirrors.py | 13 |
2 files changed, 10 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index fd00799f..fe201c9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ python-apt (0.7.10.4) UNRELEASED; urgency=low * data/templates/Ubuntu.info.in: - updated for the new ubuntu karmic version + [ Otavio Salvador ] + * utils/get_debian_mirrors.py: updated to support current mirror page. + -- Michael Vogt <mvo@debian.org> Tue, 05 May 2009 12:03:27 +0200 python-apt (0.7.10.3) unstable; urgency=low diff --git a/utils/get_debian_mirrors.py b/utils/get_debian_mirrors.py index 2e3c7296..9fb783bd 100755 --- a/utils/get_debian_mirrors.py +++ b/utils/get_debian_mirrors.py @@ -5,7 +5,7 @@ # 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 +# Copyright (c) 2006, 2009 Free Software Foundation Europe # # Author: Sebastian Heinlein <glatzor@ubuntu.com> # @@ -37,7 +37,8 @@ list_path = "../data/templates/Debian.mirrors" 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]+)">.*') +match_location = re.compile('^<h3><a name="([A-Z]+)">.*') +match_sites = re.compile('^Site: <tt>([A-Za-z0-9-.\ \/_,]+)<\/tt>.*\n$') def add_sites(line, proto, sites, mirror_type): @@ -50,15 +51,15 @@ try: print "Downloading mirrors list from the Debian website..." uri=urllib2.urlopen(req) for line in uri.readlines(): - if line.startswith('<strong><a name="'): + if line.startswith('<h3><a name="'): location = match_location.sub(r"\1", line) if location: mirrors.append("#LOC:%s" % location) if line.startswith("Site:"): - sites = line[6:-1].split(",") - elif line.startswith('Packages over HTTP'): + sites = match_sites.sub(r"\1", line).split(",") + elif line.startswith('<br>Packages over HTTP'): add_sites(line, "http", sites, mirrors) - elif line.startswith('Packages over FTP'): + elif line.startswith('<br>Packages over FTP'): add_sites(line, "ftp", sites, mirrors) uri.close() except: |
