diff options
| -rw-r--r-- | debian/changelog | 4 | ||||
| -rw-r--r-- | debian/control | 2 | ||||
| -rw-r--r-- | python/depcache.cc | 30 |
3 files changed, 35 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog index 2d74f287..813144bb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,10 @@ python-apt (0.7.100.2) UNRELEASED; urgency=low * debian/python3-apt.install: - fix py3 extension module install location (thanks to Barry) + * python/depcache.cc: + - provide bindings for new libapt SetCandidateRelease() + * debian/control: + - require new libapt-pkg-dev SetCandidateRelease() -- Michael Vogt <mvo@debian.org> Tue, 07 Dec 2010 13:41:07 +0100 diff --git a/debian/control b/debian/control index bbfd652c..a84733d1 100644 --- a/debian/control +++ b/debian/control @@ -8,7 +8,7 @@ XS-Python-Version: >= 2.6 X-Python3-Version: >= 3.1 Build-Depends: apt-utils, debhelper (>= 7.3.5), - libapt-pkg-dev (>= 0.8), + libapt-pkg-dev (>= 0.8.11), python-all-dev (>= 2.6.6-3~), python-all-dbg, python3-all-dev (>= 3.1.2-10~), diff --git a/python/depcache.cc b/python/depcache.cc index cfa4f5d6..12c13a73 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -184,6 +184,30 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static PyObject *PkgDepCacheSetCandidateRelease(PyObject *Self,PyObject *Args) +{ + bool Success; + PyObject *PackageObj; + PyObject *VersionObj; + const char *target_rel; + std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed; + if (PyArg_ParseTuple(Args,"O!O!s", + &PyPackage_Type, &PackageObj, + &PyVersion_Type, &VersionObj, + &target_rel) == 0) + return 0; + + pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); + pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj); + if(I.end()) { + return HandleErrors(PyBool_FromLong(false)); + } + + Success = depcache->SetCandidateRelease(I, target_rel, Changed); + + return HandleErrors(PyBool_FromLong(Success)); +} + static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); @@ -552,6 +576,12 @@ static PyMethodDef PkgDepCacheMethods[] = {"set_candidate_ver",PkgDepCacheSetCandidateVer,METH_VARARGS, "set_candidate_ver(pkg: apt_pkg.Package, ver: apt_pkg.Version) -> bool\n\n" "Set the candidate version of 'pkg' to 'ver'."}, + {"set_candidate_release",PkgDepCacheSetCandidateRelease,METH_VARARGS, + "set_candidate_release(pkg: apt_pkg.Package, ver: apt_pkg.Version, rel: string) -> bool\n\n" + "Sets not only the candidate version 'ver' for package 'pkg', " + "but walks also down the dependency tree and checks if it is required " + "to set the candidate of the dependency to a version from the given " + "release string 'rel', too."}, // global cache operations {"upgrade",PkgDepCacheUpgrade,METH_VARARGS, |
