=== modified file 'UpdateManager/Core/MetaRelease.py' --- UpdateManager/Core/MetaRelease.py 2018-03-15 10:22:01 +0000 +++ UpdateManager/Core/MetaRelease.py 2018-08-30 08:12:18 +0000 @@ -24,6 +24,7 @@ import apt import apt_pkg +import distro_info try: import configparser except ImportError: @@ -143,14 +144,21 @@ return # now check which specific url to use if parser.has_option("DEFAULT", "Prompt"): - type = parser.get("DEFAULT", "Prompt").lower() - if (type == "never" or type == "no"): + prompt = parser.get("DEFAULT", "Prompt").lower() + if (prompt == "never" or prompt == "no"): # nothing to do for this object # FIXME: what about no longer supported? self.downloaded.set() return - elif type == "lts": - self.METARELEASE_URI = self.METARELEASE_URI_LTS + elif prompt == "lts": + # the Prompt=lts setting only makes sense when running on + # a LTS, otherwise it would result in users not receiving + # any distro upgrades + di = distro_info.UbuntuDistroInfo() + if di.is_lts(self.current_dist_name): + self.METARELEASE_URI = self.METARELEASE_URI_LTS + else: + self._debug("Prompt=lts for non-LTS, ignoring") # needed for the _tryUpgradeSelf() code in DistUpgradeController if forceLTS: self.METARELEASE_URI = self.METARELEASE_URI_LTS === modified file 'debian/changelog' --- debian/changelog 2018-06-27 12:16:47 +0000 +++ debian/changelog 2018-08-30 08:12:18 +0000 @@ -1,3 +1,11 @@ +update-manager (1:18.10.4) UNRELEASED; urgency=medium + + * Ignore Prompt=lts for non-LTS series. This way if a user is on a non-LTS + and has Prompt=lts, he/she will be upgraded to the next supported series + until finally reaching an LTS. (LP: #1783328) + + -- Ɓukasz 'sil2100' Zemczak Tue, 28 Aug 2018 13:20:08 +0200 + update-manager (1:18.10.3) cosmic; urgency=medium * Add support for HTTPS proxies; this breaks UpdateManager.Core.utils.init_proxy() === modified file 'debian/control' --- debian/control 2018-04-12 18:06:59 +0000 +++ debian/control 2018-08-30 08:12:18 +0000 @@ -45,6 +45,7 @@ Depends: ${python3:Depends}, ${misc:Depends}, python3-apt (>= 0.8.5~), + python3-distro-info, python3-distupgrade, lsb-release, Suggests: python3-launchpadlib, === modified file 'tests/test_meta_release_core.py' --- tests/test_meta_release_core.py 2017-08-07 23:14:56 +0000 +++ tests/test_meta_release_core.py 2018-08-30 08:12:18 +0000 @@ -166,6 +166,22 @@ self.assertTrue("" in data) @patch("UpdateManager.Core.MetaRelease.MetaReleaseCore.download") + @patch("UpdateManager.Core.MetaRelease.distro_info.UbuntuDistroInfo" + ".is_lts") + def test_prompt_lts_ignored_for_non_lts(self, mock_is_lts, mock_download): + with tempfile.NamedTemporaryFile() as f: + # for non-LTS, Prompt=lts should not change the METARELEASE_URI + mock_is_lts.return_value = False + f.write(""" +[DEFAULT] +Prompt=lts +""".encode("utf-8")) + f.flush() + with patch.object(MetaReleaseCore, "CONF", f.name): + meta = MetaReleaseCore() + self.assertNotEqual(meta.METARELEASE_URI, meta.METARELEASE_URI_LTS) + + @patch("UpdateManager.Core.MetaRelease.MetaReleaseCore.download") def test_parse_fails_for_all_non_tagfiles(self, mock_download): meta = MetaReleaseCore() with tempfile.TemporaryFile() as f: