Merge lp:~mterry/update-manager/pkexec into lp:update-manager

Proposed by Michael Terry on 2012-06-28
Status: Merged
Merged at revision: 2517
Proposed branch: lp:~mterry/update-manager/pkexec
Merge into: lp:update-manager
Diff against target: 422 lines (+16/-305)
8 files modified
UpdateManager/Dialogs.py (+7/-18)
UpdateManager/GtkProgress.py (+0/-97)
UpdateManager/backend/InstallBackendSynaptic.py (+1/-3)
data/gtkbuilder/AcquireProgress.ui (+0/-161)
debian/control (+1/-1)
debian/update-manager.install (+0/-1)
po/POTFILES.in (+0/-2)
update-manager (+7/-22)
To merge this branch: bzr merge lp:~mterry/update-manager/pkexec
Reviewer Review Type Date Requested Status
Serge Hallyn Approve on 2012-06-28
Michael Vogt 2012-06-28 Pending
Review via email: mp+112639@code.launchpad.net

Description of the Change

This is the other half of https://code.launchpad.net/~mterry/ubuntu-release-upgrader/pkexec/+merge/112638

It uses pkexec instead of gksu and moves some release upgrade specific code out of lil old update-manager.

To post a comment you must log in.
Serge Hallyn (serge-hallyn) wrote :

