diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-03-03 16:44:10 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-03-03 16:44:10 +0100 |
| commit | 1dcd5eb6190ed6a3552cb2d491bc0272f60e613a (patch) | |
| tree | e21fa68b89ff9ad28c222abf2edcbc346feccb56 | |
| parent | 8cb1f8fb9968d91f8f1bbece3f93aaeda36f0801 (diff) | |
| download | python-apt-1dcd5eb6190ed6a3552cb2d491bc0272f60e613a.tar.gz | |
* Merge with Ubuntu:
- util/get_ubuntu_mirrors_from_lp.py:
+ rewritten to use +archivemirrors-rss and feedburner
- pre-build.sh: update ubuntu mirrors on bzr-buildpackage (and also do this
for Debian mirrors)
- add break for packagekit-backend-apt (<= 0.4.8-0ubuntu4)
| -rw-r--r-- | .bzr-builddeb/default.conf | 3 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | debian/control | 2 | ||||
| -rwxr-xr-x | pre-build.sh | 11 | ||||
| -rwxr-xr-x | utils/get_ubuntu_mirrors_from_lp.py | 72 |
5 files changed, 35 insertions, 59 deletions
diff --git a/.bzr-builddeb/default.conf b/.bzr-builddeb/default.conf index 3a08d607..c39d2e3d 100644 --- a/.bzr-builddeb/default.conf +++ b/.bzr-builddeb/default.conf @@ -1,2 +1,5 @@ [BUILDDEB] native = True + +[HOOKS] +pre-build = ./pre-build.sh diff --git a/debian/changelog b/debian/changelog index 79b3d810..0aab0c2a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,12 @@ python-apt (0.7.93.4) unstable; urgency=low * apt/progress/old.py: - Let the new method call the old one; e.g. status_update() now calls self.statusUpdate(). This improves compatibility for sub classes. + * Merge with Ubuntu: + - util/get_ubuntu_mirrors_from_lp.py: + + rewritten to use +archivemirrors-rss and feedburner + - pre-build.sh: update ubuntu mirrors on bzr-buildpackage (and also do this + for Debian mirrors) + - add break for packagekit-backend-apt (<= 0.4.8-0ubuntu4) -- Julian Andres Klode <jak@debian.org> Mon, 01 Mar 2010 16:13:22 +0100 diff --git a/debian/control b/debian/control index 0c43f91e..4db6c164 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,7 @@ Package: python-apt Architecture: any Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends} Recommends: lsb-release, iso-codes, libjs-jquery -Breaks: debdelta (<< 0.28~) +Breaks: debdelta (<< 0.28~), packagekit-backend-apt (<= 0.4.8-0ubuntu4) Provides: ${python:Provides} Suggests: python-apt-dbg, python-gtk2, python-vte XB-Python-Version: ${python:Versions} diff --git a/pre-build.sh b/pre-build.sh new file mode 100755 index 00000000..6d019603 --- /dev/null +++ b/pre-build.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "updating Ubuntu mirror list from launchpad" +if [ -n "$https_proxy" ]; then + echo "disabling https_proxy as Python's urllib doesn't support it; see #94130" + unset https_proxy +fi +utils/get_ubuntu_mirrors_from_lp.py > data/templates/Ubuntu.mirrors + +echo "updating Debian mirror list" +( cd utils; ./get_debian_mirrors.py; ) diff --git a/utils/get_ubuntu_mirrors_from_lp.py b/utils/get_ubuntu_mirrors_from_lp.py index b912f28d..3c183b6d 100755 --- a/utils/get_ubuntu_mirrors_from_lp.py +++ b/utils/get_ubuntu_mirrors_from_lp.py @@ -24,68 +24,24 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA -import urllib2 -import re +import feedparser import sys -# the list of official Ubuntu servers -mirrors = [] -# path to the local mirror list -list_path = "../data/templates/Ubuntu.mirrors" - - -try: - f = open("/usr/share/iso-codes/iso_3166.tab", "r") - lines = f.readlines() - f.close() -except: - print "Could not read country information" - sys.exit(1) +d = feedparser.parse("https://launchpad.net/ubuntu/+archivemirrors-rss") +#d = feedparser.parse(open("+archivemirrors-rss")) countries = {} -for line in lines: - parts = line.split("\t") - countries[parts[1].strip()] = parts[0].lower() - -req = urllib2.Request("https://launchpad.net/ubuntu/+archivemirrors") -print "Downloading mirrors list from Launchpad..." -try: - uri=urllib2.urlopen(req) - content = uri.read() - uri.close() -except: - print "Failed to download or extract the mirrors list!" - sys.exit(1) - -content = content.replace("\n", "") - -content_splits = re.split(r'<tr class="highlighted"', - re.findall(r'<table class="listing" ' - 'id="mirrors_list">.+?</table>', - content)[0]) -lines=[] - - -def find(split): - country = re.search(r"<strong>(.+?)</strong>", split) - if not country: - return - if country.group(1) in countries: - lines.append("#LOC:%s" % countries[country.group(1)].upper()) - else: - lines.append("#LOC:%s" % country.group(1)) - # FIXME: currently the protocols are hardcoded: ftp http - urls = re.findall(r'<a href="(?![a-zA-Z:/_\-]+launchpad.+?">)' - '(((http)|(ftp)).+?)">', - split) - map(lambda u: lines.append(u[0]), urls) +for entry in d.entries: + countrycode = entry.mirror_countrycode + if not countrycode in countries: + countries[countrycode] = set() + for link in entry.links: + countries[countrycode].add(link.href) -map(find, content_splits) -print "Writing local mirrors list: %s" % list_path -list = open(list_path, "w") -for line in lines: - list.write("%s\n" % line) -list.close() -print "Done." +keys = countries.keys() +keys.sort() +for country in keys: + print "#LOC:%s" % country + print "\n".join(countries[country]) |
