summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-06-01 13:10:55 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-06-01 13:10:55 +0000
commita0596d73510acae4749480c209e0f318852fc83f (patch)
tree8b699c3438f17547114172aa262da129e5b5ba2f /python
parente451655d9d837fcc5ade3d336012f2bb04700c56 (diff)
downloadpython-apt-a0596d73510acae4749480c209e0f318852fc83f.tar.gz
* Cache.GetChanges() added, support for Marked{Downgrade,Reinstall} tests added
Diffstat (limited to 'python')
-rw-r--r--python/depcache.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/python/depcache.cc b/python/depcache.cc
index 7ecdd508..b7ed98ac 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -403,6 +403,37 @@ static PyObject *PkgDepCacheMarkedKeep(PyObject *Self,PyObject *Args)
return HandleErrors(Py_BuildValue("b",state.Keep()));
}
+static PyObject *PkgDepCacheMarkedDowngrade(PyObject *Self,PyObject *Args)
+{
+ pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self);
+
+ PyObject *PackageObj;
+ if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0)
+ return 0;
+
+ pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
+ pkgDepCache::StateCache &state = (*depcache)[Pkg];
+
+ return HandleErrors(Py_BuildValue("b",state.Downgrade()));
+}
+
+static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args)
+{
+ pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self);
+
+ PyObject *PackageObj;
+ if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0)
+ return 0;
+
+ pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj);
+ pkgDepCache::StateCache &state = (*depcache)[Pkg];
+
+ bool res = state.Install() && (state.iFlags & pkgDepCache::ReInstall);
+
+ return HandleErrors(Py_BuildValue("b",res));
+}
+
+
static PyMethodDef PkgDepCacheMethods[] =
{
{"Init",PkgDepCacheInit,METH_VARARGS,"Init the depcache (done on construct automatically)"},
@@ -424,6 +455,8 @@ static PyMethodDef PkgDepCacheMethods[] =
{"MarkedUpgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"},
{"MarkedDelete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"},
{"MarkedKeep",PkgDepCacheMarkedKeep,METH_VARARGS,"Is pkg marked for keep"},
+ {"MarkedReinstall",PkgDepCacheMarkedReinstall,METH_VARARGS,"Is pkg marked for reinstall"},
+ {"MarkedDowngrade",PkgDepCacheMarkedDowngrade,METH_VARARGS,"Is pkg marked for downgrade"},
// Action
{"Commit", PkgDepCacheCommit, METH_VARARGS, "Commit pending changes"},