Ticket #701: sugar-701.2.patch

File sugar-701.2.patch, 2.1 KB (added by alsroot, 15 years ago)
  • src/jarabe/model/bundleregistry.py

    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): 
    210210                ''.join(traceback.format_exception(*sys.exc_info()))))
    211211            return None
    212212
    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)
    215225
    216226        self._bundles.append(bundle)
    217227        return bundle
    class BundleRegistry(gobject.GObject): 
    357367                act.get_activity_version() != bundle.get_activity_version():
    358368            logging.warning('Not uninstalling, different bundle present')
    359369            return
    360         elif not act.get_path().startswith(env.get_user_activities_path()):
    361             logging.warning('Not uninstalling system activity')
    362             return
    363370
    364371        install_path = act.get_path()
    365372
    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
    368378        if not self.remove_bundle(install_path):
    369379            raise RegistrationException
    370380