X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/a628ca5256b4a2f3ae300697b17adf150b6e17b0..1242b3bdaf3d3682a945f10f0e537bdb3b0599d5:/apt-pkg/metaindex.cc diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc index 6e5792b78..8b31051fb 100644 --- a/apt-pkg/metaindex.cc +++ b/apt-pkg/metaindex.cc @@ -57,16 +57,25 @@ APT_PURE bool metaIndex::GetSupportsAcquireByHash() const { return SupportsAcqui 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 /*{{{*/