On Wed, Aug 19, 2009 at 05:00:12PM +0200, Sebastian Heinlein wrote: > Package: python-apt > Version: 0.7.12.1 > Severity: normal > > In PackageKit apt backend I use the problem resolver directly e.g. to make sure > that all given packages are installed which are queued for a transaction. > > Just calling apt.Packagek.mark_install for each package could unmark the > installation of a previous package during the resolver call (autoFix=True). > So I have to protect all the to be installed packages in the resolver. > > The factory apt_pkg.GetPkgProblemResolver requires the private _depcache of > an apt.Cache. Furthermore I need the IsInstBroken and IsNowBroken method for > a more detailed error reporting. > > It would be nice to habe a stable API for this. See the attached patch. This should probably do what you want. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
[0;33m=== modified file 'apt/__init__.py' [0m[1;31m--- apt/__init__.py 2009-04-01 14:27:15 +0000 [0m[1;34m+++ apt/__init__.py 2009-08-20 22:20:41 +0000 [0m[1;35m@@ -23,7 +23,7 @@ import os [0m[0;37m [0m[0;37m # import some fancy classes [0m[0;37m from apt.package import Package [0m[1;31m-from apt.cache import Cache [0m[1;34m+from apt.cache import Cache, ProblemResolver [0m[0;37m from apt.progress import ( [0m[0;37m OpProgress, FetchProgress, InstallProgress, CdromProgress) [0m[0;37m from apt.cdrom import Cdrom [0m[0;37m [0m[0;33m=== modified file 'apt/cache.py' [0m[1;31m--- apt/cache.py 2009-07-30 13:00:44 +0000 [0m[1;34m+++ apt/cache.py 2009-08-20 22:20:24 +0000 [0m[1;35m@@ -363,6 +363,30 @@ class Cache(object): [0m[0;37m return self._depcache.keep_count [0m[0;37m [0m[0;37m [0m[1;34m+class ProblemResolver(object): [0m[1;34m+ [0m[1;34m+ def __init__(self, cache): [0m[1;34m+ self._resolver = apt_pkg.GetPkgProblemResolver(cache._depcache) [0m[1;34m+ [0m[1;34m+ def clear(self, package): [0m[1;34m+ self._resolver.Clear(package._pkg) [0m[1;34m+ [0m[1;34m+ def install_protect(self): [0m[1;34m+ self._resolver.InstallProtect() [0m[1;34m+ [0m[1;34m+ def protect(self, package): [0m[1;34m+ self._resolver.Protect(package._pkg) [0m[1;34m+ [0m[1;34m+ def remove(self, package): [0m[1;34m+ self._resolver.Remove(package._pkg) [0m[1;34m+ [0m[1;34m+ def resolve(self): [0m[1;34m+ self._resolver.Resolve() [0m[1;34m+ [0m[1;34m+ def resolve_by_keep(self): [0m[1;34m+ self._resolver.ResolveByKeep() [0m[1;34m+ [0m[1;34m+ [0m[0;37m # ----------------------------- experimental interface [0m[0;37m [0m[0;37m [0m[0;37m [0m[0;33m=== modified file 'apt/package.py' [0m[1;31m--- apt/package.py 2009-08-20 21:14:19 +0000 [0m[1;34m+++ apt/package.py 2009-08-20 22:21:29 +0000 [0m[1;35m@@ -1008,6 +1008,14 @@ class Package(object): [0m[0;37m """ [0m[0;37m return VersionList(self) [0m[0;37m [0m[1;34m+ @property [0m[1;34m+ def is_inst_broken(self): [0m[1;34m+ return self._pcache._depcache.IsInstBroken(self._pkg) [0m[1;34m+ [0m[1;34m+ @property [0m[1;34m+ def is_now_broken(self): [0m[1;34m+ return self._pcache._depcache.IsNowBroken(self._pkg) [0m[1;34m+ [0m[0;37m # depcache actions [0m[0;37m [0m[0;37m def markKeep(self): [0m[0;37m [0m
Attachment:
pgpbyDT2IewW7.pgp
Description: PGP signature