Merge lp:~mvo/software-center/lp1063595 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3228
Proposed branch: lp:~mvo/software-center/lp1063595
Merge into: lp:software-center
Diff against target: 92 lines (+11/-1)
1 file modified
softwarecenter/backend/installbackend_impl/aptd.py (+11/-1)
To merge this branch: bzr merge lp:~mvo/software-center/lp1063595
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+128435@code.launchpad.net

Description of the change

Add a bunch of missing trans vars to ensure that _on_trans_error() is
always called with valid parameters and not crashing with unbound local
errors.

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/installbackend_impl/aptd.py'
--- softwarecenter/backend/installbackend_impl/aptd.py 2012-10-05 08:39:29 +0000
+++ softwarecenter/backend/installbackend_impl/aptd.py 2012-10-08 08:11:21 +0000
@@ -260,6 +260,7 @@
260260
261 @inline_callbacks261 @inline_callbacks
262 def fix_broken_depends(self):262 def fix_broken_depends(self):
263 trans = None
263 try:264 try:
264 trans = yield self.aptd_client.fix_broken_depends(defer=True)265 trans = yield self.aptd_client.fix_broken_depends(defer=True)
265 self.emit("transaction-started", "", "", trans.tid,266 self.emit("transaction-started", "", "", trans.tid,
@@ -270,6 +271,7 @@
270271
271 @inline_callbacks272 @inline_callbacks
272 def fix_incomplete_install(self):273 def fix_incomplete_install(self):
274 trans = None
273 try:275 try:
274 trans = yield self.aptd_client.fix_incomplete_install(defer=True)276 trans = yield self.aptd_client.fix_incomplete_install(defer=True)
275 self.emit("transaction-started", "", "", trans.tid,277 self.emit("transaction-started", "", "", trans.tid,
@@ -285,6 +287,7 @@
285 """ upgrade a single package """287 """ upgrade a single package """
286 pkgname = app.pkgname288 pkgname = app.pkgname
287 appname = app.appname289 appname = app.appname
290 trans = None
288 try:291 try:
289 trans = yield self.aptd_client.upgrade_packages([pkgname],292 trans = yield self.aptd_client.upgrade_packages([pkgname],
290 defer=True)293 defer=True)
@@ -327,6 +330,7 @@
327 """ remove a single package """330 """ remove a single package """
328 pkgname = app.pkgname331 pkgname = app.pkgname
329 appname = app.appname332 appname = app.appname
333 trans = None
330 try:334 try:
331 trans = yield self.aptd_client.remove_packages([pkgname],335 trans = yield self.aptd_client.remove_packages([pkgname],
332 defer=True)336 defer=True)
@@ -399,6 +403,7 @@
399 """ install and remove add-ons """403 """ install and remove add-ons """
400 pkgname = app.pkgname404 pkgname = app.pkgname
401 appname = app.appname405 appname = app.appname
406 trans = None
402 try:407 try:
403 install = addons_install408 install = addons_install
404 remove = addons_remove409 remove = addons_remove
@@ -421,6 +426,7 @@
421 # aptsources will just enable it instead of adding a extra426 # aptsources will just enable it instead of adding a extra
422 # sources.list.d file (LP: #666956)427 # sources.list.d file (LP: #666956)
423 d = apt_pkg.config.find_dir("Dir::Etc::sourceparts")428 d = apt_pkg.config.find_dir("Dir::Etc::sourceparts")
429 trans = None
424 if (not sources_list or430 if (not sources_list or
425 not os.path.exists(os.path.join(d, sources_list))):431 not os.path.exists(os.path.join(d, sources_list))):
426 sources_list = ""432 sources_list = ""
@@ -436,6 +442,7 @@
436 @inline_callbacks442 @inline_callbacks
437 def enable_component(self, component):443 def enable_component(self, component):
438 self._logger.debug("enable_component: %s" % component)444 self._logger.debug("enable_component: %s" % component)
445 trans = None
439 try:446 try:
440 trans = yield self.aptd_client.enable_distro_component(component)447 trans = yield self.aptd_client.enable_distro_component(component)
441 # don't use self._run_transaction() here, to avoid sending uneeded448 # don't use self._run_transaction() here, to avoid sending uneeded
@@ -449,6 +456,7 @@
449456
450 @inline_callbacks457 @inline_callbacks
451 def enable_channel(self, channelfile):458 def enable_channel(self, channelfile):
459 trans = None
452 # read channel file and add all relevant lines460 # read channel file and add all relevant lines
453 for line in open(channelfile):461 for line in open(channelfile):
454 line = line.strip()462 line = line.strip()
@@ -476,6 +484,7 @@
476 keyid = keyid.split("/")[1]484 keyid = keyid.split("/")[1]
477 if not keyid.startswith("0x"):485 if not keyid.startswith("0x"):
478 keyid = "0x%s" % keyid486 keyid = "0x%s" % keyid
487 trans = None
479 try:488 try:
480 trans = yield self.aptd_client.add_vendor_key_from_keyserver(489 trans = yield self.aptd_client.add_vendor_key_from_keyserver(
481 keyid, keyserver, defer=True)490 keyid, keyserver, defer=True)
@@ -497,6 +506,7 @@
497506
498 args = (entry.type, entry.uri, entry.dist, entry.comps,507 args = (entry.type, entry.uri, entry.dist, entry.comps,
499 "Added by software-center", sourcepart)508 "Added by software-center", sourcepart)
509 trans = None
500 try:510 try:
501 trans = yield self.aptd_client.add_repository(*args, defer=True)511 trans = yield self.aptd_client.add_repository(*args, defer=True)
502 yield self._run_transaction(trans, None, None, None)512 yield self._run_transaction(trans, None, None, None)
@@ -523,7 +533,7 @@
523 self._logger.debug(533 self._logger.debug(
524 "adding license_key for pkg '%s' of len: %i" % (534 "adding license_key for pkg '%s' of len: %i" % (
525 pkgname, len(license_key)))535 pkgname, len(license_key)))
526536 trans = None
527 # HOME based license keys537 # HOME based license keys
528 if license_key_path and license_key_path.startswith("~"):538 if license_key_path and license_key_path.startswith("~"):
529 # check if its inside HOME and if so, just create it539 # check if its inside HOME and if so, just create it

Subscribers

People subscribed via source and target branches