diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-03-09 13:25:10 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-03-09 13:25:10 +0000 |
| commit | e2d599df4c4375fb90289d4d038c2575361a3b20 (patch) | |
| tree | df812b086f4fb9edc0db6cdda14a1ea59aed0b8b /python | |
| parent | c0b6c9e6812970ac952593abf3d6b4d810b06c9d (diff) | |
| download | python-apt-e2d599df4c4375fb90289d4d038c2575361a3b20.tar.gz | |
* 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
Diffstat (limited to 'python')
| -rw-r--r-- | python/depcache.cc | 22 |
1 files changed, 20 insertions, 2 deletions
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)"}, |
