From 2021c1b4973c3201b1e4580d00b7351c23a831c4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Jan 2012 15:25:37 +0100 Subject: RED: policy should support verfile --- python/cache.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'python/cache.cc') diff --git a/python/cache.cc b/python/cache.cc index b263d320..191e2204 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -229,6 +229,12 @@ static PyObject *PkgCacheGetGroups(PyObject *Self, void*) { return CppPyObject_NEW(Self,&PyGroupList_Type,Cache->GrpBegin()); } +static PyObject *PkgCacheGetPolicy(PyObject *Self, void*) { + pkgCacheFile *CacheFile = GetCpp(Self); + std::cerr << "policy: " << CacheFile->Policy << std::endl; + return CppPyObject_NEW(Self,&PyPolicy_Type,CacheFile->Policy); +} + static PyObject *PkgCacheGetPackages(PyObject *Self, void*) { pkgCache *Cache = GetCpp(Self); return CppPyObject_NEW(Self,&PyPackageList_Type,Cache->PkgBegin()); @@ -289,6 +295,7 @@ static PyGetSetDef PkgCacheGetSet[] = { {"group_count",PkgCacheGetGroupCount,0, "The number of apt_pkg.Group objects stored in the cache."}, {"groups", PkgCacheGetGroups, 0, "A list of Group objects in the cache"}, + {"policy", PkgCacheGetPolicy, 0, "The PkgPolicy for the cache"}, {"is_multi_arch", PkgCacheGetIsMultiArch, 0, "Whether the cache supports multi-arch."}, {"package_count",PkgCacheGetPackageCount,0, -- cgit v1.2.3 From 72b1f8e86e203df1d8bfef41c71d228ee21e9d99 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 17 Apr 2012 14:10:22 +0200 Subject: * python/cache.cc: - ensure that pkgApplyStatus is called when the cache is opened (thanks to Sebastian Heinlein for finding this bug), LP: #659438 --- debian/changelog | 8 ++++++++ python/cache.cc | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'python/cache.cc') diff --git a/debian/changelog b/debian/changelog index c1b12cc8..63f72fa5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-apt (0.8.5) UNRELEASED; urgency=low + + * python/cache.cc: + - ensure that pkgApplyStatus is called when the cache is opened + (thanks to Sebastian Heinlein for finding this bug), LP: #659438 + + -- Michael Vogt Tue, 17 Apr 2012 14:09:24 +0200 + python-apt (0.8.4) unstable; urgency=low [ Michael Vogt ] diff --git a/python/cache.cc b/python/cache.cc index 191e2204..52ce32e3 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -197,12 +197,14 @@ static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args) return HandleErrors(); } + // ensure that the states are correct (LP: #659438) + pkgApplyStatus(*Cache); + //std::cout << "new cache is " << (pkgCache*)(*Cache) << std::endl; // update the cache pointer after the cache was rebuild ((CppPyObject *)Self)->Object = (pkgCache*)(*Cache); - Py_INCREF(Py_None); return HandleErrors(Py_None); } -- cgit v1.2.3