Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/jarabe/model
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@member.fsf.org>2009-08-28 11:37:35 (GMT)
committer Aleksey Lim <alsroot@member.fsf.org>2009-08-28 11:37:35 (GMT)
commit5b6061946af68b03e00de0fd6617c5c8ceb56715 (patch)
tree0003866463c1bfc3657da9d327873dcc9584fe6c /src/jarabe/model
parent505b05d183fc478181a85480fb539e804f4cac3b (diff)
Let user upgrade system activity from .xo #701
Diffstat (limited to 'src/jarabe/model')
-rw-r--r--src/jarabe/model/bundleregistry.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/jarabe/model/bundleregistry.py b/src/jarabe/model/bundleregistry.py
index 1d23f0c..b754952 100644
--- a/src/jarabe/model/bundleregistry.py
+++ b/src/jarabe/model/bundleregistry.py
@@ -219,8 +219,17 @@ class BundleRegistry(gobject.GObject):
logging.exception('Error loading bundle %r', bundle_path)
return None
- if self.get_bundle(bundle.get_bundle_id()):
- return None
+ bundle_id = bundle.get_bundle_id()
+ installed = self.get_bundle(bundle_id)
+
+ if installed is not None:
+ if installed.get_activity_version() >= \
+ bundle.get_activity_version():
+ logging.debug('Skip old version for %s', bundle_id)
+ return None
+ else:
+ logging.debug('Upgrade %s', bundle_id)
+ self.remove_bundle(installed.get_path())
self._bundles.append(bundle)
return bundle
@@ -367,14 +376,15 @@ class BundleRegistry(gobject.GObject):
act.get_activity_version() != bundle.get_activity_version():
logging.warning('Not uninstalling, different bundle present')
return
- elif not act.get_path().startswith(env.get_user_activities_path()):
- logging.warning('Not uninstalling system activity')
+
+ if not act.is_user_activity():
+ logging.debug('Do not uninstall system activity')
return
install_path = act.get_path()
bundle.uninstall(install_path, force)
-
+
if not self.remove_bundle(install_path):
raise RegistrationException
@@ -385,7 +395,7 @@ class BundleRegistry(gobject.GObject):
elif act.get_activity_version() == bundle.get_activity_version():
logging.debug('No upgrade needed, same version already installed.')
return
- elif act.get_path().startswith(env.get_user_activities_path()):
+ elif act.is_user_activity():
try:
self.uninstall(bundle, force=True)
except Exception: