diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2008-08-05 11:36:13 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2008-08-05 11:36:13 +0200 |
| commit | 5204dc7d2975121f529802ec403134502d6d4e45 (patch) | |
| tree | 964c562361f6f276740d47baf9e247771751e009 /python | |
| parent | 91e65ee1efd73fdbf507c2683bc6cc64fee9b37c (diff) | |
| parent | 1d96f36591c56798021c4e33d01a781507592add (diff) | |
| download | python-apt-5204dc7d2975121f529802ec403134502d6d4e45.tar.gz | |
* python/cache.cc:
- fix GetCandidateVer() reporting incorrect versions after
SetCandidateVer() was used. Thanks to Julian Andres Klode for
the test-case (LP: #237372)
* python/apt_instmodule.cc:
- do not change working dir in debExtractArchive() (LP: #184093)
* apt/cache.py:
- support "in" in apt.Cache() (LP: #251587)
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_instmodule.cc | 13 | ||||
| -rw-r--r-- | python/depcache.cc | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/python/apt_instmodule.cc b/python/apt_instmodule.cc index 43d5e7f7..ea703b21 100644 --- a/python/apt_instmodule.cc +++ b/python/apt_instmodule.cc @@ -74,6 +74,7 @@ static char *doc_debExtractArchive = static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) { char *Rootdir = NULL; + char cwd[512]; PyObject *File; if (PyArg_ParseTuple(Args,"O!|s",&PyFile_Type,&File,&Rootdir) == 0) return 0; @@ -83,21 +84,27 @@ static PyObject *debExtractArchive(PyObject *Self,PyObject *Args) { if(Rootdir != NULL) { + getcwd(cwd, sizeof(cwd)); chdir(Rootdir); } // Open the file and associate the .deb FileFd Fd(fileno(PyFile_AsFile(File)),false); debDebFile Deb(Fd); - if (_error->PendingError() == true) - return HandleErrors(); + if (_error->PendingError() == true) { + if (Rootdir != NULL) + chdir (cwd); + return HandleErrors(Py_BuildValue("b",false)); + } // extracts relative to the current dir pkgDirStream Extract; res = Deb.ExtractArchive(Extract); + if (Rootdir != NULL) + chdir (cwd); if (res == false) - return HandleErrors(); + return HandleErrors(Py_BuildValue("b",res)); } return HandleErrors(Py_BuildValue("b",res)); } diff --git a/python/depcache.cc b/python/depcache.cc index 5664a6d8..2446dc71 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -197,7 +197,7 @@ static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args) return 0; pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); - pkgCache::VerIterator I = GetCpp<pkgCache::VerIterator>(VersionObj); + pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj); if(I.end()) { return HandleErrors(Py_BuildValue("b",false)); } @@ -215,7 +215,9 @@ static PyObject *PkgDepCacheGetCandidateVer(PyObject *Self,PyObject *Args) return 0; pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); - pkgCache::VerIterator I = depcache->GetCandidateVer(Pkg); + pkgDepCache::StateCache & State = (*depcache)[Pkg]; + pkgCache::VerIterator I = State.CandidateVerIter(*depcache); + if(I.end()) { Py_INCREF(Py_None); return Py_None; |
