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
=== modified file 'softwarecenter/backend/aptd.py'
--- softwarecenter/backend/aptd.py 2011-04-13 20:42:50 +0000
+++ softwarecenter/backend/aptd.py 2011-04-14 12:24:34 +0000
@@ -209,7 +209,7 @@
209 yield self.remove(pkgname, appname, iconname, metadata)209 yield self.remove(pkgname, appname, iconname, metadata)
210210
211 @inline_callbacks211 @inline_callbacks
212 def install(self, pkgname, appname, iconname, filename=None, addons_install=[], addons_remove=[], metadata=None):212 def install(self, pkgname, appname, iconname, filename=None, addons_install=[], addons_remove=[], metadata=None, force=False):
213 """Install a single package from the archive213 """Install a single package from the archive
214 If filename is given a local deb package is installed instead.214 If filename is given a local deb package is installed instead.
215 """215 """
@@ -217,8 +217,9 @@
217 if filename:217 if filename:
218 # force means on lintian failure218 # force means on lintian failure
219 trans = yield self.aptd_client.install_file(219 trans = yield self.aptd_client.install_file(
220 filename, force=False, defer=True)220 filename, force=force, defer=True)
221 self.emit("transaction-started", pkgname, appname, trans.tid, TRANSACTION_TYPE_INSTALL)221 self.emit("transaction-started", pkgname, appname, trans.tid, TRANSACTION_TYPE_INSTALL)
222 yield trans.set_meta_data(sc_filename=filename, defer=True)
222 else:223 else:
223 install = [pkgname] + addons_install224 install = [pkgname] + addons_install
224 remove = addons_remove225 remove = addons_remove
@@ -567,7 +568,8 @@
567 except KeyError:568 except KeyError:
568 pass569 pass
569570
570 def _show_transaction_failed_dialog(self, trans, enum):571 def _show_transaction_failed_dialog(self, trans, enum,
572 alternative_action=None):
571 # daemon died are messages that result from broken573 # daemon died are messages that result from broken
572 # cancel handling in aptdaemon (LP: #440941)574 # cancel handling in aptdaemon (LP: #440941)
573 # FIXME: this is not a proper fix, just a workaround575 # FIXME: this is not a proper fix, just a workaround
@@ -580,6 +582,7 @@
580 enums.get_error_description_from_enum(trans.error_code),582 enums.get_error_description_from_enum(trans.error_code),
581 trans.error_details)583 trans.error_details)
582 self._logger.error("error in _on_trans_finished '%s'" % msg)584 self._logger.error("error in _on_trans_finished '%s'" % msg)
585<<<<<<< TREE
583 # show dialog to the user and exit (no need to reopen the cache)586 # show dialog to the user and exit (no need to reopen the cache)
584 if not trans.error_code:587 if not trans.error_code:
585 # sometimes aptdaemon doesn't return a value for error_code when the network588 # sometimes aptdaemon doesn't return a value for error_code when the network
@@ -597,15 +600,39 @@
597 dialog_primary,600 dialog_primary,
598 dialog_secondary,601 dialog_secondary,
599 dialog_details)602 dialog_details)
603=======
604 # show dialog to the user and exit (no need to reopen
605 # the cache)
606 return dialogs.error(None,
607 enums.get_error_string_from_enum(trans.error_code),
608 enums.get_error_description_from_enum(trans.error_code),
609 trans.error_details,
610 alternative_action)
611>>>>>>> MERGE-SOURCE
600612
601 def _on_trans_finished(self, trans, enum):613 def _on_trans_finished(self, trans, enum):
602 """callback when a aptdaemon transaction finished"""614 """callback when a aptdaemon transaction finished"""
603 self._logger.debug("_on_transaction_finished: %s %s %s" % (615 self._logger.debug("_on_transaction_finished: %s %s %s" % (
604 trans, enum, trans.meta_data))616 trans, enum, trans.meta_data))
605617
618
606 # show error619 # show error
607 if enum == enums.EXIT_FAILED:620 if enum == enums.EXIT_FAILED:
608 if not "sc_add_repo_and_install_ignore_errors" in trans.meta_data:621 # Handle invalid packages separately
622 if trans.error.code == enums.ERROR_INVALID_PACKAGE_FILE:
623 action = _("_Ignore and install")
624 res = self._show_transaction_failed_dialog(trans, enum, action)
625 if res == gtk.RESPONSE_YES:
626 # Reinject the transaction
627 meta_copy = trans.meta_data.copy()
628 pkgname = meta_copy.pop("sc_pkgname")
629 appname = meta_copy.pop("sc_appname", None)
630 iconname = meta_copy.pop("sc_iconname", None)
631 filename = meta_copy.pop("sc_filename")
632 self.install(pkgname, appname, iconname, filename, [], [],
633 metadata=meta_copy, force=True)
634 return
635 elif not "sc_add_repo_and_install_ignore_errors" in trans.meta_data:
609 self._show_transaction_failed_dialog(trans, enum)636 self._show_transaction_failed_dialog(trans, enum)
610637
611 # send finished signal, use "" here instead of None, because638 # send finished signal, use "" here instead of None, because
612639
=== modified file 'softwarecenter/view/dialogs.py'
--- softwarecenter/view/dialogs.py 2011-01-29 05:55:04 +0000
+++ softwarecenter/view/dialogs.py 2011-04-14 12:24:34 +0000
@@ -82,23 +82,27 @@
82 secondary=None, 82 secondary=None,
83 details=None,83 details=None,
84 buttons=gtk.BUTTONS_OK, 84 buttons=gtk.BUTTONS_OK,
85 type=gtk.MESSAGE_INFO):85 type=gtk.MESSAGE_INFO,
86 alternative_action=None):
86 """ run a dialog """87 """ run a dialog """
87 dialog = DetailsMessageDialog(parent=parent, title=title,88 dialog = DetailsMessageDialog(parent=parent, title=title,
88 primary=primary, secondary=secondary,89 primary=primary, secondary=secondary,
89 details=details, type=type, 90 details=details, type=type,
90 buttons=buttons)91 buttons=buttons)
92 if alternative_action:
93 dialog.add_button(alternative_action, gtk.RESPONSE_YES)
91 result = dialog.run()94 result = dialog.run()
92 dialog.destroy()95 dialog.destroy()
93 return result96 return result
9497
95def error(parent, primary, secondary, details=None):98def error(parent, primary, secondary, details=None, alternative_action=None):
96 """ show a untitled error dialog """99 """ show a untitled error dialog """
97 return messagedialog(parent=parent,100 return messagedialog(parent=parent,
98 primary=primary, 101 primary=primary,
99 secondary=secondary,102 secondary=secondary,
100 details=details,103 details=details,
101 type=gtk.MESSAGE_ERROR)104 type=gtk.MESSAGE_ERROR,
105 alternative_action=alternative_action)
102106
103107
104class FullsizeScreenshotDialog(gtk.Dialog):108class FullsizeScreenshotDialog(gtk.Dialog):