summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2025-07-22 20:34:34 +0200
committerJulian Andres Klode <jak@debian.org>2025-08-26 13:41:35 +0200
commit539a3dfcfdf30e552a6374ee478a98e16ab7fa7d (patch)
treedb0bfcf335cc8955bb0dc3cbde34d236991ef249
parentdb78e2f8eafb1009bd47e488fc39d8b420f4c749 (diff)
solver3: Allow any downloadable version to mark a package as not obsolete
Lots of people have pinned an older version that is no longer installable, or more common yesterday, we saw a lot of people who seemingly manually installed a newer version of a deb than in the repositories, causing the package to be considered obsolete, which does not make much sense. Oops: 4c39d922-410f-11f0-bbf9-fa163ec44ecd Oops: a64054f6-4140-11f0-bbfd-fa163ec44ecd Oops: a32196c1-661d-11f0-a97c-fa163ec8ca8c
-rw-r--r--apt-pkg/solver3.cc11
-rwxr-xr-xtest/integration/test-solver3-obsoleted-by16
2 files changed, 21 insertions, 6 deletions
diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc
index 2c381f098..a386b967c 100644
--- a/apt-pkg/solver3.cc
+++ b/apt-pkg/solver3.cc
@@ -542,11 +542,16 @@ bool APT::Solver::Obsolete(pkgCache::PkgIterator pkg, bool AllowManual) const
if (ObsoletedByNewerSourceVersion(ver))
return true;
- if (ver.Downloadable())
+ // Any version downloadable is good enough for us tbh
+ for (auto ver = pkg.VersionList(); not ver.end(); ++ver)
{
- pkgObsolete[pkg] = 1;
- return false;
+ if (ver.Downloadable())
+ {
+ pkgObsolete[pkg] = 1;
+ return false;
+ }
}
+
if (debug >= 3)
std::cerr << "Obsolete: " << ver.ParentPkg().FullName() << "=" << ver.VerStr() << " - not installable\n";
pkgObsolete[pkg] = 2;
diff --git a/test/integration/test-solver3-obsoleted-by b/test/integration/test-solver3-obsoleted-by
index dda6b61f0..308e05481 100755
--- a/test/integration/test-solver3-obsoleted-by
+++ b/test/integration/test-solver3-obsoleted-by
@@ -8,12 +8,20 @@ configarchitecture 'amd64'
allowremovemanual
# We need a canary to make it trigger obsolete detection
-insertpackage 'installed' 'canary' 'amd64' '1' 'Depends: good | not-yet-built | not-yet-built-all | obsolete | obsolete-all | obsolete-in-experimental | obsolete-reason | obsolete-all-reason | obsolete-in-experimental-reason | local-only | current-version | obsolete-in-downgrade | obsolete-in-downgrade-reason'
+insertpackage 'installed' 'canary' 'amd64' '1' 'Depends: good | good-in-new-version | good-in-old-version | not-yet-built | not-yet-built-all | obsolete | obsolete-all | obsolete-in-experimental | obsolete-reason | obsolete-all-reason | obsolete-in-experimental-reason | local-only | current-version | obsolete-in-downgrade | obsolete-in-downgrade-reason'
# This package is good, it still exists in the candidate
insertpackage 'installed' 'good' 'amd64' '1' 'Source: good (= 1)'
insertpackage 'unstable' 'good' 'amd64' '2' 'Source: good (= 2)'
+# This package is good, it still exists in the candidate
+insertpackage 'installed' 'good-in-old-version' 'amd64' '2' 'Source: good-in-old-version (= 2)'
+insertpackage 'unstable' 'good-in-old-version' 'amd64' '1' 'Source: good-in-old-version (= 1)'
+
+# This package is good, it still exists in the candidate
+insertpackage 'installed' 'good-in-new-version' 'amd64' '1' 'Source: good-in-new-version (= 1)'
+insertpackage 'unstable' 'good-in-new-version' 'amd64' '2' 'Source: good-in-new-version (= 2)'
+
# not-yet-built is not yet obsolete, because it has only been built on i386
insertpackage 'installed,unstable' 'not-yet-built' 'amd64' '1' 'Source: not-yet-built (= 1)'
insertpackage 'unstable' 'not-yet-built' 'i386' '2' 'Source: not-yet-built (= 2)'
@@ -79,15 +87,17 @@ Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade --no-strict-
msgmsg "Testing no-strict-pinning with negative pins on all packages"
printf 'Package: *\nPin: release *\nPin-Priority: -1\n' > rootdir/etc/apt/preferences
-testobsolete "Obsolete: not-yet-built:amd64 - not installable
+testobsolete "Obsolete: good-in-new-version:amd64 - not installable
Obsolete: good:amd64 - not installable
+Obsolete: good-in-old-version:amd64 - not installable
+Obsolete: not-yet-built:amd64 - not installable
Obsolete: not-yet-built-all:amd64 - not installable
Obsolete: obsolete:amd64 - not installable
Obsolete: obsolete-all:amd64 - not installable
Obsolete: obsolete-in-experimental:amd64 - not installable
+Obsolete: obsolete-all-reason:amd64 - not installable
Obsolete: obsolete-reason:amd64 - not installable
Obsolete: obsolete-in-experimental-reason:amd64 - not installable
-Obsolete: obsolete-all-reason:amd64 - not installable
Obsolete: local-only:amd64 - not installable
Obsolete: current-version:amd64 - not installable
Obsolete: obsolete-in-downgrade:amd64 - not installable