]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/metaindex.cc
follow the googletest merge in build-depends
[apt.git] / apt-pkg / metaindex.cc
index 6e5792b78f3d1b791ed4c0e8863444e4848f83cf..8b31051fb54debd1e160b3073f30f46910adff35 100644 (file)
@@ -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 /*{{{*/