From b33677749142e0997121d358277b18136bdbef87 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 26 Feb 2025 12:18:39 +0100 Subject: Consider 0-size debs not downloadable, set a size in EDSP EDSP dumps all appear as a single file, so we cannot determine correctly if a package is obsolete. We can fix this by ensuring that only debs with a size are downloadable, and then by faking a size in EDSP: The size is 1 if APT-Release is set (there is a source to download it from) or 0 otherwise. This ensures that the obsolete logic in solver3 works correctly, as well as the obsolete patterns, if anyone could actually use it on the EDSP files. --- apt-pkg/edsp/edsplistparser.cc | 2 ++ apt-pkg/pkgcache.cc | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index f591a6a54..14967e110 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -56,6 +56,8 @@ bool edspLikeListParser::NewVersion(pkgCache::VerIterator &Ver) } } + // Fake a size such that the deb appears downloadable if it has a source + Ver->Size = Section.Exists("APT-Release"); return true; } /*}}}*/ diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index a27b1b054..4101fb4e5 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -864,6 +864,10 @@ int pkgCache::VerIterator::CompareVer(const VerIterator &B) const /* */ APT_PURE bool pkgCache::VerIterator::Downloadable() const { + // A zero size deb is not downloadable + if (S->Size == 0) + return false; + VerFileIterator Files = FileList(); for (; Files.end() == false; ++Files) if (Files.File().Flagged(pkgCache::Flag::NotSource) == false) -- cgit v1.2.3-70-g09d2