From a2fe2a40f43d5c95cb849f8f0306ed25dcde2298 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 5 Dec 2005 15:30:48 +0100 Subject: * detect security.u.c as well --- DistUpgrade/DistUpgrade.py | 34 ++++++++++++++++++++++++---------- SoftwareProperties/aptsources.py | 5 ----- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/DistUpgrade/DistUpgrade.py b/DistUpgrade/DistUpgrade.py index 3241699a..6ad28388 100644 --- a/DistUpgrade/DistUpgrade.py +++ b/DistUpgrade/DistUpgrade.py @@ -54,25 +54,39 @@ class DistUpgradeControler(object): sources = SourcesList() sources.backup() + # this must map, i.e. second in "from" must be the second in "to" + # (but they can be different, so in theory we could exchange + # component names here) fromDists = [fromDist, fromDist+"-security", fromDist+"-updates", fromDist+"-backports" ] + toDists = [to, + to+"-security", + to+"-updates", + to+"-backports" + ] + + # list of valid mirrors that we can add + valid_mirrors = ["http://archive.ubuntu.com/ubuntu", + "http://security.ubuntu.com/ubuntu"] for entry in sources: # check if it's a mirror (or offical site) - if sources.is_mirror("http://archive.ubuntu.com/ubuntu",entry.uri): - if entry.dist in fromDists: - entry.dist = to + for mirror in valid_mirrors: + if sources.is_mirror(mirror,entry.uri): + if entry.dist in fromDists: + entry.dist = toDists[fromDists.index(entry.dist)] + else: + # disable all entries that are official but don't + # point to the "from" dist + entry.disabled = True else: - # disable all entries that are official but don't - # point to the "from" dist - entry.disabled = True - else: - # disable non-official entries that point to dist - if entry.dist == fromDist: - entry.disabled = True + # disable non-official entries that point to dist + if entry.dist == fromDist: + entry.disabled = True + # write! sources.save() def breezyUpgrade(self): diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py index 1c8273f2..b32b222e 100644 --- a/SoftwareProperties/aptsources.py +++ b/SoftwareProperties/aptsources.py @@ -131,11 +131,6 @@ class SourceEntry: # disabled, add a "#" if string.strip(self.line)[0] != "#": self.line = "#" + self.line - def get_disabled(self): - return not self.disabled - def set_disabled(self, new_value): - return self.set_enbaled(not new_value) - disabled = property(get_disabled, set_disabled) def str(self): """ return the current line as string """ -- cgit v1.2.3