From 2ebdc239bc9fd606bb748abd1d7ad49bea9669a3 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Jan 2006 11:28:00 +0000 Subject: * added MinimizeUpgrade, Upgrade returns a bool now --- python/depcache.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'python') diff --git a/python/depcache.cc b/python/depcache.cc index 51c25080..0d2a16b5 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -233,15 +233,30 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args) if (PyArg_ParseTuple(Args,"|b",&distUpgrade) == 0) return 0; + bool res; if(distUpgrade) - pkgDistUpgrade(*depcache); + res = pkgDistUpgrade(*depcache); else - pkgAllUpgrade(*depcache); + res = pkgAllUpgrade(*depcache); Py_INCREF(Py_None); - return HandleErrors(Py_None); + return HandleErrors(Py_BuildValue("b",res)); +} + +static PyObject *PkgDepCacheMinimizeUpgrade(PyObject *Self,PyObject *Args) +{ + pkgDepCache *depcache = GetCpp(Self); + + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + + bool res = pkgMinimizeUpgrade(*depcache); + + Py_INCREF(Py_None); + return HandleErrors(Py_BuildValue("b",res)); } + static PyObject *PkgDepCacheReadPinFile(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp(Self); @@ -481,6 +496,7 @@ static PyMethodDef PkgDepCacheMethods[] = {"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"}, + {"MinimizeUpgrade",PkgDepCacheMinimizeUpgrade, METH_VARARGS,"Go over the entire set of packages and try to keep each package marked for upgrade. If a conflict is generated then the package is restored."}, // 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)"}, -- cgit v1.2.3