summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-02-20 09:56:06 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-02-20 18:50:14 +0100
commite2949fc463f9e087978b072c82b11860ee02fdb6 (patch)
treea2b49cd42bdcc33bba5fe4390ccbb588832c2f83
parentb6274188312e6338e94edc45dbf9cc410d650477 (diff)
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
-rw-r--r--apt-pkg/deb/debmetaindex.cc7
1 files changed, 7 insertions, 0 deletions
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())