summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-06-21 07:55:26 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-06-21 07:55:26 +0000
commit3d753adb67f8107e24f8c3f00d070e9bdd507167 (patch)
tree5a698e0fe5e38450a451e13a5cb20a95c593f2d8 /apt
parentc25600f6cfb209dde14fbfc17aaef78519411a30 (diff)
downloadpython-apt-3d753adb67f8107e24f8c3f00d070e9bdd507167.tar.gz
* use the pkgProblemResolver on remove as well if needed, added a test for it
Diffstat (limited to 'apt')
-rw-r--r--apt/package.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/apt/package.py b/apt/package.py
index 806cb0c3..0ee6aff8 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -125,9 +125,17 @@ class Package(object):
self._pcache.CachePreChange()
self._depcache.MarkKeep(self._pkg)
self._pcache.CachePostChange()
- def MarkDelete(self):
+ def MarkDelete(self, autoFix=True):
self._pcache.CachePreChange()
self._depcache.MarkDelete(self._pkg)
+ # try to fix broken stuffsta
+ if autoFix and self._depcache.BrokenCount > 0:
+ Fix = apt_pkg.GetPkgProblemResolver(self._depcache)
+ Fix.Clear(self._pkg)
+ Fix.Protect(self._pkg)
+ Fix.Remove(self._pkg)
+ Fix.InstallProtect()
+ Fix.Resolve()
self._pcache.CachePostChange()
def MarkInstall(self, autoFix=True):
self._pcache.CachePreChange()
@@ -185,3 +193,4 @@ if __name__ == "__main__":
print "Description (formated) :\n%s" % pkg.Description(True)
print "InstalledSize: %s " % pkg.InstalledSize()
print "PackageSize: %s " % pkg.PackageSize()
+