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
=== modified file 'UpdateManager/Core/UpdateList.py'
--- UpdateManager/Core/UpdateList.py 2020-08-17 15:12:42 +0000
+++ UpdateManager/Core/UpdateList.py 2021-01-08 15:34:15 +0000
@@ -36,6 +36,7 @@
36import os36import os
37import random37import random
38import glob38import glob
39import re
3940
40from gi.repository import Gio41from gi.repository import Gio
4142
@@ -384,43 +385,6 @@
384 return True385 return True
385 return False386 return False
386387
387 def _get_linux_packages(self):
388 "Return all binary packages made by the linux-meta source package"
389 # Hard code this rather than generate from source info in cache because
390 # that might only be available if we have deb-src lines. I think we
391 # could also generate it by iterating over all the binary package info
392 # we have, but that is costly. These don't change often.
393 return ['linux',
394 'linux-cloud-tools-generic',
395 'linux-cloud-tools-lowlatency',
396 'linux-cloud-tools-virtual',
397 'linux-crashdump',
398 'linux-generic',
399 'linux-generic-lpae',
400 'linux-headers-generic',
401 'linux-headers-generic-lpae',
402 'linux-headers-lowlatency',
403 'linux-headers-lowlatency-lpae',
404 'linux-headers-server',
405 'linux-headers-virtual',
406 'linux-image',
407 'linux-image-extra-virtual',
408 'linux-image-generic',
409 'linux-image-generic-lpae',
410 'linux-image-lowlatency',
411 'linux-image-virtual',
412 'linux-lowlatency',
413 'linux-signed-generic',
414 'linux-signed-image-generic',
415 'linux-signed-image-lowlatency',
416 'linux-signed-lowlatency',
417 'linux-source',
418 'linux-tools-generic',
419 'linux-tools-generic-lpae',
420 'linux-tools-lowlatency',
421 'linux-tools-virtual',
422 'linux-virtual']
423
424 def _make_groups(self, cache, pkgs, eventloop_callback, to_remove=False):388 def _make_groups(self, cache, pkgs, eventloop_callback, to_remove=False):
425 if not pkgs:389 if not pkgs:
426 return []390 return []
@@ -452,10 +416,30 @@
452 if ungrouped_pkgs:416 if ungrouped_pkgs:
453 # Separate out system base packages. If we have already found an417 # Separate out system base packages. If we have already found an
454 # application for all updates, don't bother.418 # application for all updates, don't bother.
419 linux_names = ("linux$",
420 "linux-.*-buildinfo.*",
421 "linux-.*-dev.*",
422 "linux-.*-generic.*",
423 "linux-.*-headers.*",
424 "linux-.*-hwe.*",
425 "linux-.*-gcp.*",
426 "linux-.*-kernel.*",
427 "linux-.*-lowlatency.*",
428 "linux-.*-modules.*",
429 "linux-.*-raspi.*",
430 "linux-.*-tools.*",
431 "linux-.*-virtual.*",
432 "linux-base.*",
433 "linux-crashdump.*",
434 "linux-doc.*")
435 linux_regexp = re.compile("(" + "|".join(
436 ["^" + n for n in linux_names]) + ")")
455 meta_group = UpdateGroup(None, None, None, to_remove)437 meta_group = UpdateGroup(None, None, None, to_remove)
456 flavor_package = utils.get_ubuntu_flavor_package(cache=cache)438 flavor_package = utils.get_ubuntu_flavor_package(cache=cache)
457 meta_pkgs = [flavor_package, "ubuntu-standard", "ubuntu-minimal"]439 meta_pkgs = [flavor_package, "ubuntu-standard", "ubuntu-minimal"]
458 meta_pkgs.extend(self._get_linux_packages())440 for pkg in cache:
441 if linux_regexp.match(pkg.name):
442 meta_pkgs.append(pkg)
459 for pkg in meta_pkgs:443 for pkg in meta_pkgs:
460 if pkg in cache:444 if pkg in cache:
461 meta_group.add(cache[pkg])445 meta_group.add(cache[pkg])
462446
=== modified file 'UpdateManager/Dialogs.py'
--- UpdateManager/Dialogs.py 2020-11-30 14:06:28 +0000
+++ UpdateManager/Dialogs.py 2021-01-08 15:34:15 +0000
@@ -155,8 +155,9 @@
155155
156 def _has_livepatch_settings_ui(self):156 def _has_livepatch_settings_ui(self):
157 try:157 try:
158 return Gio.DesktopAppInfo.new('gnome-online-accounts-panel.desktop')158 return Gio.DesktopAppInfo \
159 except:159 .new('gnome-online-accounts-panel.desktop')
160 except Exception:
160 return None161 return None
161162
162 def on_livepatch_status_ready(self, active, cs, ps, fixes):163 def on_livepatch_status_ready(self, active, cs, ps, fixes):
163164
=== modified file 'debian/changelog'
--- debian/changelog 2021-01-07 00:27:44 +0000
+++ debian/changelog 2021-01-08 15:34:15 +0000
@@ -1,12 +1,17 @@
1update-manager (1:21.04.2) UNRELEASED; urgency=medium1update-manager (1:21.04.2) UNRELEASED; urgency=medium
22
3 [ Brian Murray ]
3 * UpdateManager/Dialogs.py: do not mention livepatch settings when the4 * UpdateManager/Dialogs.py: do not mention livepatch settings when the
4 interface is not installed, thanks to Sebastien Bacher for the patch.5 interface is not installed, thanks to Sebastien Bacher for the patch.
5 (LP: #1807900)6 (LP: #1807900)
6 * UpdateManager/backend/__init__.py: Resolve unbound local error crash with7 * UpdateManager/backend/__init__.py: Resolve unbound local error crash with
7 oem package lists. Thanks to Thomas Bechtold for the patch.8 oem package lists. Thanks to Thomas Bechtold for the patch.
89
9 -- Brian Murray <brian@ubuntu.com> Wed, 16 Dec 2020 14:12:32 -080010 [ William Wilson ]
11 * UpdateManager/Core/UpdateList.py: change to a regex from a static list
12 of files to be grouped under Ubuntu Base (LP: #1902025)
13
14 -- Brian Murray <brian@ubuntu.com> Thu, 07 Jan 2021 16:07:15 -0600
1015
11update-manager (1:21.04.2) hirsute; urgency=medium16update-manager (1:21.04.2) hirsute; urgency=medium
1217
1318
=== modified file 'tests/aptroot-grouping-test/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages'
--- 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
+++ 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
@@ -78,3 +78,27 @@
78Recommends: base-pkg78Recommends: base-pkg
79Description: meta package79Description: meta package
80Origin: Ubuntu80Origin: Ubuntu
81
82Package: linux-test-hwe
83Priority: optional
84Section: admin
85Installed-Size: 1
86Maintainer: Foo <foo@bar.com>
87Architecture: all
88Version: 1
89Size: 1
90Recommends: base-pkg
91Description: positive test for linux package names
92Origin: Ubuntu
93
94Package: linux-show-player
95Priority: optional
96Section: admin
97Installed-Size: 1
98Maintainer: Foo <foo@bar.com>
99Architecture: all
100Version: 1
101Size: 1
102Recommends: base-pkg
103Description: negative test for linux package names
104Origin: Ubuntu
81105
=== modified file 'tests/aptroot-grouping-test/var/lib/dpkg/status'
--- tests/aptroot-grouping-test/var/lib/dpkg/status 2013-01-21 01:49:22 +0000
+++ tests/aptroot-grouping-test/var/lib/dpkg/status 2021-01-08 15:34:15 +0000
@@ -80,3 +80,33 @@
80Architecture: all80Architecture: all
81Version: 0.181Version: 0.1
82Description: an installed package that only one app depends on82Description: an installed package that only one app depends on
83
84Package: ubuntu-minimal
85Status: install ok installed
86Priority: optional
87Section: admin
88Installed-Size: 1
89Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
90Architecture: all
91Version: 0.1
92Description: meta package
93
94Package: linux-test-hwe
95Status: install ok installed
96Priority: optional
97Section: admin
98Installed-Size: 1
99Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
100Architecture: all
101Version: 0.1
102Description: positive test for linux package names
103
104Package: linux-show-player
105Status: install ok installed
106Priority: optional
107Section: admin
108Installed-Size: 1
109Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
110Architecture: all
111Version: 0.1
112Description: negative test for linux package names
83113
=== modified file 'tests/test_update_list.py'
--- tests/test_update_list.py 2017-08-07 19:42:06 +0000
+++ tests/test_update_list.py 2021-01-08 15:34:15 +0000
@@ -166,9 +166,18 @@
166 self.assertListEqual([x.pkg.name for x in group.items],166 self.assertListEqual([x.pkg.name for x in group.items],
167 ['installed-pkg'])167 ['installed-pkg'])
168168
169 def test_negative_regex_match(self):
170 self.assertGreater(len(self.updates_list.update_groups), 3)
171 group = self.updates_list.update_groups[3]
172 self.assertIsInstance(group, UpdateList.UpdatePackageGroup)
173 self.assertIsNotNone(group.core_item)
174 self.assertEqual(group.core_item.pkg.name, 'linux-show-player')
175 self.assertListEqual([x.pkg.name for x in group.items],
176 ['linux-show-player'])
177
169 def test_pkg_multiple_deps(self):178 def test_pkg_multiple_deps(self):
170 self.assertEqual(len(self.updates_list.update_groups), 4)179 self.assertGreater(len(self.updates_list.update_groups), 4)
171 group = self.updates_list.update_groups[3]180 group = self.updates_list.update_groups[4]
172 self.assertIsInstance(group, UpdateList.UpdatePackageGroup)181 self.assertIsInstance(group, UpdateList.UpdatePackageGroup)
173 self.assertIsNotNone(group.core_item)182 self.assertIsNotNone(group.core_item)
174 self.assertEqual(group.core_item.pkg.name,183 self.assertEqual(group.core_item.pkg.name,
@@ -183,6 +192,15 @@
183 self.assertIsNone(group.core_item)192 self.assertIsNone(group.core_item)
184 self.assertListEqual([x.pkg.name for x in group.items], ['base-pkg'])193 self.assertListEqual([x.pkg.name for x in group.items], ['base-pkg'])
185194
195 def test_base_grouping(self):
196 self.assertEqual(len(self.updates_list.update_groups), 6)
197 group = self.updates_list.update_groups[5]
198 self.assertIsInstance(group, UpdateList.UpdateSystemGroup)
199 self.assertIsNone(group.core_item)
200 self.assertListEqual([x.pkg.name for x in group.items],
201 ['ubuntu-minimal',
202 'linux-test-hwe'])
203
186204
187if __name__ == "__main__":205if __name__ == "__main__":
188 unittest.main()206 unittest.main()

Subscribers

People subscribed via source and target branches

to status/vote changes: