Created
April 11, 2024 15:49
-
-
Save julian-klode/bc96cccf69b756f46004928e64b21e9b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/DistUpgrade/DistUpgradeCache.py b/DistUpgrade/DistUpgradeCache.py | |
index 0692ef90c..27a45d796 100644 | |
--- a/DistUpgrade/DistUpgradeCache.py | |
+++ b/DistUpgrade/DistUpgradeCache.py | |
@@ -449,6 +449,23 @@ class MyCache(apt.Cache): | |
if pkg in self: | |
self._depcache.mark_delete(self[pkg]._pkg, True) | |
+ def _do_not_install(self, pkgname, reason): | |
+ if (pkgname in self | |
+ and not self[pkgname].is_installed | |
+ and self[pkgname].marked_install): | |
+ self.mark_remove(pkgname, reason) | |
+ | |
+ def do_not_install_rule(self): | |
+ """ run after the dist-upgrade to ensure that certain | |
+ packages are not newly installed """ | |
+ # We handle provides here, so we can mark e.g. mail-transport-agent as something we do not | |
+ # want a release upgrade to pull in by depends. | |
+ for pkgname in self.config.getlist("Distro", "DoNotInstallPkgs"): | |
+ if pkgname in self: | |
+ self._do_not_install(pkgname, "Distro KeepInstalledPkgs rule") | |
+ for _, _, provver in in self[pkgname].provides_list: | |
+ self._do_not_install(provver.parent_pkg.name, "Distro KeepInstalledPkgs rule") | |
+ | |
def _keep_installed(self, pkgname, reason): | |
if (pkgname in self | |
and self[pkgname].is_installed | |
@@ -631,6 +648,9 @@ class MyCache(apt.Cache): | |
# check that everything in priority required is installed | |
self.checkPriority() | |
+ # see if our KeepInstalled rules are honored | |
+ self.do_not_install_rule() | |
+ | |
# see if our KeepInstalled rules are honored | |
self.keep_installed_rule() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment