From a0596d73510acae4749480c209e0f318852fc83f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 1 Jun 2005 13:10:55 +0000 Subject: * Cache.GetChanges() added, support for Marked{Downgrade,Reinstall} tests added --- python/depcache.cc | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'python') 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(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); + pkgDepCache::StateCache &state = (*depcache)[Pkg]; + + return HandleErrors(Py_BuildValue("b",state.Downgrade())); +} + +static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp(Self); + + PyObject *PackageObj; + if (PyArg_ParseTuple(Args,"O!",&PackageType,&PackageObj) == 0) + return 0; + + pkgCache::PkgIterator &Pkg = GetCpp(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"}, -- cgit v1.2.3