[Merge] ~juliank/ubuntu-release-upgrader:ubuntu/noble into ubuntu-release-upgrader:ubuntu/noble
Julian Andres Klode
mp+472686 at code.launchpad.net
Thu Sep 5 18:59:24 UTC 2024
Diff comments:
> diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py
> index 87801c0..68832a0 100644
> --- a/DistUpgrade/DistUpgradeCache.py
> +++ b/DistUpgrade/DistUpgradeCache.py
> @@ -979,8 +980,16 @@ class MyCache(apt.Cache):
> self[pkgname].installed.section == section):
> logging.debug("skipping '%s' (in KeepInstalledSection)" % pkgname)
> return False
> +
> + return True
> +
> + @withResolverLog
> + def tryMarkObsoleteForRemoval(self, pkgname, remove_candidates, forced_obsoletes, auto_fix):
> + #logging.debug("tryMarkObsoleteForRemoval(): %s" % pkgname)
> # if we don't have the package anyway, we are fine (this can
> # happen when forced_obsoletes are specified in the config file)
> + if pkgname not in remove_candidates:
For better understanding, this could also have been
if not self.isRemoveCandidate(pkgname)
> + return False
> if pkgname not in self:
> #logging.debug("package '%s' not in cache" % pkgname)
> return True
> @@ -1003,10 +1012,7 @@ class MyCache(apt.Cache):
> return True
> #logging.debug("marking '%s' for removal" % pkgname)
> for pkg in self.get_changes():
> - if (pkg.name not in remove_candidates or
> - pkg.name in foreign_pkgs or
> - self._inRemovalDenylist(pkg.name) or
> - pkg.name == self.linux_metapackage):
> + if pkg.name not in remove_candidates:
Likewise, this could have been
if not self.isRemoveCandidate(pkg.name)
but doing that check only once further down below by modifying remove_candidates itself makes a lot of sense.
If you notice, we were missing for pkg.name instead of pkgname (that is, for the reverse dependency that is being checked here) the
if pkgname.endswith(self.uname):
logging.debug("skipping running kernel pkg '%s'" % pkgname)
check here, and the one for KeepInstalledSection
> logging.debug("package '%s' produces an unwanted removal '%s', skipping" % (pkgname, pkg.name))
> self.restore_snapshot()
> return False
--
https://code.launchpad.net/~juliank/ubuntu-release-upgrader/+git/ubuntu-release-upgrader/+merge/472686
Your team Ubuntu Core Development Team is subscribed to branch ubuntu-release-upgrader:ubuntu/noble.
More information about the Ubuntu-reviews
mailing list