On Wed, Jun 25, 2014 at 10:56 PM, Johannes Schauer <j.scha...@email.de> wrote: > Hi, > > Quoting Julian Andres Klode (2014-06-25 22:40:40) >> Now I understand what you mean. I thought you meant the location of the files >> on disk. Do you mean the location on the mirror instead? Stuff like >> architecture, etc. is exported in the cache in pkgCache::PackageFile. > > All of it. The location on disk, the arch, the suite, the mirror url, the > component...
Well, as I said WRT on disk. We expose this, but you should most likely not use it without APT parsers, as it may not contain data you expect (for example, compressed indices). Using APT's parsers for those files is the best idea. > > Ideal would be a query interface like: give me the binary package file on disk > for debian sid, main, amd64. But the other way round would probably be much > easier to implement: extend the existing interface to provide this information > for all files in the main list. > > Back to the code snippet I posted: > > 01 for (I=list.begin(); I != list.end(); ++I) { > 02 string diststr = (*I)->GetDist(); > 03 string uristr = (*I)->GetURI(); > 04 std::cout << "dist: " << diststr << " uristr: " << uristr << "\n"; > 05 vector<pkgIndexFile *>::const_iterator J; > 06 vector<pkgIndexFile *> *indexes = (*I)->GetIndexFiles(); > 07 for (J=indexes->begin(); J != indexes->end(); ++J) { > 08 if (strcmp((*J)->GetType()->Label, "Debian Package Index") == > 0) { > 09 debPackagesIndex* i = (debPackagesIndex*)(*J); > 10 std::cout << i->Describe(false) << "\n"; > 11 } > 12 } > 13 } > > the distribution and uristring can already be accessed (see lines 2 and 3) but > I do not see a way to get the architecture, the suite, or the exact filename > for example even though you say it's possible through pkgCache::PackageFile. > If > yes - how? You are reading the wrong list. You need to go through the cache, not the pkgSourceList. pkgSourceList give you IndexFiles, the cache gives you PackageFiles you can iterate over. You need to loop through the files in the cache starting at Cache->FileBegin() and ending at Cache->FileEnd(). This gives you pkgCache::PkgFileIterator() with stuff like FileName, Archive, Component, Version, Architecture. -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org