summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog7
-rwxr-xr-xdoc/examples/checkstate.py5
-rw-r--r--doc/examples/depcache.py6
-rw-r--r--python/depcache.cc22
4 files changed, 38 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 69831041..c83d737a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+python-apt (0.5.37) hoary; urgency=low
+
+ * DepCache.ReadPinFile() added
+ * Fixed a bug in DepCache.Upgrade()
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Wed, 2 Mar 2005 11:32:15 +0100
+
python-apt (0.5.36) hoary; urgency=low
* Fix build-depends, somehow lost in merge
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
diff --git a/python/depcache.cc b/python/depcache.cc
index 81e73efb..ac779063 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -32,7 +32,7 @@ struct PkgDepCacheStruct
PkgDepCacheStruct(pkgCache *Cache) {
policy = new pkgPolicy(Cache);
- depcache = new pkgDepCache(Cache);
+ depcache = new pkgDepCache(Cache, policy);
}
virtual ~PkgDepCacheStruct() {
delete depcache;
@@ -73,7 +73,7 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args)
{
PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(Self);
- char *distUpgrade=0;
+ char distUpgrade=0;
if (PyArg_ParseTuple(Args,"|b",&distUpgrade) == 0)
return 0;
@@ -85,6 +85,23 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args)
return HandleErrors(Py_None);
}
+static PyObject *PkgDepCacheReadPinFile(PyObject *Self,PyObject *Args)
+{
+ PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(Self);
+
+ char *file=NULL;
+ if (PyArg_ParseTuple(Args,"|s",&file) == 0)
+ return 0;
+
+ if(file == NULL)
+ ReadPinFile(*Struct.policy);
+ else
+ ReadPinFile(*Struct.policy, file);
+
+ return HandleErrors(Py_None);
+}
+
+
static PyObject *PkgDepCacheFixBroken(PyObject *Self,PyObject *Args)
{
PkgDepCacheStruct &Struct = GetCpp<PkgDepCacheStruct>(Self);
@@ -247,6 +264,7 @@ static PyMethodDef PkgDepCacheMethods[] =
// global cache operations
{"Upgrade",PkgDepCacheUpgrade,METH_VARARGS,"Perform Upgrade (optional boolean argument if dist-upgrade should be performed)"},
{"FixBroken",PkgDepCacheFixBroken,METH_VARARGS,"Fix broken packages"},
+ {"ReadPinFile",PkgDepCacheReadPinFile,METH_VARARGS,"Read the pin policy"},
// Manipulators
{"MarkKeep",PkgDepCacheMarkKeep,METH_VARARGS,"Mark package for keep"},
{"MarkDelete",PkgDepCacheMarkDelete,METH_VARARGS,"Mark package for delete (optional boolean argument if it should be purged)"},