diff --git a/dnf/base.py b/dnf/base.py index 154eb4e37b..56b4fd8cec 100644 --- a/dnf/base.py +++ b/dnf/base.py @@ -1690,12 +1690,15 @@ def trans_remove(query, remove_query, comps_pkg): return remove_query remove_query = self.sack.query().filterm(empty=True) - attr_fn = ((trans.install, functools.partial(trans_install, strict=True)), - (trans.install_opt, functools.partial(trans_install, strict=False)), - (trans.upgrade, trans_upgrade), - (trans.remove, trans_remove)) - - for (attr, fn) in attr_fn: + attr_fn_mf = ( + (trans.install, functools.partial(trans_install, strict=True), True), + (trans.install_opt, functools.partial(trans_install, strict=False), False), + (trans.upgrade, trans_upgrade, True), + (trans.remove, trans_remove, True) + ) + + missing_fatals = [] + for (attr, fn, missing_fatal) in attr_fn_mf: for comps_pkg in attr: query_args = {'name': comps_pkg.name} if (comps_pkg.basearchonly): @@ -1706,11 +1709,17 @@ def trans_remove(query, remove_query, comps_pkg): package_string = comps_pkg.name if comps_pkg.basearchonly: package_string += '.' + basearch - logger.warning(_('No match for group package "{}"').format(package_string)) + msg = _('No match for group package "{}"').format(package_string) + if missing_fatal: + missing_fatals.append(package_string) + else: + logger.warning(msg) continue remove_query = fn(q, remove_query, comps_pkg) self._goal.group_members.add(comps_pkg.name) + if missing_fatals: + raise dnf.exceptions.MarkingErrors(no_match_pkg_specs=missing_fatals) self._remove_if_unneeded(remove_query) def _build_comps_solver(self):