Merge lp:~glatzor/software-center/force-bad-quality into lp:software-center

Proposed by Sebastian Heinlein
Status: Merged
Merged at revision: 1710
Proposed branch: lp:~glatzor/software-center/force-bad-quality
Merge into: lp:software-center
Diff against target: 117 lines (+38/-7) (has conflicts)
2 files modified
softwarecenter/backend/aptd.py (+31/-4)
softwarecenter/view/dialogs.py (+7/-3)
Text conflict in softwarecenter/backend/aptd.py
To merge this branch: bzr merge lp:~glatzor/software-center/force-bad-quality
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+57669@code.launchpad.net
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/aptd.py'
2--- softwarecenter/backend/aptd.py 2011-04-13 20:42:50 +0000
3+++ softwarecenter/backend/aptd.py 2011-04-14 12:24:34 +0000
4@@ -209,7 +209,7 @@
5 yield self.remove(pkgname, appname, iconname, metadata)
6
7 @inline_callbacks
8- def install(self, pkgname, appname, iconname, filename=None, addons_install=[], addons_remove=[], metadata=None):
9+ def install(self, pkgname, appname, iconname, filename=None, addons_install=[], addons_remove=[], metadata=None, force=False):
10 """Install a single package from the archive
11 If filename is given a local deb package is installed instead.
12 """
13@@ -217,8 +217,9 @@
14 if filename:
15 # force means on lintian failure
16 trans = yield self.aptd_client.install_file(
17- filename, force=False, defer=True)
18+ filename, force=force, defer=True)
19 self.emit("transaction-started", pkgname, appname, trans.tid, TRANSACTION_TYPE_INSTALL)
20+ yield trans.set_meta_data(sc_filename=filename, defer=True)
21 else:
22 install = [pkgname] + addons_install
23 remove = addons_remove
24@@ -567,7 +568,8 @@
25 except KeyError:
26 pass
27
28- def _show_transaction_failed_dialog(self, trans, enum):
29+ def _show_transaction_failed_dialog(self, trans, enum,
30+ alternative_action=None):
31 # daemon died are messages that result from broken
32 # cancel handling in aptdaemon (LP: #440941)
33 # FIXME: this is not a proper fix, just a workaround
34@@ -580,6 +582,7 @@
35 enums.get_error_description_from_enum(trans.error_code),
36 trans.error_details)
37 self._logger.error("error in _on_trans_finished '%s'" % msg)
38+<<<<<<< TREE
39 # show dialog to the user and exit (no need to reopen the cache)
40 if not trans.error_code:
41 # sometimes aptdaemon doesn't return a value for error_code when the network
42@@ -597,15 +600,39 @@
43 dialog_primary,
44 dialog_secondary,
45 dialog_details)
46+=======
47+ # show dialog to the user and exit (no need to reopen
48+ # the cache)
49+ return dialogs.error(None,
50+ enums.get_error_string_from_enum(trans.error_code),
51+ enums.get_error_description_from_enum(trans.error_code),
52+ trans.error_details,
53+ alternative_action)
54+>>>>>>> MERGE-SOURCE
55
56 def _on_trans_finished(self, trans, enum):
57 """callback when a aptdaemon transaction finished"""
58 self._logger.debug("_on_transaction_finished: %s %s %s" % (
59 trans, enum, trans.meta_data))
60
61+
62 # show error
63 if enum == enums.EXIT_FAILED:
64- if not "sc_add_repo_and_install_ignore_errors" in trans.meta_data:
65+ # Handle invalid packages separately
66+ if trans.error.code == enums.ERROR_INVALID_PACKAGE_FILE:
67+ action = _("_Ignore and install")
68+ res = self._show_transaction_failed_dialog(trans, enum, action)
69+ if res == gtk.RESPONSE_YES:
70+ # Reinject the transaction
71+ meta_copy = trans.meta_data.copy()
72+ pkgname = meta_copy.pop("sc_pkgname")
73+ appname = meta_copy.pop("sc_appname", None)
74+ iconname = meta_copy.pop("sc_iconname", None)
75+ filename = meta_copy.pop("sc_filename")
76+ self.install(pkgname, appname, iconname, filename, [], [],
77+ metadata=meta_copy, force=True)
78+ return
79+ elif not "sc_add_repo_and_install_ignore_errors" in trans.meta_data:
80 self._show_transaction_failed_dialog(trans, enum)
81
82 # send finished signal, use "" here instead of None, because
83
84=== modified file 'softwarecenter/view/dialogs.py'
85--- softwarecenter/view/dialogs.py 2011-01-29 05:55:04 +0000
86+++ softwarecenter/view/dialogs.py 2011-04-14 12:24:34 +0000
87@@ -82,23 +82,27 @@
88 secondary=None,
89 details=None,
90 buttons=gtk.BUTTONS_OK,
91- type=gtk.MESSAGE_INFO):
92+ type=gtk.MESSAGE_INFO,
93+ alternative_action=None):
94 """ run a dialog """
95 dialog = DetailsMessageDialog(parent=parent, title=title,
96 primary=primary, secondary=secondary,
97 details=details, type=type,
98 buttons=buttons)
99+ if alternative_action:
100+ dialog.add_button(alternative_action, gtk.RESPONSE_YES)
101 result = dialog.run()
102 dialog.destroy()
103 return result
104
105-def error(parent, primary, secondary, details=None):
106+def error(parent, primary, secondary, details=None, alternative_action=None):
107 """ show a untitled error dialog """
108 return messagedialog(parent=parent,
109 primary=primary,
110 secondary=secondary,
111 details=details,
112- type=gtk.MESSAGE_ERROR)
113+ type=gtk.MESSAGE_ERROR,
114+ alternative_action=alternative_action)
115
116
117 class FullsizeScreenshotDialog(gtk.Dialog):