summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-09-03 10:43:02 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2012-09-03 10:43:02 +0200
commitdc65d59dc294bafcd93dbadd848152736ddc11c5 (patch)
treed6745a3a7002e447598f144d85b5537b0deaa02a
parent81b72b5d1cf9ddb93f3f92af40b00dfff56174e7 (diff)
parent58ec5e4ea6c4e07a62611d0b588638688c42899b (diff)
downloadpython-apt-dc65d59dc294bafcd93dbadd848152736ddc11c5.tar.gz
merged lp:~sampo555/python-apt/fix_1042916
-rw-r--r--aptsources/sourceslist.py2
-rw-r--r--debian/changelog5
-rw-r--r--tests/test_aptsources.py14
3 files changed, 20 insertions, 1 deletions
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py
index 61b75f75..40902d84 100644
--- a/aptsources/sourceslist.py
+++ b/aptsources/sourceslist.py
@@ -313,7 +313,7 @@ class SourcesList(object):
for source in sources:
# if there is a repo with the same (type, uri, dist) just add the
# components
- if source.disabled and set(source.comps) == comps:
+ if source.disabled and set(source.comps) == set(comps):
source.disabled = False
return source
elif not source.disabled:
diff --git a/debian/changelog b/debian/changelog
index 0d0fd019..1bce9b1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,11 @@ python-apt (0.8.8) UNRELEASED; urgency=low
[ Program translation updates ]
* po/pl.po: Polish (Michał Kułach) (closes: #684308)
+
+ [ Michael Vogt ]
+ * merged lp:~sampo555/python-apt/fix_1042916 reuse existing but
+ disabled sources.list entries instead of duplicating them.
+ Thanks to "sampo555", LP: #1042916
-- David Prévot <taffit@debian.org> Wed, 08 Aug 2012 12:05:52 -0400
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index dcfb0682..41cfabb3 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -233,6 +233,20 @@ class TestAptSources(unittest.TestCase):
for key in found:
self.assertEqual(found[key], 1)
+ def test_enable_disabled(self):
+ """LP: #1042916: Test enabling disabled entry."""
+ apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"
+ "sources.list")
+ sources = aptsources.sourceslist.SourcesList(True, self.templates)
+ disabled = sources.add("deb", "http://fi.archive.ubuntu.com/ubuntu/",
+ "precise",
+ ["main"])
+ disabled.set_enabled(False)
+ enabled = sources.add("deb", "http://fi.archive.ubuntu.com/ubuntu/",
+ "precise",
+ ["main"])
+ self.assertEqual(disabled, enabled)
+ self.assertFalse(disabled.disabled)
if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))