From 028a1b51914e232904d7671cad5310e1a8a4cd31 Mon Sep 17 00:00:00 2001 From: Jan Kolarik Date: Thu, 21 Sep 2023 10:56:47 +0000 Subject: [PATCH] comps: Fix marking a group package as installed (RhBug:2066638) When a new group is being installed or an installed group is upgraded, do not mark the packages within the group as 'not installed' directly. Instead, check the actual package state in the database to determine if it was already installed by another group. = changelog = msg: comps: Fix removing packages belonging to another installed group type: bugfix resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2066638 --- dnf/comps.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dnf/comps.py b/dnf/comps.py index 19df04dc0a..dbb0ad80fe 100644 --- a/dnf/comps.py +++ b/dnf/comps.py @@ -673,8 +673,9 @@ def _group_install(self, group_id, pkg_types, exclude=None, strict=True, exclude raise CompsError(_("Group id '%s' does not exist.") % ucd(group_id)) swdb_group = self.history.group.new(group_id, comps_group.name, comps_group.ui_name, pkg_types) - for i in comps_group.packages_iter(): - swdb_group.addPackage(i.name, False, Package._OPT_MAP[i.type]) + for pkg in comps_group.packages_iter(): + pkg_installed = self.history.swdb.getPackageCompsGroups(pkg.name) != () + swdb_group.addPackage(pkg.name, pkg_installed, Package._OPT_MAP[pkg.type]) self.history.group.install(swdb_group) trans = TransactionBunch() @@ -712,8 +713,9 @@ def _group_upgrade(self, group_id): # create a new record for current transaction swdb_group = self.history.group.new(group_id, comps_group.name, comps_group.ui_name, pkg_types) - for i in comps_group.packages_iter(): - swdb_group.addPackage(i.name, False, Package._OPT_MAP[i.type]) + for pkg in comps_group.packages_iter(): + pkg_installed = self.history.swdb.getPackageCompsGroups(pkg.name) != () + swdb_group.addPackage(pkg.name, pkg_installed, Package._OPT_MAP[pkg.type]) self.history.group.upgrade(swdb_group) trans = TransactionBunch()