Looks good to me, as far as my u-m-untrained eyes can see.

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 2012-06-28 16:15:24 +0000
3+++ UpdateManager/Dialogs.py 2012-06-28 19:34:26 +0000
4@@ -36,8 +36,6 @@
5 import sys
6 import time
7 from .SimpleGtk3builderApp import SimpleGtkbuilderApp
8-from DistUpgrade.DistUpgradeFetcher import DistUpgradeFetcherGtk
9-from .GtkProgress import GtkAcquireProgress
10
11 from gettext import gettext as _
12
13@@ -130,18 +128,9 @@
14 self.focus_button = self.add_button(Gtk.STOCK_OK, self.close)
15
16 def upgrade(self):
17- progress = GtkAcquireProgress(
18- self.window_main,
19- self.window_main.datadir,
20- _("Downloading the release upgrade tool"))
21- fetcher = DistUpgradeFetcherGtk(
22- new_dist=self.meta_release.upgradable_to,
23- parent=self.window_main,
24- progress=progress,
25- datadir=self.window_main.datadir)
26- if self.window_main.options.sandbox:
27- fetcher.run_options.append("--sandbox")
28- fetcher.run()
29+ os.execl("/usr/bin/pkexec",
30+ "/usr/bin/pkexec", "/usr/bin/do-release-upgrade",
31+ "--frontend=DistUpgradeViewGtk3")
32
33
34 class UnsupportedDialog(DistUpgradeDialog):
35@@ -179,10 +168,10 @@
36 self.focus_button = self.add_button(_("_Continue"), Gtk.main_quit)
37
38 def upgrade(self):
39- os.execl("/usr/bin/gksu",
40- "/usr/bin/gksu", "--desktop",
41- "/usr/share/applications/update-manager.desktop",
42- "--", "/usr/bin/update-manager", "--dist-upgrade")
43+ os.execl("/usr/bin/pkexec",
44+ "/usr/bin/pkexec",
45+ "/usr/lib/ubuntu-release-upgrader/do-partial-upgrade",
46+ "--frontend=DistUpgradeViewGtk3")
47
48 def main(self):
49 Dialog.main(self)
50
51=== removed file 'UpdateManager/GtkProgress.py'
52--- UpdateManager/GtkProgress.py 2012-06-28 00:09:03 +0000
53+++ UpdateManager/GtkProgress.py 1970-01-01 00:00:00 +0000
54@@ -1,97 +0,0 @@
55-# GtkProgress.py
56-# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
57-#
58-# Copyright (c) 2004,2005 Canonical
59-#
60-# Author: Michael Vogt <michael.vogt@ubuntu.com>
61-#
62-# This program is free software; you can redistribute it and/or
63-# modify it under the terms of the GNU General Public License as
64-# published by the Free Software Foundation; either version 2 of the
65-# License, or (at your option) any later version.
66-#
67-# This program is distributed in the hope that it will be useful,
68-# but WITHOUT ANY WARRANTY; without even the implied warranty of
69-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
70-# GNU General Public License for more details.
71-#
72-# You should have received a copy of the GNU General Public License
73-# along with this program; if not, write to the Free Software
74-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
75-# USA
76-
77-from __future__ import absolute_import, print_function
78-
79-from gi.repository import Gtk, Gdk
80-import apt
81-from gettext import gettext as _
82-from .Core.utils import humanize_size
83-from .SimpleGtk3builderApp import SimpleGtkbuilderApp
84-
85-
86-class GtkAcquireProgress(apt.progress.base.AcquireProgress):
87- def __init__(self, parent, datadir, summary="", descr=""):
88- uifile = datadir + "gtkbuilder/AcquireProgress.ui"
89- self.widgets = SimpleGtkbuilderApp(uifile, "update-manager")
90- # if this is set to false the download will cancel
91- self._continue = True
92- # init vars here
93- # FIXME: find a more elegant way, this sucks
94- self.summary = self.widgets.label_fetch_summary
95- self.status = self.widgets.label_fetch_status
96- # we need to connect the signal manual here, it won't work
97- # from the main window auto-connect
98- self.widgets.button_fetch_cancel.connect(
99- "clicked", self.on_button_fetch_cancel_clicked)
100- self.progress = self.widgets.progressbar_fetch
101- self.window_fetch = self.widgets.window_fetch
102- self.window_fetch.set_transient_for(parent)
103- self.window_fetch.realize()
104- self.window_fetch.get_window().set_functions(Gdk.WMFunction.MOVE)
105- # set summary
106- if summary != "":
107- self.summary.set_markup("<big><b>%s</b></big> \n\n%s" %
108- (summary, descr))
109-
110- def start(self):
111- self.progress.set_fraction(0)
112- self.window_fetch.show()
113-
114- def stop(self):
115- self.window_fetch.hide()
116-
117- def on_button_fetch_cancel_clicked(self, widget):
118- self._continue = False
119-
120- def pulse(self, owner):
121- apt.progress.base.AcquireProgress.pulse(self, owner)
122- current_item = self.current_items + 1
123- if current_item > self.total_items:
124- current_item = self.total_items
125- if self.current_cps > 0:
126- status_text = (_("Downloading file %(current)li of %(total)li "
127- "with %(speed)s/s") % {
128- "current": current_item,
129- "total": self.total_items,
130- "speed": humanize_size(self.current_cps)})
131- else:
132- status_text = (_("Downloading file %(current)li of %(total)li") %
133- {"current": current_item,
134- "total": self.total_items})
135- self.progress.set_fraction(
136- (self.current_bytes + self.current_items) /
137- float(self.total_bytes + self.total_items))
138- self.status.set_markup("<i>%s</i>" % status_text)
139- # TRANSLATORS: show the remaining time in a progress bar:
140- #if self.current_cps > 0:
141- # eta = ((self.total_bytes + self.current_bytes) /
142- # float(self.current_cps))
143- #else:
144- # eta = 0.0
145- #self.progress.set_text(_("About %s left" % (apt_pkg.TimeToStr(eta))))
146- # FIXME: show remaining time
147- self.progress.set_text("")
148-
149- while Gtk.events_pending():
150- Gtk.main_iteration()
151- return self._continue
152
153=== modified file 'UpdateManager/backend/InstallBackendSynaptic.py'
154--- UpdateManager/backend/InstallBackendSynaptic.py 2012-06-28 00:10:23 +0000
155+++ UpdateManager/backend/InstallBackendSynaptic.py 2012-06-28 19:34:26 +0000
156@@ -26,9 +26,7 @@
157 xid = win.get_xid()
158 except AttributeError:
159 xid = 0
160- cmd = ["/usr/bin/gksu",
161- "--desktop", "/usr/share/applications/update-manager.desktop",
162- "--", "/usr/sbin/synaptic", "--hide-main-window",
163+ cmd = ["/usr/bin/pkexec", "/usr/sbin/synaptic", "--hide-main-window",
164 "--non-interactive", "--parent-window-id",
165 "%s" % xid]
166 cmd.extend(opt)
167
168=== removed file 'data/gtkbuilder/AcquireProgress.ui'
169--- data/gtkbuilder/AcquireProgress.ui 2012-06-15 20:02:33 +0000
170+++ data/gtkbuilder/AcquireProgress.ui 1970-01-01 00:00:00 +0000
171@@ -1,161 +0,0 @@
172-<?xml version="1.0" encoding="UTF-8"?>
173-<interface>
174- <!-- interface-requires gtk+ 3.0 -->
175- <object class="GtkWindow" id="window_fetch">
176- <property name="can_focus">False</property>
177- <property name="border_width">6</property>
178- <property name="modal">True</property>
179- <property name="window_position">center-on-parent</property>
180- <property name="default_width">400</property>
181- <property name="type_hint">dialog</property>
182- <property name="skip_taskbar_hint">True</property>
183- <property name="skip_pager_hint">True</property>
184- <child>
185- <object class="GtkVBox" id="pane_fetch">
186- <property name="visible">True</property>
187- <property name="can_focus">False</property>
188- <property name="spacing">6</property>
189- <child>
190- <object class="GtkVBox" id="vbox7">
191- <property name="visible">True</property>
192- <property name="can_focus">False</property>
193- <property name="border_width">6</property>
194- <property name="spacing">12</property>
195- <child>
196- <object class="GtkLabel" id="label_fetch_summary">
197- <property name="visible">True</property>
198- <property name="can_focus">False</property>
199- <property name="xalign">0</property>
200- <property name="use_markup">True</property>
201- <property name="wrap">True</property>
202- </object>
203- <packing>
204- <property name="expand">False</property>
205- <property name="fill">False</property>
206- <property name="position">0</property>
207- </packing>
208- </child>
209- <child>
210- <object class="GtkVBox" id="vbox8">
211- <property name="visible">True</property>
212- <property name="can_focus">False</property>
213- <property name="spacing">6</property>
214- <child>
215- <object class="GtkProgressBar" id="progressbar_fetch">
216- <property name="visible">True</property>
217- <property name="can_focus">False</property>
218- <property name="pulse_step">0.10000000149</property>
219- </object>
220- <packing>
221- <property name="expand">True</property>
222- <property name="fill">False</property>
223- <property name="position">0</property>
224- </packing>
225- </child>
226- <child>
227- <object class="GtkLabel" id="label_fetch_status">
228- <property name="visible">True</property>
229- <property name="can_focus">False</property>
230- <property name="xalign">0</property>
231- </object>
232- <packing>
233- <property name="expand">False</property>
234- <property name="fill">False</property>
235- <property name="position">1</property>
236- </packing>
237- </child>
238- </object>
239- <packing>
240- <property name="expand">False</property>
241- <property name="fill">False</property>
242- <property name="position">1</property>
243- </packing>
244- </child>
245- <child>
246- <object class="GtkExpander" id="expander1">
247- <property name="can_focus">True</property>
248- <property name="spacing">6</property>
249- <child>
250- <object class="GtkVBox" id="vbox9">
251- <property name="visible">True</property>
252- <property name="can_focus">False</property>
253- <property name="spacing">6</property>
254- <child>
255- <object class="GtkScrolledWindow" id="scrolledwindow6">
256- <property name="height_request">200</property>
257- <property name="visible">True</property>
258- <property name="can_focus">True</property>
259- <property name="shadow_type">in</property>
260- <child>
261- <object class="GtkTreeView" id="treeview1">
262- <property name="visible">True</property>
263- <property name="can_focus">True</property>
264- <property name="enable_search">False</property>
265- <child internal-child="selection">
266- <object class="GtkTreeSelection" id="treeview-selection"/>
267- </child>
268- </object>
269- </child>
270- </object>
271- <packing>
272- <property name="expand">True</property>
273- <property name="fill">True</property>
274- <property name="position">0</property>
275- </packing>
276- </child>
277- </object>
278- </child>
279- <child type="label">
280- <object class="GtkLabel" id="label19">
281- <property name="visible">True</property>
282- <property name="can_focus">False</property>
283- <property name="label" translatable="yes">Show progress of individual files</property>
284- </object>
285- </child>
286- </object>
287- <packing>
288- <property name="expand">True</property>
289- <property name="fill">True</property>
290- <property name="position">2</property>
291- </packing>
292- </child>
293- </object>
294- <packing>
295- <property name="expand">True</property>
296- <property name="fill">True</property>
297- <property name="position">0</property>
298- </packing>
299- </child>
300- <child>
301- <object class="GtkHButtonBox" id="hbuttonbox7">
302- <property name="visible">True</property>
303- <property name="can_focus">False</property>
304- <property name="layout_style">end</property>
305- <child>
306- <object class="GtkButton" id="button_fetch_cancel">
307- <property name="label">gtk-cancel</property>
308- <property name="use_action_appearance">False</property>
309- <property name="visible">True</property>
310- <property name="can_focus">True</property>
311- <property name="receives_default">True</property>
312- <property name="border_width">5</property>
313- <property name="use_action_appearance">False</property>
314- <property name="use_stock">True</property>
315- </object>
316- <packing>
317- <property name="expand">False</property>
318- <property name="fill">False</property>
319- <property name="position">0</property>
320- </packing>
321- </child>
322- </object>
323- <packing>
324- <property name="expand">False</property>
325- <property name="fill">True</property>
326- <property name="position">1</property>
327- </packing>
328- </child>
329- </object>
330- </child>
331- </object>
332-</interface>
333
334=== modified file 'debian/control'
335--- debian/control 2012-06-28 16:15:24 +0000
336+++ debian/control 2012-06-28 19:34:26 +0000
337@@ -50,7 +50,7 @@
338 Depends: ${python3:Depends}, ${misc:Depends},
339 update-manager-core (= ${source:Version}),
340 python3-aptdaemon.gtk3widgets (>= 0.40) | synaptic,
341- gksu,
342+ policykit-1,
343 python3-dbus,
344 python3-gi,
345 gir1.2-vte-2.90,
346
347=== modified file 'debian/update-manager.install'
348--- debian/update-manager.install 2012-06-28 16:15:24 +0000
349+++ debian/update-manager.install 2012-06-28 19:34:26 +0000
350@@ -8,7 +8,6 @@
351 debian/tmp/usr/share/applications/update-manager.desktop
352 debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/ChangelogViewer.py
353 debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/Dialogs.py
354-debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/GtkProgress.py
355 debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/InstallProgress.py
356 debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/MetaReleaseGObject.py
357 debian/tmp/usr/lib/python3*/dist-packages/UpdateManager/UpdateManager.py
358
359=== modified file 'po/POTFILES.in'
360--- po/POTFILES.in 2012-06-28 16:15:24 +0000
361+++ po/POTFILES.in 2012-06-28 19:34:26 +0000
362@@ -3,7 +3,6 @@
363 UpdateManager/ChangelogViewer.py
364 UpdateManager/MetaReleaseGObject.py
365 UpdateManager/Dialogs.py
366-UpdateManager/GtkProgress.py
367 UpdateManager/InstallProgress.py
368 UpdateManager/UpdateManager.py
369 UpdateManager/UpdateProgress.py
370@@ -14,7 +13,6 @@
371 UpdateManager/Core/UpdateList.py
372 UpdateManager/Core/MetaRelease.py
373 UpdateManager/Core/utils.py
374-[type: gettext/glade]data/gtkbuilder/AcquireProgress.ui
375 [type: gettext/glade]data/gtkbuilder/Dialog.ui
376 [type: gettext/glade]data/gtkbuilder/UpdateManager.ui
377 [type: gettext/glade]data/gtkbuilder/UpdateProgress.ui
378
379=== modified file 'update-manager'
380--- update-manager 2012-06-25 15:38:35 +0000
381+++ update-manager 2012-06-28 19:34:26 +0000
382@@ -88,9 +88,6 @@
383 # input focus control when it is displayed for the
384 # first time (see also the gtk devhelp page)
385 help=_("Do not focus on map when starting"))
386- parser.add_option ("--dist-upgrade", action="store_true",
387- dest="dist_upgrade", default=False,
388- help=_("Try to run a dist-upgrade"))
389 parser.add_option ("--no-update", action="store_true",
390 dest="no_update", default=False,
391 help=_("Do not check for updates when starting"))
392@@ -109,23 +106,11 @@
393 print("%s: version %s" % (os.path.basename(sys.argv[0]), VERSION))
394 sys.exit(0)
395
396- if options.dist_upgrade == True:
397- #import logging
398- #logging.basicConfig(level=logging.DEBUG)
399- from DistUpgrade.DistUpgradeViewGtk3 import DistUpgradeViewGtk3
400- from DistUpgrade.DistUpgradeController import DistUpgradeController
401- # FIXME: Having a "partial upgrade" view here would make it possible
402- # to get rid of the ugly hideStep() stuff
403- view = DistUpgradeViewGtk3(data_dir)
404- view.label_title.set_markup("<b><big>%s</big></b>" % _("Running partial upgrade"))
405- controller = DistUpgradeController(view, datadir=data_dir)
406- controller.doPartialUpgrade()
407- else:
408- # keep track when we run (for update-notifier)
409- settings = Gio.Settings("com.ubuntu.update-manager")
410- settings.set_int("launch-time", int(time.time()))
411- init_proxy(settings)
412+ # keep track when we run (for update-notifier)
413+ settings = Gio.Settings("com.ubuntu.update-manager")
414+ settings.set_int("launch-time", int(time.time()))
415+ init_proxy(settings)
416
417- app = UpdateManager(data_dir, options)
418- app.start_update()
419- Gtk.main()
420+ app = UpdateManager(data_dir, options)
421+ app.start_update()
422+ Gtk.main()

Subscribers

People subscribed via source and target branches

to status/vote changes: