From e2d599df4c4375fb90289d4d038c2575361a3b20 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 9 Mar 2005 13:25:10 +0000 Subject: * 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 --- python/depcache.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'python') 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(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(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(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)"}, -- cgit v1.2.3