summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aptsources/distinfo.py2
-rw-r--r--aptsources/distro.py25
-rw-r--r--debian/changelog5
3 files changed, 20 insertions, 12 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py
index a6c0faf8..f4e804b2 100644
--- a/aptsources/distinfo.py
+++ b/aptsources/distinfo.py
@@ -132,7 +132,7 @@ class DistInfo:
location = None
match_loc = re.compile(r"^#LOC:(.+)$")
- match_mirror_line = re.compile(r"^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(https))://[A-Za-z/\.:\-_]+)$")
+ match_mirror_line = re.compile(r"^(#LOC:.+)|(((http)|(ftp)|(rsync)|(file)|(https))://[A-Za-z0-9/\.:\-_]+)$")
#match_mirror_line = re.compile(r".+")
if not dist:
diff --git a/aptsources/distro.py b/aptsources/distro.py
index f271bbc4..0a094aed 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -211,31 +211,34 @@ class Distribution:
(len(self.used_servers) == 1 and \
compare_mirrors(self.used_servers[0], self.main_server)):
mirrors.append([_("Main server"), self.main_server, True])
- mirrors.append([self._get_mirror_name(self.nearest_server),
- self.nearest_server, False])
+ if self.nearest_server:
+ mirrors.append([self._get_mirror_name(self.nearest_server),
+ self.nearest_server, False])
elif len(self.used_servers) == 1 and not \
compare_mirrors(self.used_servers[0], self.main_server):
mirrors.append([_("Main server"), self.main_server, False])
# Only one server is used
server = self.used_servers[0]
-
# Append the nearest server if it's not already used
- if not compare_mirrors(server, self.nearest_server):
- mirrors.append([self._get_mirror_name(self.nearest_server),
- self.nearest_server, False])
- mirrors.append([self._get_mirror_name(server), server, True])
+ if self.nearest_server:
+ if not compare_mirrors(server, self.nearest_server):
+ mirrors.append([self._get_mirror_name(self.nearest_server),
+ self.nearest_server, False])
+ if server:
+ mirrors.append([self._get_mirror_name(server), server, True])
elif len(self.used_servers) > 1:
# More than one server is used. Since we don't handle this case
# in the user interface we set "custom servers" to true and
# append a list of all used servers
mirrors.append([_("Main server"), self.main_server, False])
- mirrors.append([self._get_mirror_name(self.nearest_server),
- self.nearest_server, False])
+ if self.nearest_server:
+ mirrors.append([self._get_mirror_name(self.nearest_server),
+ self.nearest_server, False])
mirrors.append([_("Custom servers"), None, True])
for server in self.used_servers:
- if compare_mirrors(server, self.nearest_server) or\
- compare_mirrors(server, self.main_server):
+ if (compare_mirrors(server, self.nearest_server) or
+ compare_mirrors(server, self.main_server)):
continue
elif not [self._get_mirror_name(server), server, False] in mirrors:
mirrors.append([self._get_mirror_name(server), server, False])
diff --git a/debian/changelog b/debian/changelog
index 8b6780f5..042785d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,11 @@ python-apt (0.7.9) UNRELEASED; urgency=low
* setup.py:
- build html/ help of the apt and aptsources modules
into /usr/share/doc/python-apt/html
+ * aptsources/distinfo.py:
+ - fix too restrictive mirror url check
+ * aptsources/distro.py:
+ - only add nearest_server and server to the mirrors if
+ they are defined
-- Michael Vogt <michael.vogt@ubuntu.com> Mon, 24 Nov 2008 14:30:32 +0100