summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 13:25:10 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-03-09 13:25:10 +0000
commite2d599df4c4375fb90289d4d038c2575361a3b20 (patch)
treedf812b086f4fb9edc0db6cdda14a1ea59aed0b8b /doc/examples
parentc0b6c9e6812970ac952593abf3d6b4d810b06c9d (diff)
downloadpython-apt-e2d599df4c4375fb90289d4d038c2575361a3b20.tar.gz
* star-merged with my pkgDepCache branch
Patches applied: * michael.vogt@ubuntu.com--2005/python-apt--pkgDepCache--0--patch-8 * merged with matt again, implemented DepCache.ReadPinFile(), fixed a bug in DepCache.Upgrade() * michael.vogt@ubuntu.com--2005/python-apt--pkgDepCache--0--patch-9 * added ReadPinFile to the depcache example code, added a comment to checkstate that there is also depcache that honors the default policy
Diffstat (limited to 'doc/examples')
-rwxr-xr-xdoc/examples/checkstate.py5
-rw-r--r--doc/examples/depcache.py6
2 files changed, 11 insertions, 0 deletions
diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py
index a0bdb6e7..2986872f 100755
--- a/doc/examples/checkstate.py
+++ b/doc/examples/checkstate.py
@@ -1,4 +1,9 @@
#!/usr/bin/python
+#
+#
+# this example is not usefull to find out about updated, upgradable packages
+# use the depcache.py example for it (because a pkgPolicy is not used here)
+#
import apt_pkg
apt_pkg.init()
diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py
index 92416b3e..a5ecc240 100644
--- a/doc/examples/depcache.py
+++ b/doc/examples/depcache.py
@@ -13,6 +13,7 @@ print "example package iter: %s" % iter
# get depcache
depcache = apt_pkg.GetDepCache(cache)
+depcache.ReadPinFile()
print "got a depcache: %s " % depcache
print "Marked for install: %s " % depcache.InstCount
@@ -66,6 +67,11 @@ print "Delete: %s " % depcache.DelCount
print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize)
print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize)
+for pkg in cache.Packages:
+ if pkg.CurrentVer != None and not depcache.MarkedInstall(pkg) and depcache.IsUpgradable(pkg):
+ print "Upgrade didn't upgrade (kept): %s" % pkg.Name
+
+
print "\nPerforming DistUpgrade"
depcache.Upgrade(True)
print "Keep: %s " % depcache.KeepCount