Merge lp:~sil2100/update-manager/ignore_prompt_lts_for_non-lts into lp:update-manager

Proposed by Łukasz Zemczak
Status: Merged
Merged at revision: 2827
Proposed branch: lp:~sil2100/update-manager/ignore_prompt_lts_for_non-lts
Merge into: lp:update-manager
Diff against target: 92 lines (+37/-4)
4 files modified
UpdateManager/Core/MetaRelease.py (+12/-4)
debian/changelog (+8/-0)
debian/control (+1/-0)
tests/test_meta_release_core.py (+16/-0)
To merge this branch: bzr merge lp:~sil2100/update-manager/ignore_prompt_lts_for_non-lts
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+353851@code.launchpad.net

Commit message

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.

Description of the change

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.

As mentioned by Brian, this will probably require some dependency changes in the ubuntu-release-upgrader as well since now MetaReleaseCore is using distro_info to check for the lts status.

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

This looks good to me, I just have a couple of in-line comments.

Revision history for this message
Brian Murray (brian-murray) :
review: Approve
2828. By Łukasz Zemczak

Small correction in a comment.

2829. By Łukasz Zemczak

Stop using 'type' as a variable name. It's a bad python variable name.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Done! Thanks for the review!

2830. By Łukasz Zemczak

Proposition: since MetaRelease.py uses distro-info now, I guess it's most logical to make it depend on it?

Revision history for this message
Brian Murray (brian-murray) wrote :

MetaRelease.py is included in the package python3-update-manager and python3-distupgrade so I think both of those should depend on distro-info.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, so leaving this as is - will you merge it once you have a moment today?

I can provide a dep addition to ubuntu-release-upgrader although I personally don't think it's needed. I didn't do it before as python3-distupgrade already depends on python3-update-manager, which after this merge lands will be pulling in the dependency of distro-info already. But I can understand if you want to add an explicit dep for clarity though.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
2424
25import apt25import apt
26import apt_pkg26import apt_pkg
27import distro_info
27try:28try:
28 import configparser29 import configparser
29except ImportError:30except ImportError:
@@ -143,14 +144,21 @@
143 return144 return
144 # now check which specific url to use145 # now check which specific url to use
145 if parser.has_option("DEFAULT", "Prompt"):146 if parser.has_option("DEFAULT", "Prompt"):
146 type = parser.get("DEFAULT", "Prompt").lower()147 prompt = parser.get("DEFAULT", "Prompt").lower()
147 if (type == "never" or type == "no"):148 if (prompt == "never" or prompt == "no"):
148 # nothing to do for this object149 # nothing to do for this object
149 # FIXME: what about no longer supported?150 # FIXME: what about no longer supported?
150 self.downloaded.set()151 self.downloaded.set()
151 return152 return
152 elif type == "lts":153 elif prompt == "lts":
153 self.METARELEASE_URI = self.METARELEASE_URI_LTS154 # the Prompt=lts setting only makes sense when running on
155 # a LTS, otherwise it would result in users not receiving
156 # any distro upgrades
157 di = distro_info.UbuntuDistroInfo()
158 if di.is_lts(self.current_dist_name):
159 self.METARELEASE_URI = self.METARELEASE_URI_LTS
160 else:
161 self._debug("Prompt=lts for non-LTS, ignoring")
154 # needed for the _tryUpgradeSelf() code in DistUpgradeController162 # needed for the _tryUpgradeSelf() code in DistUpgradeController
155 if forceLTS:163 if forceLTS:
156 self.METARELEASE_URI = self.METARELEASE_URI_LTS164 self.METARELEASE_URI = self.METARELEASE_URI_LTS
157165
=== 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 @@
1update-manager (1:18.10.4) UNRELEASED; urgency=medium
2
3 * Ignore Prompt=lts for non-LTS series. This way if a user is on a non-LTS
4 and has Prompt=lts, he/she will be upgraded to the next supported series
5 until finally reaching an LTS. (LP: #1783328)
6
7 -- Łukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> Tue, 28 Aug 2018 13:20:08 +0200
8
1update-manager (1:18.10.3) cosmic; urgency=medium9update-manager (1:18.10.3) cosmic; urgency=medium
210
3 * Add support for HTTPS proxies; this breaks UpdateManager.Core.utils.init_proxy()11 * Add support for HTTPS proxies; this breaks UpdateManager.Core.utils.init_proxy()
412
=== 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 @@
45Depends: ${python3:Depends},45Depends: ${python3:Depends},
46 ${misc:Depends},46 ${misc:Depends},
47 python3-apt (>= 0.8.5~),47 python3-apt (>= 0.8.5~),
48 python3-distro-info,
48 python3-distupgrade,49 python3-distupgrade,
49 lsb-release,50 lsb-release,
50Suggests: python3-launchpadlib,51Suggests: python3-launchpadlib,
5152
=== 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 @@
166 self.assertTrue("<html>" in data)166 self.assertTrue("<html>" in data)
167167
168 @patch("UpdateManager.Core.MetaRelease.MetaReleaseCore.download")168 @patch("UpdateManager.Core.MetaRelease.MetaReleaseCore.download")
169 @patch("UpdateManager.Core.MetaRelease.distro_info.UbuntuDistroInfo"
170 ".is_lts")
171 def test_prompt_lts_ignored_for_non_lts(self, mock_is_lts, mock_download):
172 with tempfile.NamedTemporaryFile() as f:
173 # for non-LTS, Prompt=lts should not change the METARELEASE_URI
174 mock_is_lts.return_value = False
175 f.write("""
176[DEFAULT]
177Prompt=lts
178""".encode("utf-8"))
179 f.flush()
180 with patch.object(MetaReleaseCore, "CONF", f.name):
181 meta = MetaReleaseCore()
182 self.assertNotEqual(meta.METARELEASE_URI, meta.METARELEASE_URI_LTS)
183
184 @patch("UpdateManager.Core.MetaRelease.MetaReleaseCore.download")
169 def test_parse_fails_for_all_non_tagfiles(self, mock_download):185 def test_parse_fails_for_all_non_tagfiles(self, mock_download):
170 meta = MetaReleaseCore()186 meta = MetaReleaseCore()
171 with tempfile.TemporaryFile() as f:187 with tempfile.TemporaryFile() as f:

Subscribers

People subscribed via source and target branches

to status/vote changes: