Merge lp:~glatzor/software-center/fix-659438 into lp:software-center

Proposed by Sebastian Heinlein
Status: Merged
Merged at revision: 2951
Proposed branch: lp:~glatzor/software-center/fix-659438
Merge into: lp:software-center
Diff against target: 38 lines (+21/-0)
1 file modified
softwarecenter/backend/installbackend_impl/aptd.py (+21/-0)
To merge this branch: bzr merge lp:~glatzor/software-center/fix-659438
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+101201@code.launchpad.net

Description of the change

Allow to recover from an incomplete installation

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/installbackend_impl/aptd.py'
2--- softwarecenter/backend/installbackend_impl/aptd.py 2012-03-16 20:12:57 +0000
3+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-04-08 11:46:19 +0000
4@@ -245,6 +245,16 @@
5 except Exception as error:
6 self._on_trans_error(error)
7
8+ @inline_callbacks
9+ def fix_incomplete_install(self):
10+ try:
11+ trans = yield self.aptd_client.fix_incomplete_install(defer=True)
12+ self.emit("transaction-started", "", "", trans.tid,
13+ TransactionTypes.REPAIR)
14+ yield self._run_transaction(trans, None, None, None)
15+ except Exception as error:
16+ self._on_trans_error(error)
17+
18 # FIXME: upgrade add-ons here
19 @inline_callbacks
20 def upgrade(self, app, iconname, addons_install=[], addons_remove=[],
21@@ -845,6 +855,17 @@
22 self.install(app, iconname, filename, [], [],
23 metadata=meta_copy)
24 return
25+ # Finish a cancelled installation before resuming. If the
26+ # user e.g. rebooted during a debconf question apt
27+ # will hang and the user is required to call
28+ # dpkg --configure -a, see LP#659438
29+ elif trans.error.code == enums.ERROR_INCOMPLETE_INSTALL:
30+ action = _("Repair")
31+ res = self._show_transaction_failed_dialog(trans, enum,
32+ action)
33+ if res == "yes":
34+ self.fix_incomplete_install()
35+ return
36
37 elif (not "sc_add_repo_and_install_ignore_errors" in
38 trans.meta_data):