=== modified file './aptsources/sourceslist.py' --- ./aptsources/sourceslist.py 2012-06-12 07:30:56 +0000 +++ ./aptsources/sourceslist.py 2012-08-29 14:41:23 +0000 @@ -313,7 +313,7 @@ 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: === modified file './tests/test_aptsources.py' --- ./tests/test_aptsources.py 2011-10-19 15:40:03 +0000 +++ ./tests/test_aptsources.py 2012-08-29 14:41:47 +0000 @@ -233,6 +233,20 @@ for key in found: self.assertEqual(found[key], 1) + def test_enable_disabled(self): + """LP: #1042916: Test enabling a 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.disabled = True + 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__))