X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/4e0ad446347b1f3d70a66001365382db4d8e45f3..e426a5ff1cd02797b29f5781be4d6fc8bdf44610:/apt-pkg/deb/debmetaindex.cc?ds=sidebyside diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 85e5b16b3..520e94a80 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1,14 +1,11 @@ // ijones, walters -#ifdef __GNUG__ -#pragma implementation "apt-pkg/debmetaindex.h" -#endif - #include #include #include #include #include +#include #include using namespace std; @@ -119,6 +116,13 @@ debReleaseIndex::debReleaseIndex(string URI,string Dist) this->Type = "deb"; } +debReleaseIndex::~debReleaseIndex() +{ + for (vector::const_iterator I = SectionEntries.begin(); + I != SectionEntries.end(); I++) + delete *I; +} + vector * debReleaseIndex::ComputeIndexTargets() const { vector * IndexTargets = new vector ; @@ -148,15 +152,41 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const vector *targets = ComputeIndexTargets(); for (vector ::const_iterator Target = targets->begin(); Target != targets->end(); Target++) { new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, - (*Target)->ShortDesc, ""); + (*Target)->ShortDesc, HashString()); } + // this is normally created in pkgAcqMetaSig, but if we run + // in --print-uris mode, we add it here + new pkgAcqMetaIndex(Owner, MetaIndexURI("Release"), + MetaIndexInfo("Release"), "Release", + MetaIndexURI("Release.gpg"), + ComputeIndexTargets(), + new indexRecords (Dist)); + } + new pkgAcqMetaSig(Owner, MetaIndexURI("Release.gpg"), MetaIndexInfo("Release.gpg"), "Release.gpg", MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release", ComputeIndexTargets(), new indexRecords (Dist)); + // Queue the translations + std::vector const lang = APT::Configuration::getLanguages(true); + for (vector::const_iterator I = SectionEntries.begin(); + I != SectionEntries.end(); I++) { + + if((*I)->IsSrc) + continue; + + for (vector::const_iterator l = lang.begin(); + l != lang.end(); l++) + { + if (*l == "none") continue; + debTranslationsIndex i = debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str()); + i.GetIndexes(Owner); + } + } + return true; } @@ -180,12 +210,23 @@ vector *debReleaseIndex::GetIndexFiles() return Indexes; Indexes = new vector ; + std::vector const lang = APT::Configuration::getLanguages(true); for (vector::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) + I != SectionEntries.end(); I++) { if ((*I)->IsSrc) Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted())); else + { Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted())); + + for (vector::const_iterator l = lang.begin(); + l != lang.end(); l++) { + if (*l == "none") continue; + Indexes->push_back(new debTranslationsIndex(URI,Dist,(*I)->Section,(*l).c_str())); + } + } + } + return Indexes; } @@ -213,7 +254,7 @@ class debSLTypeDebian : public pkgSourceList::Type // This check insures that there will be only one Release file // queued for all the Packages files and Sources files it // corresponds to. - if ((*I)->GetType() == "deb") + if (strcmp((*I)->GetType(), "deb") == 0) { debReleaseIndex *Deb = (debReleaseIndex *) (*I); // This check insures that there will be only one Release file