diff options
| author | Michael Vogt <egon@bottom> | 2008-02-19 19:26:32 +0100 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2008-02-19 19:26:32 +0100 |
| commit | 5c84be897a08247a5146cccbac7134cadfb43310 (patch) | |
| tree | ccffceb503eaa2d926cc75171dd3723a4a1de462 /python | |
| parent | 4d46ff50f061c4742713e906430d73fdc927b250 (diff) | |
| parent | 1bf52388c98e72768b8f883726ee7e2e2992e4ff (diff) | |
| download | python-apt-5c84be897a08247a5146cccbac7134cadfb43310.tar.gz | |
* use the new CacheFile::ListUpdate() code
* add example in doc/examples/update.py
* python/pkgrecords.cc:
- export the Homepage field
* python/tar.cc:
- fix .lzma extraction (thanks to bigjools)
* python/sourcelist.cc:
- support GetIndexes() GetAll argument to implement
something like --print-uris
* python/apt_pkgmodule.cc:
- add InstState{Ok,ReInstReq,Hold,HoldReInstReq} constants
* apt/cache.py:
- add reqReinstallPkgs property that lists all packages in
ReInstReq or HoldReInstReq
Diffstat (limited to 'python')
| -rw-r--r-- | python/apt_pkgmodule.cc | 5 | ||||
| -rw-r--r-- | python/cache.cc | 50 | ||||
| -rw-r--r-- | python/pkgrecords.cc | 2 | ||||
| -rw-r--r-- | python/sourcelist.cc | 6 | ||||
| -rw-r--r-- | python/tar.cc | 2 |
5 files changed, 21 insertions, 44 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index 15f7d238..ae1cf7be 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -507,6 +507,11 @@ extern "C" void initapt_pkg() AddInt(Dict,"CurStateHalfInstalled",pkgCache::State::HalfInstalled); AddInt(Dict,"CurStateConfigFiles",pkgCache::State::ConfigFiles); AddInt(Dict,"CurStateInstalled",pkgCache::State::Installed); + + AddInt(Dict,"InstStateOk",pkgCache::State::Ok); + AddInt(Dict,"InstStateReInstReq",pkgCache::State::ReInstReq); + AddInt(Dict,"InstStateHold",pkgCache::State::Hold); + AddInt(Dict,"InstStateHoldReInstReq",pkgCache::State::HoldReInstReq); } /*}}}*/ diff --git a/python/cache.cc b/python/cache.cc index aa4d9ffc..36e49710 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -20,10 +20,13 @@ #include <apt-pkg/packagemanager.h> #include <apt-pkg/pkgsystem.h> #include <apt-pkg/sourcelist.h> +#include <apt-pkg/algorithms.h> #include <Python.h> #include "progress.h" +class pkgSourceList; + /*}}}*/ struct PkgListStruct { @@ -76,53 +79,18 @@ static PyObject *PkgCacheUpdate(PyObject *Self,PyObject *Args) PyObject *CacheFilePy = GetOwner<pkgCache*>(Self); pkgCacheFile *Cache = GetCpp<pkgCacheFile*>(CacheFilePy); - PyObject *pyOpProgressInst = 0; PyObject *pyFetchProgressInst = 0; - if (PyArg_ParseTuple(Args, "O|O", &pyFetchProgressInst,&pyOpProgressInst) == 0) + PyObject *pySourcesList = 0; + if (PyArg_ParseTuple(Args, "OO", &pyFetchProgressInst,&pySourcesList) == 0) return 0; - FileFd Lock; - if (_config->FindB("Debug::NoLocking", false) == false) { - Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock")); - if (_error->PendingError() == true) - return HandleErrors(); - } - - pkgSourceList List; - if(!List.ReadMainList()) { - Py_INCREF(Py_None); - return HandleErrors(Py_None); - } - PyFetchProgress progress; progress.setCallbackInst(pyFetchProgressInst); + pkgSourceList *source = GetCpp<pkgSourceList*>(pySourcesList); + bool res = ListUpdate(progress, *source); - pkgAcquire Fetcher(&progress); - if (!List.GetIndexes(&Fetcher)) - return HandleErrors(); - if (Fetcher.Run() == pkgAcquire::Failed) { - Py_INCREF(Py_None); - return HandleErrors(Py_None); - } - -#if 0 // reopening the cache is the job of the python code now - // doing it here is wrong and broken - if(pyOpProgressInst != 0) { - PyOpProgress progress; - progress.setCallbackInst(pyOpProgressInst); - if (Cache->Open(progress,false) == false) - return HandleErrors(); - } else { - OpTextProgress Prog; - if (Cache->Open(Prog,false) == false) { - Py_INCREF(Py_None); - return HandleErrors(Py_None); - } - } -#endif - - Py_INCREF(Py_None); - return HandleErrors(Py_None); + PyObject *PyRes = Py_BuildValue("b", res); + return HandleErrors(PyRes); } static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args) diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 466a2f30..93bc54d9 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -77,6 +77,8 @@ static PyObject *PkgRecordsAttr(PyObject *Self,char *Name) return CppPyString(Struct.Last->LongDesc()); else if (strcmp("Name",Name) == 0) return CppPyString(Struct.Last->Name()); + else if (strcmp("Homepage",Name) == 0) + return CppPyString(Struct.Last->Homepage()); else if (strcmp("Record", Name) == 0) { const char *start, *stop; diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 68b764f8..76df015d 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -60,12 +60,12 @@ static PyObject *PkgSourceListGetIndexes(PyObject *Self,PyObject *Args) pkgSourceList *list = GetCpp<pkgSourceList*>(Self); PyObject *pyFetcher; - - if (PyArg_ParseTuple(Args, "O!",&PkgAcquireType,&pyFetcher) == 0) + char all = 0; + if (PyArg_ParseTuple(Args, "O!|b",&PkgAcquireType,&pyFetcher, &all) == 0) return 0; pkgAcquire *fetcher = GetCpp<pkgAcquire*>(pyFetcher); - bool res = list->GetIndexes(fetcher); + bool res = list->GetIndexes(fetcher, all); return HandleErrors(Py_BuildValue("b",res)); } diff --git a/python/tar.cc b/python/tar.cc index 22c0327e..61c9d708 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -168,6 +168,8 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) // Extract it. if (strcmp(".bz2", &Chunk[strlen(Chunk)-4]) == 0) Comp = "bzip2"; + else if(strcmp(".lzma", &Chunk[strlen(Chunk)-5]) == 0) + Comp = "lzma"; ExtractTar Tar(Deb.GetFile(),Member->Size,Comp); ProcessTar Proc(Function); if (Tar.Go(Proc) == false) |
