[Sugar-devel] [PATCH] Delete activities profile data when uninstall
Martin Abente
mabente at paraguayeduca.org
Mon Jul 5 17:27:33 EDT 2010
On Mon, 2010-07-05 at 20:19 +0000, Sascha Silbe wrote:
> Excerpts from Martin Abente's message of Mon Jul 05 19:49:10 +0000 2010:
>
> [src/sugar/bundle/activitybundle.py]
> > @@ -417,6 +418,10 @@ class ActivityBundle(Bundle):
> [...]
> > + profile_path = env.get_profile_path(self._bundle_id)
> > + if os.path.exists(profile_path):
> > + shutil.rmtree(profile_path)
> > +
> If the directory contains files or directories with mode 000 (unusual, but
> possible) or owned by somebody else (e.g. root) this will fail and throw
> an exception.
> You could use os.walk() + os.chmod() to handle the 000 case, though I'm
> unsure whether it's worth the effort. Passing ignore_errors=True to
> rmtree() to avoid breaking for any other reason is certainly a good idea,
> though. If you want to check whether rmtree() was successful, just check
> if profile_path still exists.
>
Thanks for help, I also found a problem with the patch...
When the user upgrades an activity, the older version is being deleted,
and so will be the profile data. That could be a problem.
Any suggestions?
I was thinking about a new parameter to the uninstall ActivityBundle
method, something like: reason_upgrade=False. So it wont delete the
profile directory in those cases.
This solution will also require to add the same parameter to
bundleregistry uninstall method.
> Sascha
>
> --
> http://sascha.silbe.org/
> http://www.infra-silbe.de/
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
More information about the Sugar-devel
mailing list