Merge lp:~azzar1/update-manager/add-livepatch-reminder into lp:update-manager

Proposed by Andrea Azzarone
Status: Merged
Merged at revision: 2829
Proposed branch: lp:~azzar1/update-manager/add-livepatch-reminder
Merge into: lp:update-manager
Diff against target: 105 lines (+28/-1)
4 files modified
UpdateManager/Dialogs.py (+16/-1)
data/com.ubuntu.update-manager.gschema.xml.in (+5/-0)
debian/changelog (+6/-0)
update-manager (+1/-0)
To merge this branch: bzr merge lp:~azzar1/update-manager/add-livepatch-reminder
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Brian Murray Needs Fixing
Review via email: mp+353304@code.launchpad.net

Commit message

Add a reminder to install Livepatch if it is not installed and it is supported by the current release. The reminder is displayed after a few upgrades.

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

I've a couple of in-line comments. Could you add a changelog entry too?

review: Needs Fixing
2827. By Andrea Azzarone

Add a reminder to install Livepatch if it is not installed and it is supported by the current release. The reminder is displayed after a few upgrades.

Revision history for this message
Andrea Azzarone (azzar1) wrote :

Done!

Revision history for this message
Sebastien Bacher (seb128) wrote :

looks fine to me, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/Dialogs.py'
2--- UpdateManager/Dialogs.py 2018-02-09 12:48:59 +0000
3+++ UpdateManager/Dialogs.py 2018-08-20 11:03:56 +0000
4@@ -26,6 +26,7 @@
5 gi.require_version("Gtk", "3.0")
6 from gi.repository import Gtk
7 from gi.repository import Gdk
8+from gi.repository import Gio
9 import warnings
10 warnings.filterwarnings(
11 "ignore", "Accessed deprecated property", DeprecationWarning)
12@@ -33,11 +34,13 @@
13 import logging
14 import datetime
15 import dbus
16+import distro_info
17 import os
18 import subprocess
19
20 import HweSupportStatus.consts
21 from .Core.LivePatchSocket import LivePatchSocket
22+from .Core.utils import get_dist
23
24 from gettext import gettext as _
25 from gettext import ngettext
26@@ -97,6 +100,8 @@
27 ui_path = os.path.join(window_main.datadir, "gtkbuilder/Dialog.ui")
28 BuilderDialog.__init__(self, window_main, ui_path, "pane_dialog")
29
30+ self.settings = Gio.Settings.new("com.ubuntu.update-manager")
31+
32 self.focus_button = None
33 self.set_content_widget(content_widget)
34 self.connect("realize", self._on_realize)
35@@ -144,10 +149,20 @@
36 self.main_container.add(content_widget)
37 self.main_container.set_visible(bool(content_widget))
38
39+ def _is_livepatch_supported(self):
40+ di = distro_info.UbuntuDistroInfo()
41+ codename = get_dist()
42+ return di.is_lts(codename)
43+
44 def on_livepatch_status_ready(self, active, cs, ps, fixes):
45 self.set_desc(None)
46
47 if not active:
48+ if self._is_livepatch_supported() and \
49+ self.settings.get_int('launch-count') >= 4:
50+ self.set_desc (_("<b>Tip:</b> You can use Livepatch to keep your "
51+ "computer more secure between restarts."))
52+ self.settings_button.set_label(_("Settings & Livepatch…"))
53 return
54
55 needs_reschedule = False
56@@ -208,7 +223,7 @@
57 self.set_header(_("No software updates are available."))
58 else:
59 self.set_header(_("The software on this computer is up to date."))
60- self.add_settings_button()
61+ self.settings_button = self.add_settings_button()
62 self.focus_button = self.add_button(Gtk.STOCK_OK,
63 self.window_main.close)
64 self.check_livepatch_status()
65
66=== modified file 'data/com.ubuntu.update-manager.gschema.xml.in'
67--- data/com.ubuntu.update-manager.gschema.xml.in 2017-03-14 20:46:06 +0000
68+++ data/com.ubuntu.update-manager.gschema.xml.in 2018-08-20 11:03:56 +0000
69@@ -50,5 +50,10 @@
70 <summary>Time when update-manager got launched last</summary>
71 <description>The last time update-manager was run.</description>
72 </key>
73+ <key name="launch-count" type="i">
74+ <default>0</default>
75+ <summary>Number of times update-manager has been launched</summary>
76+ <description>Number of times update-manager has been launched.</description>
77+ </key>
78 </schema>
79 </schemalist>
80
81=== modified file 'debian/changelog'
82--- debian/changelog 2018-06-27 12:16:47 +0000
83+++ debian/changelog 2018-08-20 11:03:56 +0000
84@@ -1,3 +1,9 @@
85+update-manager (1:18.10.4) UNRELEASED; urgency=medium
86+
87+ * Add a reminder to enable Livepatch (LP: #1787553).
88+
89+ -- Andrea Azzarone <andrea.azzarone@canonical.com> Mon, 20 Aug 2018 13:59:48 +0300
90+
91 update-manager (1:18.10.3) cosmic; urgency=medium
92
93 * Add support for HTTPS proxies; this breaks UpdateManager.Core.utils.init_proxy()
94
95=== modified file 'update-manager'
96--- update-manager 2017-07-12 22:03:00 +0000
97+++ update-manager 2018-08-20 11:03:56 +0000
98@@ -111,6 +111,7 @@
99 # keep track when we run (for update-notifier)
100 settings = Gio.Settings.new("com.ubuntu.update-manager")
101 settings.set_int64("launch-time", int(time.time()))
102+ settings.set_int("launch-count", settings.get_int("launch-count") + 1)
103 init_proxy(settings)
104
105 app = UpdateManager(data_dir, options)

Subscribers

People subscribed via source and target branches

to status/vote changes: