From b68dac19b1e85b0a5765ab80b95baa408f9dc8f8 Mon Sep 17 00:00:00 2001
From: Aleksey Lim <alsroot@member.fsf.org>
Date: Mon, 6 Apr 2009 11:01:55 +0000
Subject: Let user upgrade system activity from .xo #701
---
src/jarabe/model/bundleregistry.py | 24 +++++++++++++++++-------
1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index d23d5cb..29f0733 100644
a
|
b
|
class BundleRegistry(gobject.GObject): |
210 | 210 | ''.join(traceback.format_exception(*sys.exc_info())))) |
211 | 211 | return None |
212 | 212 | |
213 | | if self.is_installed(bundle): |
214 | | return None |
| 213 | installed = self.get_bundle(bundle.get_bundle_id()) |
| 214 | |
| 215 | if installed: |
| 216 | if installed.get_activity_version() >= \ |
| 217 | bundle.get_activity_version(): |
| 218 | logging.debug('STARTUP: Skip old version for %s' % \ |
| 219 | bundle.get_bundle_id()) |
| 220 | return installed |
| 221 | else: |
| 222 | logging.debug('STARTUP: Re-using newest activity %s' % \ |
| 223 | bundle.get_bundle_id()) |
| 224 | self.remove_bundle(bundle_path) |
215 | 225 | |
216 | 226 | self._bundles.append(bundle) |
217 | 227 | return bundle |
… |
… |
class BundleRegistry(gobject.GObject): |
357 | 367 | act.get_activity_version() != bundle.get_activity_version(): |
358 | 368 | logging.warning('Not uninstalling, different bundle present') |
359 | 369 | return |
360 | | elif not act.get_path().startswith(env.get_user_activities_path()): |
361 | | logging.warning('Not uninstalling system activity') |
362 | | return |
363 | 370 | |
364 | 371 | install_path = act.get_path() |
365 | 372 | |
366 | | bundle.uninstall(install_path, force) |
367 | | |
| 373 | if not install_path.startswith(env.get_user_activities_path()): |
| 374 | logging.warning('Not uninstalling system activity') |
| 375 | else: |
| 376 | bundle.uninstall(install_path, force) |
| 377 | |
368 | 378 | if not self.remove_bundle(install_path): |
369 | 379 | raise RegistrationException |
370 | 380 | |