Merge lp:~jawn-smith/update-manager/hwe-kernel-scope into lp:update-manager

Proposed by William Wilson
Status: Merged
Merged at revision: 2902
Proposed branch: lp:~jawn-smith/update-manager/hwe-kernel-scope
Merge into: lp:update-manager
Diff against target: 237 lines (+105/-43)
6 files modified
UpdateManager/Core/UpdateList.py (+22/-38)
UpdateManager/Dialogs.py (+3/-2)
debian/changelog (+6/-1)
tests/aptroot-grouping-test/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages (+24/-0)
tests/aptroot-grouping-test/var/lib/dpkg/status (+30/-0)
tests/test_update_list.py (+20/-2)
To merge this branch: bzr merge lp:~jawn-smith/update-manager/hwe-kernel-scope
Reviewer Review Type Date Requested Status
Brian Murray Needs Fixing
Review via email: mp+395808@code.launchpad.net

Description of the change

Added the hwe kernel packages to the get_linux_packages function that groups them under Ubuntu Base

To post a comment you must log in.
2903. By William Wilson

Moving to using the kernel regex check in 01autoremove rather than a static list for packages that need to appear under Ubuntu Base

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

This looks good, thanks for working on this. I think it'd be best to test a couple more regular expressions that appear in 01autoremove though as it may actually group more packages under "Ubunt u Base" than we want.

review: Needs Information
2904. By William Wilson

refining regex used to determine Ubuntu Base packages

2905. By William Wilson

Adding new test to ensure certain packages are not grouped under Ubuntu Base. Also small regex update

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

This looks really good, I've just made a couple of minor comments which appear in-line.

review: Needs Fixing
2906. By William Wilson

LP: #1902025 clarifying meta vs linux packages, fixing changelog, using tuple instead of list for immutability

Revision history for this message
William Wilson (jawn-smith) wrote :

> This looks really good, I've just made a couple of minor comments which appear
> in-line.

