summaryrefslogtreecommitdiff
path: root/apt-pkg/metaindex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/metaindex.cc')
-rw-r--r--apt-pkg/metaindex.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/apt-pkg/metaindex.cc b/apt-pkg/metaindex.cc
index 281824855..8b31051fb 100644
--- a/apt-pkg/metaindex.cc
+++ b/apt-pkg/metaindex.cc
@@ -57,15 +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 /*{{{*/
{
- return Dist;
+ 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 /*{{{*/