X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/5ad0096a4e19e191b59634e8a8817995ec4045ad..fd70eebe454d74e6133caf1254d80a4efda2490a:/apt-pkg/metaindex.cc diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index 8bd13bb18..8b31051fb 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -27,20 +27,22 @@ bool metaIndex::Merge(pkgCacheGenerator &Gen,OpProgress *) const metaIndex::metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) : d(NULL), Indexes(NULL), Type(Type), URI(URI), Dist(Dist), Trusted(TRI_UNSET), - LoadedSuccessfully(TRI_UNSET), - Date(0), ValidUntil(0), SupportsAcquireByHash(false) + Date(0), ValidUntil(0), SupportsAcquireByHash(false), LoadedSuccessfully(TRI_UNSET) { /* nothing */ } metaIndex::~metaIndex() { - if (Indexes == 0) - return; - for (std::vector::iterator I = (*Indexes).begin(); - I != (*Indexes).end(); ++I) - delete *I; - delete Indexes; + if (Indexes != 0) + { + for (std::vector::iterator I = (*Indexes).begin(); + I != (*Indexes).end(); ++I) + delete *I; + delete Indexes; + } + for (auto const &E: Entries) + delete E.second; } // one line Getters for public fields /*{{{*/ @@ -48,22 +50,32 @@ APT_PURE std::string metaIndex::GetURI() const { return URI; } APT_PURE std::string metaIndex::GetDist() const { return Dist; } APT_PURE const char* metaIndex::GetType() const { return Type; } APT_PURE metaIndex::TriState metaIndex::GetTrusted() const { return Trusted; } +APT_PURE std::string metaIndex::GetSignedBy() const { return SignedBy; } APT_PURE std::string metaIndex::GetCodename() const { return Codename; } APT_PURE std::string metaIndex::GetSuite() const { return Suite; } APT_PURE bool metaIndex::GetSupportsAcquireByHash() const { return SupportsAcquireByHash; } APT_PURE time_t metaIndex::GetValidUntil() const { return ValidUntil; } APT_PURE time_t metaIndex::GetDate() const { return this->Date; } APT_PURE metaIndex::TriState metaIndex::GetLoadedSuccessfully() const { return LoadedSuccessfully; } - -APT_PURE bool metaIndex::CheckDist(string const &MaybeDist) const -{ - return (this->Codename == MaybeDist - || this->Suite == MaybeDist); -} -APT_PURE std::string metaIndex::GetExpectedDist() const +APT_PURE std::string metaIndex::GetExpectedDist() const { return Dist; } + /*}}}*/ +bool metaIndex::CheckDist(string const &MaybeDist) const /*{{{*/ { - // TODO: Used to be an explicit value set in the constructor - return ""; + if (MaybeDist.empty() || this->Codename == MaybeDist || this->Suite == MaybeDist) + return true; + + std::string Transformed = MaybeDist; + if (Transformed == "../project/experimental") + Transformed = "experimental"; + + auto const pos = Transformed.rfind('/'); + if (pos != string::npos) + Transformed = Transformed.substr(0, pos); + + if (Transformed == ".") + Transformed.clear(); + + return Transformed.empty() || this->Codename == Transformed || this->Suite == Transformed; } /*}}}*/ APT_PURE metaIndex::checkSum *metaIndex::Lookup(string const &MetaKey) const /*{{{*/ @@ -99,3 +111,20 @@ void metaIndex::swapLoad(metaIndex * const OldMetaIndex) /*{{{*/ std::swap(LoadedSuccessfully, OldMetaIndex->LoadedSuccessfully); } /*}}}*/ + +bool metaIndex::IsArchitectureSupported(std::string const &arch) const /*{{{*/ +{ + debReleaseIndex const * const deb = dynamic_cast(this); + if (deb != NULL) + return deb->IsArchitectureSupported(arch); + return true; +} + /*}}}*/ +bool metaIndex::IsArchitectureAllSupportedFor(IndexTarget const &target) const/*{{{*/ +{ + debReleaseIndex const * const deb = dynamic_cast(this); + if (deb != NULL) + return deb->IsArchitectureAllSupportedFor(target); + return true; +} + /*}}}*/