Comments addressed and linked the LP bug.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/Core/UpdateList.py'
2--- UpdateManager/Core/UpdateList.py 2020-08-17 15:12:42 +0000
3+++ UpdateManager/Core/UpdateList.py 2021-01-08 15:34:15 +0000
4@@ -36,6 +36,7 @@
5 import os
6 import random
7 import glob
8+import re
9
10 from gi.repository import Gio
11
12@@ -384,43 +385,6 @@
13 return True
14 return False
15
16- def _get_linux_packages(self):
17- "Return all binary packages made by the linux-meta source package"
18- # Hard code this rather than generate from source info in cache because
19- # that might only be available if we have deb-src lines. I think we
20- # could also generate it by iterating over all the binary package info
21- # we have, but that is costly. These don't change often.
22- return ['linux',
23- 'linux-cloud-tools-generic',
24- 'linux-cloud-tools-lowlatency',
25- 'linux-cloud-tools-virtual',
26- 'linux-crashdump',
27- 'linux-generic',
28- 'linux-generic-lpae',
29- 'linux-headers-generic',
30- 'linux-headers-generic-lpae',
31- 'linux-headers-lowlatency',
32- 'linux-headers-lowlatency-lpae',
33- 'linux-headers-server',
34- 'linux-headers-virtual',
35- 'linux-image',
36- 'linux-image-extra-virtual',
37- 'linux-image-generic',
38- 'linux-image-generic-lpae',
39- 'linux-image-lowlatency',
40- 'linux-image-virtual',
41- 'linux-lowlatency',
42- 'linux-signed-generic',
43- 'linux-signed-image-generic',
44- 'linux-signed-image-lowlatency',
45- 'linux-signed-lowlatency',
46- 'linux-source',
47- 'linux-tools-generic',
48- 'linux-tools-generic-lpae',
49- 'linux-tools-lowlatency',
50- 'linux-tools-virtual',
51- 'linux-virtual']
52-
53 def _make_groups(self, cache, pkgs, eventloop_callback, to_remove=False):
54 if not pkgs:
55 return []
56@@ -452,10 +416,30 @@
57 if ungrouped_pkgs:
58 # Separate out system base packages. If we have already found an
59 # application for all updates, don't bother.
60+ linux_names = ("linux$",
61+ "linux-.*-buildinfo.*",
62+ "linux-.*-dev.*",
63+ "linux-.*-generic.*",
64+ "linux-.*-headers.*",
65+ "linux-.*-hwe.*",
66+ "linux-.*-gcp.*",
67+ "linux-.*-kernel.*",
68+ "linux-.*-lowlatency.*",
69+ "linux-.*-modules.*",
70+ "linux-.*-raspi.*",
71+ "linux-.*-tools.*",
72+ "linux-.*-virtual.*",
73+ "linux-base.*",
74+ "linux-crashdump.*",
75+ "linux-doc.*")
76+ linux_regexp = re.compile("(" + "|".join(
77+ ["^" + n for n in linux_names]) + ")")
78 meta_group = UpdateGroup(None, None, None, to_remove)
79 flavor_package = utils.get_ubuntu_flavor_package(cache=cache)
80 meta_pkgs = [flavor_package, "ubuntu-standard", "ubuntu-minimal"]
81- meta_pkgs.extend(self._get_linux_packages())
82+ for pkg in cache:
83+ if linux_regexp.match(pkg.name):
84+ meta_pkgs.append(pkg)
85 for pkg in meta_pkgs:
86 if pkg in cache:
87 meta_group.add(cache[pkg])
88
89=== modified file 'UpdateManager/Dialogs.py'
90--- UpdateManager/Dialogs.py 2020-11-30 14:06:28 +0000
91+++ UpdateManager/Dialogs.py 2021-01-08 15:34:15 +0000
92@@ -155,8 +155,9 @@
93
94 def _has_livepatch_settings_ui(self):
95 try:
96- return Gio.DesktopAppInfo.new('gnome-online-accounts-panel.desktop')
97- except:
98+ return Gio.DesktopAppInfo \
99+ .new('gnome-online-accounts-panel.desktop')
100+ except Exception:
101 return None
102
103 def on_livepatch_status_ready(self, active, cs, ps, fixes):
104
105=== modified file 'debian/changelog'
106--- debian/changelog 2021-01-07 00:27:44 +0000
107+++ debian/changelog 2021-01-08 15:34:15 +0000
108@@ -1,12 +1,17 @@
109 update-manager (1:21.04.2) UNRELEASED; urgency=medium
110
111+ [ Brian Murray ]
112 * UpdateManager/Dialogs.py: do not mention livepatch settings when the
113 interface is not installed, thanks to Sebastien Bacher for the patch.
114 (LP: #1807900)
115 * UpdateManager/backend/__init__.py: Resolve unbound local error crash with
116 oem package lists. Thanks to Thomas Bechtold for the patch.
117
118- -- Brian Murray <brian@ubuntu.com> Wed, 16 Dec 2020 14:12:32 -0800
119+ [ William Wilson ]
120+ * UpdateManager/Core/UpdateList.py: change to a regex from a static list
121+ of files to be grouped under Ubuntu Base (LP: #1902025)
122+
123+ -- Brian Murray <brian@ubuntu.com> Thu, 07 Jan 2021 16:07:15 -0600
124
125 update-manager (1:21.04.2) hirsute; urgency=medium
126
127
128=== modified file 'tests/aptroot-grouping-test/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages'
129--- tests/aptroot-grouping-test/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages 2013-01-21 01:49:22 +0000
130+++ tests/aptroot-grouping-test/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages 2021-01-08 15:34:15 +0000
131@@ -78,3 +78,27 @@
132 Recommends: base-pkg
133 Description: meta package
134 Origin: Ubuntu
135+
136+Package: linux-test-hwe
137+Priority: optional
138+Section: admin
139+Installed-Size: 1
140+Maintainer: Foo <foo@bar.com>
141+Architecture: all
142+Version: 1
143+Size: 1
144+Recommends: base-pkg
145+Description: positive test for linux package names
146+Origin: Ubuntu
147+
148+Package: linux-show-player
149+Priority: optional
150+Section: admin
151+Installed-Size: 1
152+Maintainer: Foo <foo@bar.com>
153+Architecture: all
154+Version: 1
155+Size: 1
156+Recommends: base-pkg
157+Description: negative test for linux package names
158+Origin: Ubuntu
159
160=== modified file 'tests/aptroot-grouping-test/var/lib/dpkg/status'
161--- tests/aptroot-grouping-test/var/lib/dpkg/status 2013-01-21 01:49:22 +0000
162+++ tests/aptroot-grouping-test/var/lib/dpkg/status 2021-01-08 15:34:15 +0000
163@@ -80,3 +80,33 @@
164 Architecture: all
165 Version: 0.1
166 Description: an installed package that only one app depends on
167+
168+Package: ubuntu-minimal
169+Status: install ok installed
170+Priority: optional
171+Section: admin
172+Installed-Size: 1
173+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
174+Architecture: all
175+Version: 0.1
176+Description: meta package
177+
178+Package: linux-test-hwe
179+Status: install ok installed
180+Priority: optional
181+Section: admin
182+Installed-Size: 1
183+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
184+Architecture: all
185+Version: 0.1
186+Description: positive test for linux package names
187+
188+Package: linux-show-player
189+Status: install ok installed
190+Priority: optional
191+Section: admin
192+Installed-Size: 1
193+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
194+Architecture: all
195+Version: 0.1
196+Description: negative test for linux package names
197
198=== modified file 'tests/test_update_list.py'
199--- tests/test_update_list.py 2017-08-07 19:42:06 +0000
200+++ tests/test_update_list.py 2021-01-08 15:34:15 +0000
201@@ -166,9 +166,18 @@
202 self.assertListEqual([x.pkg.name for x in group.items],
203 ['installed-pkg'])
204
205+ def test_negative_regex_match(self):
206+ self.assertGreater(len(self.updates_list.update_groups), 3)
207+ group = self.updates_list.update_groups[3]
208+ self.assertIsInstance(group, UpdateList.UpdatePackageGroup)
209+ self.assertIsNotNone(group.core_item)
210+ self.assertEqual(group.core_item.pkg.name, 'linux-show-player')
211+ self.assertListEqual([x.pkg.name for x in group.items],
212+ ['linux-show-player'])
213+
214 def test_pkg_multiple_deps(self):
215- self.assertEqual(len(self.updates_list.update_groups), 4)
216- group = self.updates_list.update_groups[3]
217+ self.assertGreater(len(self.updates_list.update_groups), 4)
218+ group = self.updates_list.update_groups[4]
219 self.assertIsInstance(group, UpdateList.UpdatePackageGroup)
220 self.assertIsNotNone(group.core_item)
221 self.assertEqual(group.core_item.pkg.name,
222@@ -183,6 +192,15 @@
223 self.assertIsNone(group.core_item)
224 self.assertListEqual([x.pkg.name for x in group.items], ['base-pkg'])
225
226+ def test_base_grouping(self):
227+ self.assertEqual(len(self.updates_list.update_groups), 6)
228+ group = self.updates_list.update_groups[5]
229+ self.assertIsInstance(group, UpdateList.UpdateSystemGroup)
230+ self.assertIsNone(group.core_item)
231+ self.assertListEqual([x.pkg.name for x in group.items],
232+ ['ubuntu-minimal',
233+ 'linux-test-hwe'])
234+
235
236 if __name__ == "__main__":
237 unittest.main()

Subscribers

People subscribed via source and target branches

to status/vote changes: