Merge lp:~brian-murray/ubuntu-release-upgrader/improve-upgrade-failure-messages into lp:ubuntu-release-upgrader

Proposed by Brian Murray on 2018-12-11
Status: Merged
Merged at revision: 3201
Proposed branch: lp:~brian-murray/ubuntu-release-upgrader/improve-upgrade-failure-messages
Merge into: lp:ubuntu-release-upgrader
Diff against target: 474 lines (+120/-30)
6 files modified
DistUpgrade/DistUpgradeCache.py (+19/-7)
DistUpgrade/DistUpgradeController.py (+25/-5)
DistUpgrade/DistUpgradeFetcherCore.py (+1/-1)
debian/changelog (+14/-2)
do-release-upgrade (+12/-0)
tests/test_sources_list.py (+49/-15)
To merge this branch: bzr merge lp:~brian-murray/ubuntu-release-upgrader/improve-upgrade-failure-messages
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team 2018-12-11 Pending
Review via email: mp+360636@code.launchpad.net
To post a comment you must log in.
3201. By Brian Murray on 2018-12-11

* DistUpgrade/DistUpgradeCache.py: in the event there is a failure to calculate the upgrade provide information about the log files in /var/log/dist-upgrade. (LP: #1771387)

3202. By Brian Murray on 2018-12-11

ppa-purge only works with Launchpad PPAs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified symlink 'DistUpgrade/DistUpgrade'
=== target changed u'.' => u'DistUpgrade'
=== modified file 'DistUpgrade/DistUpgradeCache.py'
--- DistUpgrade/DistUpgradeCache.py 2018-11-28 19:12:50 +0000
+++ DistUpgrade/DistUpgradeCache.py 2018-12-11 23:25:23 +0000
@@ -666,14 +666,23 @@
666 # rationale why it doesn't666 # rationale why it doesn't
667 lock.release()667 lock.release()
668 t.join()668 t.join()
669 # FIXME: change the text to something more useful669 # the most likely problem is the 3rd party pkgs so don't address
670 # foreignPkgs and devRelease being True
670 details = _("An unresolvable problem occurred while "671 details = _("An unresolvable problem occurred while "
671 "calculating the upgrade.\n\n "672 "calculating the upgrade.\n\n ")
672 "This can be caused by:\n"673 if self.config.get("Options", "foreignPkgs") == "True":
673 " * Upgrading to a pre-release version of Ubuntu\n"674 details += _("This was likely caused by:\n"
674 " * Running the current pre-release version of Ubuntu\n"675 " * Unofficial software packages not provided by Ubuntu\n"
675 " * Unofficial software packages not provided by Ubuntu\n"676 "Please use the tool 'ppa-purge' from the ppa-purge \n"
676 "\n")677 "package to remove software from a Launchpad PPA and \n"
678 "try the upgrade again.\n"
679 "\n")
680 elif self.config.get("Options", "foreignPkgs") == "False" and \
681 self.config.get("Options", "devRelease") == "True":
682 details += _("This was caused by:\n"
683 " * Upgrading to a pre-release version of Ubuntu\n"
684 "This is most likely a transient problem, \n"
685 "please try again later.\n")
677 # we never have partialUpgrades (including removes) on a stable system686 # we never have partialUpgrades (including removes) on a stable system
678 # with only ubuntu sources so we do not recommend reporting a bug687 # with only ubuntu sources so we do not recommend reporting a bug
679 if partialUpgrade:688 if partialUpgrade:
@@ -682,6 +691,9 @@
682 else:691 else:
683 details += _("If none of this applies, then please report this bug using "692 details += _("If none of this applies, then please report this bug using "
684 "the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.")693 "the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.")
694 details += _("If you want to investigate this yourself the log files in "
695 "'/var/log/dist-upgrade' will contain details about the upgrade. "
696 "Specifically, look at 'main.log' and 'apt.log'.")
685 # make the error text available again on stdout for the697 # make the error text available again on stdout for the
686 # text frontend698 # text frontend
687 self._stopAptResolverLog()699 self._stopAptResolverLog()
688700
=== modified file 'DistUpgrade/DistUpgradeController.py'
--- DistUpgrade/DistUpgradeController.py 2018-10-31 22:06:06 +0000
+++ DistUpgrade/DistUpgradeController.py 2018-12-11 23:25:23 +0000
@@ -131,6 +131,11 @@
131 # ConfigParser deals only with strings it seems *sigh*131 # ConfigParser deals only with strings it seems *sigh*
132 self.config.add_section("Options")132 self.config.add_section("Options")
133 self.config.set("Options","withNetwork", str(self.useNetwork))133 self.config.set("Options","withNetwork", str(self.useNetwork))
134 if self.options:
135 if self.options.devel_release:
136 self.config.set("Options","devRelease", "True")
137 else:
138 self.config.set("Options","devRelease", "False")
134139
135 # some constants here140 # some constants here
136 self.fromDist = self.config.get("Sources","From")141 self.fromDist = self.config.get("Sources","From")
@@ -535,6 +540,7 @@
535 distro.get_sources(self.sources)540 distro.get_sources(self.sources)
536 distro.enable_component("main")541 distro.enable_component("main")
537 main_was_missing = True542 main_was_missing = True
543 logging.debug('get_distro().enable_component("main") succeeded')
538 except NoDistroTemplateException as e:544 except NoDistroTemplateException as e:
539 logging.exception('NoDistroTemplateException raised: %s' % e)545 logging.exception('NoDistroTemplateException raised: %s' % e)
540 # fallback if everything else does not work,546 # fallback if everything else does not work,
@@ -680,8 +686,16 @@
680 foundToDist |= validTo686 foundToDist |= validTo
681 elif entry.dist in fromDists:687 elif entry.dist in fromDists:
682 foundToDist |= validTo688 foundToDist |= validTo
683 entry.dist = toDists[fromDists.index(entry.dist)]689 # check to see whether the archive provides the new dist
684 logging.debug("entry '%s' updated to new dist" % get_string_with_no_auth_from_source_entry(entry))690 test_entry = copy.copy(entry)
691 test_entry.dist = self.toDist
692 if not self._sourcesListEntryDownloadable(test_entry):
693 entry.disabled = True
694 self.sources_disabled = True
695 logging.debug("entry '%s' was disabled (no Release file)" % get_string_with_no_auth_from_source_entry(entry))
696 else:
697 entry.dist = toDists[fromDists.index(entry.dist)]
698 logging.debug("entry '%s' updated to new dist" % get_string_with_no_auth_from_source_entry(entry))
685 elif entry.type == 'deb-src':699 elif entry.type == 'deb-src':
686 continue700 continue
687 elif validMirror:701 elif validMirror:
@@ -933,6 +947,12 @@
933 # compare the list after the update again947 # compare the list after the update again
934 self.obsolete_pkgs = self.cache._getObsoletesPkgs()948 self.obsolete_pkgs = self.cache._getObsoletesPkgs()
935 self.foreign_pkgs = self.cache._getForeignPkgs(self.origin, self.fromDist, self.toDist)949 self.foreign_pkgs = self.cache._getForeignPkgs(self.origin, self.fromDist, self.toDist)
950 # If a PPA has already been disabled the pkgs won't be considered
951 # foreign
952 if len(self.foreign_pkgs) > 0:
953 self.config.set("Options","foreignPkgs", "True")
954 else:
955 self.config.set("Options","foreignPkgs", "False")
936 if self.serverMode:956 if self.serverMode:
937 self.tasks = self.cache.installedTasks957 self.tasks = self.cache.installedTasks
938 logging.debug("Foreign: %s" % " ".join(sorted(self.foreign_pkgs)))958 logging.debug("Foreign: %s" % " ".join(sorted(self.foreign_pkgs)))
@@ -1486,7 +1506,7 @@
1486 self._view.getTerminal().call([script], hidden=True)1506 self._view.getTerminal().call([script], hidden=True)
1487 except Exception as e:1507 except Exception as e:
1488 logging.error("got error from PostInstallScript %s (%s)" % (script, e))1508 logging.error("got error from PostInstallScript %s (%s)" % (script, e))
1489 1509
1490 def abort(self):1510 def abort(self):
1491 """ abort the upgrade, cleanup (as much as possible) """1511 """ abort the upgrade, cleanup (as much as possible) """
1492 logging.debug("abort called")1512 logging.debug("abort called")
@@ -1518,7 +1538,7 @@
1518 return True1538 return True
1519 logging.error("depends '%s' is not satisfied" % depstr)1539 logging.error("depends '%s' is not satisfied" % depstr)
1520 return False1540 return False
1521 1541
1522 def checkViewDepends(self):1542 def checkViewDepends(self):
1523 " check if depends are satisfied "1543 " check if depends are satisfied "
1524 logging.debug("checkViewDepends()")1544 logging.debug("checkViewDepends()")
@@ -1537,7 +1557,7 @@
1537 _("The required dependency '%s' is not "1557 _("The required dependency '%s' is not "
1538 "installed. " % dep))1558 "installed. " % dep))
1539 sys.exit(1)1559 sys.exit(1)
1540 return res 1560 return res
15411561
1542 def _verifyBackports(self):1562 def _verifyBackports(self):
1543 # run update (but ignore errors in case the countrymirror1563 # run update (but ignore errors in case the countrymirror
15441564
=== modified file 'DistUpgrade/DistUpgradeFetcherCore.py'
--- DistUpgrade/DistUpgradeFetcherCore.py 2016-11-29 16:36:37 +0000
+++ DistUpgrade/DistUpgradeFetcherCore.py 2018-12-11 23:25:23 +0000
@@ -220,7 +220,7 @@
220 def runDistUpgrader(self):220 def runDistUpgrader(self):
221 args = [self.script] + self.run_options221 args = [self.script] + self.run_options
222 if os.getuid() != 0:222 if os.getuid() != 0:
223 os.execv("/usr/bin/sudo", ["sudo"] + args)223 os.execv("/usr/bin/sudo", ["sudo", "-E"] + args)
224 else:224 else:
225 os.execv(self.script, args)225 os.execv(self.script, args)
226226
227227
=== modified file 'debian/changelog'
--- debian/changelog 2018-11-28 22:11:44 +0000
+++ debian/changelog 2018-12-11 23:25:23 +0000
@@ -1,10 +1,22 @@
1ubuntu-release-upgrader (1:19.04.7) UNRELEASED; urgency=medium1ubuntu-release-upgrader (1:19.04.7ubuntu1) UNRELEASED; urgency=medium
22
3 * DistUpgrade/DistUpgradeCache.py: When calculating free space needed for3 * DistUpgrade/DistUpgradeCache.py: When calculating free space needed for
4 mount points don't use a negative number as the buffer. (LP: #1786484)4 mount points don't use a negative number as the buffer. (LP: #1786484)
5 * fix more typos re RELEASE_UPRADER_ALLOW_THIRD_PARTY5 * fix more typos re RELEASE_UPRADER_ALLOW_THIRD_PARTY
6 * DistUpgrade/DistUpgradeController.py: When rewriting sources.list entries
7 check to see if the source provides packages for the release to which the
8 upgrade is occurring. If it doesn't the entry is disabled thereby
9 improving upgrades with PPAs. (LP: #1807043)
10 * do-release-upgrade: add a parameter to allow third party mirrors and
11 repositories, additionally pass along the environmental variable
12 RELEASE_UPGRADER_ALLOW_THIRD_PARTY via pkexec and sudo. (LP: #1807032)
13 * DistUpgrade/DistUpgradeCache.py: improve messaging regarding failures to
14 calculate the upgrade and suggest using ppa-purge if PPAs are an issue.
15 * DistUpgrade/DistUpgradeCache.py: in the event there is a failure to
16 calculate the upgrade provide information about the log files in
17 /var/log/dist-upgrade. (LP: #1771387)
618
7 -- Brian Murray <brian@ubuntu.com> Wed, 28 Nov 2018 14:11:10 -080019 -- Brian Murray <brian@ubuntu.com> Tue, 11 Dec 2018 15:12:19 -0800
820
9ubuntu-release-upgrader (1:19.04.6) disco; urgency=medium21ubuntu-release-upgrader (1:19.04.6) disco; urgency=medium
1022
1123
=== modified file 'do-release-upgrade'
--- do-release-upgrade 2018-11-28 18:02:37 +0000
+++ do-release-upgrade 2018-12-11 23:25:23 +0000
@@ -103,6 +103,11 @@
103 help=_("Check only if a new distribution release is "103 help=_("Check only if a new distribution release is "
104 "available and report the result via the "104 "available and report the result via the "
105 "exit code"))105 "exit code"))
106 parser.add_option ("--allow-third-party", default=False,
107 action="store_true", dest="allow_third_party",
108 help=_("Try the upgrade with third party "
109 "mirrors and repositories enabled "
110 "instead of commenting them out."))
106 parser.add_option ("-q", "--quiet", default=False, action="store_true",111 parser.add_option ("-q", "--quiet", default=False, action="store_true",
107 dest="quiet")112 dest="quiet")
108113
@@ -195,12 +200,19 @@
195 "requires a reboot. Please reboot before upgrading."))200 "requires a reboot. Please reboot before upgrading."))
196 sys.exit(1)201 sys.exit(1)
197202
203 if options.allow_third_party:
204 # the env variable is used by code in the dist-upgrader tarball
205 os.environ["RELEASE_UPGRADER_ALLOW_THIRD_PARTY"] = "True"
206
198 # GTK 3 fetcher starts setting up the the GUI and KDE GUI needs to start GUI207 # GTK 3 fetcher starts setting up the the GUI and KDE GUI needs to start GUI
199 # later, too.208 # later, too.
200 if (options.frontend in {"DistUpgradeViewGtk3", "DistUpgradeViewKDE"} and209 if (options.frontend in {"DistUpgradeViewGtk3", "DistUpgradeViewKDE"} and
201 os.getuid() != 0):210 os.getuid() != 0):
202 if 'WAYLAND_DISPLAY' in os.environ:211 if 'WAYLAND_DISPLAY' in os.environ:
203 subprocess.run(['xhost', '+si:localuser:root'])212 subprocess.run(['xhost', '+si:localuser:root'])
213 # this is needed because pkexec doesn't pass on the env
214 if 'RELEASE_UPGRADER_ALLOW_THIRD_PARTY' in os.environ:
215 sys.argv.append('--allow-third-party')
204 os.execv("/usr/bin/pkexec", ["pkexec"] + sys.argv)216 os.execv("/usr/bin/pkexec", ["pkexec"] + sys.argv)
205217
206 fetcher = get_fetcher(options.frontend, m.new_dist, options.data_dir)218 fetcher = get_fetcher(options.frontend, m.new_dist, options.data_dir)
207219
=== modified file 'tests/test_sources_list.py'
--- tests/test_sources_list.py 2018-11-28 22:11:44 +0000
+++ tests/test_sources_list.py 2018-12-11 23:25:23 +0000
@@ -92,8 +92,9 @@
92deb http://security.ubuntu.com/ubuntu/ gutsy-security main restricted92deb http://security.ubuntu.com/ubuntu/ gutsy-security main restricted
93""")93""")
9494
95 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
95 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")96 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")
96 def test_sources_list_rewrite(self, mock_get_distro):97 def test_sources_list_rewrite(self, mock_get_distro, mock_sourcesListEntryDownloadable):
97 """98 """
98 test regular sources.list rewrite99 test regular sources.list rewrite
99 """100 """
@@ -107,8 +108,10 @@
107 "Ubuntu Feisty Fawn",108 "Ubuntu Feisty Fawn",
108 "7.04")109 "7.04")
109 d.openCache(lock=False)110 d.openCache(lock=False)
111 mock_sourcesListEntryDownloadable.return_value = True
110 res = d.updateSourcesList()112 res = d.updateSourcesList()
111 self.assertTrue(mock_get_distro.called)113 self.assertTrue(mock_get_distro.called)
114 self.assertTrue(mock_sourcesListEntryDownloadable.called)
112 self.assertTrue(res)115 self.assertTrue(res)
113116
114 # now test the result117 # now test the result
@@ -127,7 +130,7 @@
127 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".in",130 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".in",
128 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".distUpgrade"131 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".distUpgrade"
129 ]))132 ]))
130 133
131 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController.abort")134 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController.abort")
132 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")135 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")
133 def test_double_check_source_distribution_reject(self, mock_abort, mock_get_distro):136 def test_double_check_source_distribution_reject(self, mock_abort, mock_get_distro):
@@ -145,10 +148,10 @@
145 mock_get_distro.return_value = UbuntuDistribution("Ubuntu", "feisty",148 mock_get_distro.return_value = UbuntuDistribution("Ubuntu", "feisty",
146 "Ubuntu Feisty Fawn",149 "Ubuntu Feisty Fawn",
147 "7.04")150 "7.04")
148 151
149 class AbortException(Exception):152 class AbortException(Exception):
150 """Exception"""153 """Exception"""
151 154
152 mock_abort.side_effect = AbortException155 mock_abort.side_effect = AbortException
153 d.openCache(lock=False)156 d.openCache(lock=False)
154 with self.assertRaises(AbortException):157 with self.assertRaises(AbortException):
@@ -157,8 +160,9 @@
157 self.assertTrue(mock_get_distro.called)160 self.assertTrue(mock_get_distro.called)
158 self.assertTrue(v.askYesNoQuestion.called)161 self.assertTrue(v.askYesNoQuestion.called)
159162
163 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
160 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")164 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")
161 def test_double_check_source_distribution_continue(self, mock_get_distro):165 def test_double_check_source_distribution_continue(self, mock_get_distro, mock_sourcesListEntryDownloadable):
162 """166 """
163 test that an upgrade from feisty with a sources.list containing167 test that an upgrade from feisty with a sources.list containing
164 hardy asks a question, and if continued, does something.168 hardy asks a question, and if continued, does something.
@@ -174,13 +178,15 @@
174 "Ubuntu Feisty Fawn",178 "Ubuntu Feisty Fawn",
175 "7.04")179 "7.04")
176 d.openCache(lock=False)180 d.openCache(lock=False)
181 mock_sourcesListEntryDownloadable.return_value = True
177 res = d.updateSourcesList()182 res = d.updateSourcesList()
178 self.assertTrue(mock_get_distro.called)183 self.assertTrue(mock_get_distro.called)
184 self.assertTrue(mock_sourcesListEntryDownloadable.called)
179 self.assertTrue(res)185 self.assertTrue(res)
180186
181 # now test the result187 # now test the result
182 #print(open(os.path.join(self.testdir,"sources.list")).read())188 #print(open(os.path.join(self.testdir,"sources.list")).read())
183 189
184 # The result here is not really all that helpful, hence we190 # The result here is not really all that helpful, hence we
185 # added the question in the first place. But still better to191 # added the question in the first place. But still better to
186 # check what it does than to not check it.192 # check what it does than to not check it.
@@ -195,6 +201,7 @@
195# deb http://security.ubuntu.com/ubuntu/ hardy-security universe201# deb http://security.ubuntu.com/ubuntu/ hardy-security universe
196202
197deb http://archive.ubuntu.com/ubuntu/ gutsy main203deb http://archive.ubuntu.com/ubuntu/ gutsy main
204
198""")205""")
199 # check that the backup file was created correctly206 # check that the backup file was created correctly
200 self.assertEqual(0, subprocess.call(207 self.assertEqual(0, subprocess.call(
@@ -203,8 +210,9 @@
203 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".distUpgrade"210 apt_pkg.config.find_file("Dir::Etc::sourcelist") + ".distUpgrade"
204 ]))211 ]))
205212
213 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
206 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")214 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")
207 def test_sources_list_inactive_mirror(self, mock_get_distro):215 def test_sources_list_inactive_mirror(self, mock_get_distro, mock_sourcesListEntryDownloadable):
208 """216 """
209 test sources.list rewrite of an obsolete mirror217 test sources.list rewrite of an obsolete mirror
210 """218 """
@@ -218,8 +226,10 @@
218 "Ubuntu Feisty Fawn",226 "Ubuntu Feisty Fawn",
219 "7.04")227 "7.04")
220 d.openCache(lock=False)228 d.openCache(lock=False)
229 mock_sourcesListEntryDownloadable.return_value = True
221 res = d.updateSourcesList()230 res = d.updateSourcesList()
222 self.assertTrue(mock_get_distro.called)231 self.assertTrue(mock_get_distro.called)
232 self.assertTrue(mock_sourcesListEntryDownloadable.called)
223 self.assertTrue(res)233 self.assertTrue(res)
224234
225 # now test the result235 # now test the result
@@ -311,8 +321,9 @@
311deb http://archive.canonical.com/ubuntu gutsy partner321deb http://archive.canonical.com/ubuntu gutsy partner
312""")322""")
313323
324 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
314 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")325 @mock.patch("DistUpgrade.DistUpgradeController.get_distro")
315 def test_extras_removal(self, mock_get_distro):326 def test_extras_removal(self, mock_get_distro, mock_sourcesListEntryDownloadable):
316 """327 """
317 test removal of extras.ubuntu.com archives328 test removal of extras.ubuntu.com archives
318 """329 """
@@ -328,7 +339,9 @@
328 "Ubuntu Feisty Fawn",339 "Ubuntu Feisty Fawn",
329 "7.04")340 "7.04")
330 d.openCache(lock=False)341 d.openCache(lock=False)
342 mock_sourcesListEntryDownloadable.return_value = True
331 res = d.updateSourcesList()343 res = d.updateSourcesList()
344 self.assertTrue(mock_sourcesListEntryDownloadable.called)
332 self.assertTrue(res)345 self.assertTrue(res)
333346
334 sources_file = apt_pkg.config.find_file("Dir::Etc::sourcelist")347 sources_file = apt_pkg.config.find_file("Dir::Etc::sourcelist")
@@ -338,7 +351,8 @@
338351
339""")352""")
340353
341 def test_powerpc_transition(self):354 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
355 def test_powerpc_transition(self, mock_sourcesListEntryDownloadable):
342 """356 """
343 test transition of powerpc to ports.ubuntu.com357 test transition of powerpc to ports.ubuntu.com
344 """358 """
@@ -351,7 +365,9 @@
351 v = DistUpgradeViewNonInteractive()365 v = DistUpgradeViewNonInteractive()
352 d = DistUpgradeController(v, datadir=self.testdir)366 d = DistUpgradeController(v, datadir=self.testdir)
353 d.openCache(lock=False)367 d.openCache(lock=False)
368 mock_sourcesListEntryDownloadable.return_value = True
354 res = d.updateSourcesList()369 res = d.updateSourcesList()
370 self.assertTrue(mock_sourcesListEntryDownloadable.called)
355 self.assertTrue(res)371 self.assertTrue(res)
356 # now test the result372 # now test the result
357 self._verifySources("""373 self._verifySources("""
@@ -362,7 +378,8 @@
362""")378""")
363 apt_pkg.config.set("APT::Architecture", arch)379 apt_pkg.config.set("APT::Architecture", arch)
364380
365 def test_sparc_transition(self):381 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
382 def test_sparc_transition(self, mock_sourcesListEntryDownloadable):
366 """383 """
367 test transition of sparc to ports.ubuntu.com384 test transition of sparc to ports.ubuntu.com
368 """385 """
@@ -377,7 +394,9 @@
377 d.fromDist = "gutsy"394 d.fromDist = "gutsy"
378 d.toDist = "hardy"395 d.toDist = "hardy"
379 d.openCache(lock=False)396 d.openCache(lock=False)
397 mock_sourcesListEntryDownloadable.return_value = True
380 res = d.updateSourcesList()398 res = d.updateSourcesList()
399 self.assertTrue(mock_sourcesListEntryDownloadable.called)
381 self.assertTrue(res)400 self.assertTrue(res)
382 # now test the result401 # now test the result
383 self._verifySources("""402 self._verifySources("""
@@ -480,7 +499,8 @@
480deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse499deb http://archive.ubuntu.com/ubuntu precise-security main restricted universe multiverse
481""")500""")
482501
483 def test_partner_update(self):502 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
503 def test_partner_update(self, mock_sourcesListEntryDownloadable):
484 """504 """
485 test transition partner repository updates505 test transition partner repository updates
486 """506 """
@@ -491,7 +511,9 @@
491 v = DistUpgradeViewNonInteractive()511 v = DistUpgradeViewNonInteractive()
492 d = DistUpgradeController(v, datadir=self.testdir)512 d = DistUpgradeController(v, datadir=self.testdir)
493 d.openCache(lock=False)513 d.openCache(lock=False)
514 mock_sourcesListEntryDownloadable.return_value = True
494 res = d.updateSourcesList()515 res = d.updateSourcesList()
516 self.assertTrue(mock_sourcesListEntryDownloadable.called)
495 self.assertTrue(res)517 self.assertTrue(res)
496518
497 # now test the result519 # now test the result
@@ -504,7 +526,8 @@
504deb http://archive.canonical.com/ubuntu gutsy partner526deb http://archive.canonical.com/ubuntu gutsy partner
505""")527""")
506528
507 def test_private_ppa_transition(self):529 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
530 def test_private_ppa_transition(self, mock_sourcesListEntryDownloadable):
508 if "RELEASE_UPGRADER_ALLOW_THIRD_PARTY" in os.environ:531 if "RELEASE_UPGRADER_ALLOW_THIRD_PARTY" in os.environ:
509 del os.environ["RELEASE_UPGRADER_ALLOW_THIRD_PARTY"]532 del os.environ["RELEASE_UPGRADER_ALLOW_THIRD_PARTY"]
510 shutil.copy(533 shutil.copy(
@@ -516,7 +539,9 @@
516 v = DistUpgradeViewNonInteractive()539 v = DistUpgradeViewNonInteractive()
517 d = DistUpgradeController(v, datadir=self.testdir)540 d = DistUpgradeController(v, datadir=self.testdir)
518 d.openCache(lock=False)541 d.openCache(lock=False)
542 mock_sourcesListEntryDownloadable.return_value = True
519 res = d.updateSourcesList()543 res = d.updateSourcesList()
544 self.assertTrue(mock_sourcesListEntryDownloadable.called)
520 self.assertTrue(res)545 self.assertTrue(res)
521546
522 # now test the result547 # now test the result
@@ -533,7 +558,8 @@
533deb https://user:pass@private-ppa.launchpad.net/commercial-ppa-uploaders gutsy main558deb https://user:pass@private-ppa.launchpad.net/commercial-ppa-uploaders gutsy main
534""")559""")
535560
536 def test_apt_cacher_and_apt_bittorent(self):561 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
562 def test_apt_cacher_and_apt_bittorent(self, mock_sourcesListEntryDownloadable):
537 """563 """
538 test transition of apt-cacher/apt-torrent uris564 test transition of apt-cacher/apt-torrent uris
539 """565 """
@@ -544,7 +570,9 @@
544 v = DistUpgradeViewNonInteractive()570 v = DistUpgradeViewNonInteractive()
545 d = DistUpgradeController(v, datadir=self.testdir)571 d = DistUpgradeController(v, datadir=self.testdir)
546 d.openCache(lock=False)572 d.openCache(lock=False)
573 mock_sourcesListEntryDownloadable.return_value = True
547 res = d.updateSourcesList()574 res = d.updateSourcesList()
575 self.assertTrue(mock_sourcesListEntryDownloadable.called)
548 self.assertTrue(res)576 self.assertTrue(res)
549577
550 # now test the result578 # now test the result
@@ -593,7 +621,8 @@
593# deb http://ppa.launchpad.net/random-ppa quantal main # ppa of Víctor R. Ruiz (vrruiz) disabled on upgrade to gutsy621# deb http://ppa.launchpad.net/random-ppa quantal main # ppa of Víctor R. Ruiz (vrruiz) disabled on upgrade to gutsy
594""")622""")
595623
596 def test_local_mirror(self):624 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
625 def test_local_mirror(self, mock_sourcesListEntryDownloadable):
597 """626 """
598 test that a local mirror with official -backports works (LP:# 1067393)627 test that a local mirror with official -backports works (LP:# 1067393)
599 """628 """
@@ -603,7 +632,9 @@
603 v = DistUpgradeViewNonInteractive()632 v = DistUpgradeViewNonInteractive()
604 d = DistUpgradeController(v, datadir=self.testdir)633 d = DistUpgradeController(v, datadir=self.testdir)
605 d.openCache(lock=False)634 d.openCache(lock=False)
635 mock_sourcesListEntryDownloadable.return_value = True
606 res = d.updateSourcesList()636 res = d.updateSourcesList()
637 self.assertTrue(mock_sourcesListEntryDownloadable.called)
607 self.assertTrue(res)638 self.assertTrue(res)
608639
609 # verify it640 # verify it
@@ -614,7 +645,8 @@
614deb http://archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse645deb http://archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse
615""")646""")
616647
617 def test_disable_proposed(self):648 @mock.patch("DistUpgrade.DistUpgradeController.DistUpgradeController._sourcesListEntryDownloadable")
649 def test_disable_proposed(self, mock_sourcesListEntryDownloadable):
618 """650 """
619 Test that proposed is disabled when upgrading to a development651 Test that proposed is disabled when upgrading to a development
620 release.652 release.
@@ -628,7 +660,9 @@
628 options.devel_release = True660 options.devel_release = True
629 d = DistUpgradeController(v, options, datadir=self.testdir)661 d = DistUpgradeController(v, options, datadir=self.testdir)
630 d.openCache(lock=False)662 d.openCache(lock=False)
663 mock_sourcesListEntryDownloadable.return_value = True
631 res = d.updateSourcesList()664 res = d.updateSourcesList()
665 self.assertTrue(mock_sourcesListEntryDownloadable.called)
632 self.assertTrue(res)666 self.assertTrue(res)
633667
634 self._verifySources("""668 self._verifySources("""

Subscribers

People subscribed via source and target branches