From e2949fc463f9e087978b072c82b11860ee02fdb6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 20 Feb 2024 09:56:06 +0100 Subject: Delete SHADOWED metaIndex if we don't actually use snapshots This adds a bit more code but avoids any surprises later on by having both the shadowed and non-shadowed meta index in the list. Gbp-Dch: ignore --- apt-pkg/deb/debmetaindex.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 3bc7f78de..515893133 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1315,6 +1315,7 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ ArchiveURI.Path.erase(0, 1); std::string Server; + auto const PreviousDeb = List.empty() ? nullptr : List.back(); auto const Deb = GetDebReleaseIndexBy(List, URI, Dist, Options); std::string filename; @@ -1343,7 +1344,13 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ { if (APT::String::Endswith(Snapshot, "?")) { + // Erase the SHADOWED option and remove the release index from the list if we created it. Options.erase("SHADOWED"); + if (Deb && Deb != PreviousDeb) { + assert(List.back() == Deb); + List.pop_back(); + delete Deb; + } goto nosnapshot; } if (Server != "no" && filename.empty()) -- cgit v1.2.3-70-g09d2