diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-07 10:24:58 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-07 10:24:58 +0200 |
| commit | 34256b339ea1b953bbf57e8b6975023dfce05c73 (patch) | |
| tree | ad21b89d009db54eb478e1e883f86b8a03dbd361 /UpdateManager | |
| parent | d754e704d6e42bff9f1f8485e134fd4d04cb3a24 (diff) | |
| parent | 3afcdfc4f30173672b5745f69e2bc401f20e1d90 (diff) | |
| download | python-apt-34256b339ea1b953bbf57e8b6975023dfce05c73.tar.gz | |
* merged with glatzor
Diffstat (limited to 'UpdateManager')
| -rw-r--r-- | UpdateManager/Common/aptsources.py | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/UpdateManager/Common/aptsources.py b/UpdateManager/Common/aptsources.py index 8963fd15..09673376 100644 --- a/UpdateManager/Common/aptsources.py +++ b/UpdateManager/Common/aptsources.py @@ -1,10 +1,12 @@ # aptsource.py.in - parse sources.list # -# Copyright (c) 2004,2005 Canonical +# Copyright (c) 2004-2006 Canonical # 2004 Michiel Sikkes +# 2006 Sebastian Heinlein # # Author: Michiel Sikkes <michiel@eyesopened.nl> # Michael Vogt <mvo@debian.org> +# Sebastian Heinlein # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -29,6 +31,7 @@ import glob import shutil import time import os.path +import sys #import pdb @@ -641,13 +644,27 @@ class Distribution: sourceslist: an aptsource.sources_list comp: the component that should be enabled """ - # FIXME: we can't just unconditionally add stuff to each line, - # otherwise we need up with multiple components for the - # same repository (see tests/test_aptsources.py for details) + def add_component_only_once(source, workpile): + """ + Check if we already added the component to the repository, since + a repository could be splitted into different apt lines. If not + add the component + """ + if not (workpile.has_key(source.uri) and\ + source.dist in workpile[source.uri]): + if comp not in source.comps: + source.comps.append(comp) + if workpile.has_key(source.uri): + workpile[source.uri].append(source.dist) + else: + workpile[source.uri] = [source.dist] + sources = [] sources.extend(self.main_sources) sources.extend(self.child_sources) sources.extend(self.source_code_sources) + # store repos to which the new component has been added + workpile = {} # check if there is a main source at all if len(self.main_sources) < 1: # create a new main source @@ -655,11 +672,13 @@ class Distribution: else: # add the comp to all main, child and source code sources for source in sources: - if comp not in source.comps: - source.comps.append(comp) + add_component_only_once(source, workpile) + if self.get_source_code == True: for source in self.source_code_sources: - if comp not in source.comps: source.comps.append(comp) + if comp not in source.comps: + add_component_only_once(source, workpile) + def disable_component(self, sourceslist, comp): """ |
