From 220657c920ca8c74ae390e2350de0784dfc35611 Mon Sep 17 00:00:00 2001 From: Martin Hatina Date: Thu, 8 Feb 2018 15:23:56 +0100 Subject: [PATCH] exclude non-modular rpm filtered by name of their (enabled) modular equivalent --- dnf/base.py | 21 +++++++++++++++++++-- dnf/conf/config.py | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dnf/base.py b/dnf/base.py index d567536f31..cb853ef01e 100644 --- a/dnf/base.py +++ b/dnf/base.py @@ -254,8 +254,25 @@ def update_include_nevras(name, stream): nevra_query = nevra_query._nevra(nevra).apply() exclude_query_list.append(nevra_query) - for exclude_query in exclude_query_list: - self.sack.add_excludes(exclude_query) + hotfix_repos = [] + for repo in self.repos.iter_enabled(): + if repo.hotfixes: + hotfix_repos.append(repo.id) + + names = set() + for nevra in sorted(include_nevras_set): + nevra = hawkey.split_nevra(nevra) + names.add(nevra.name) + + names_query = self.sack.query().filter(name=names, reponame__neq=hotfix_repos) + query = self.sack.query().filter(nevra=include_nevras_set) + + names_query = names_query.difference(query) + names_query.apply() + + for query in exclude_query_list: + self.sack.add_excludes(query) + self.sack.add_excludes(names_query) def _store_persistent_data(self): if self._repo_persistor and not self.conf.cacheonly: diff --git a/dnf/conf/config.py b/dnf/conf/config.py index 94dd0be075..48e5095baf 100644 --- a/dnf/conf/config.py +++ b/dnf/conf/config.py @@ -1029,6 +1029,9 @@ def __init__(self, parent, section=None, parser=None): SelectionOption('priority', choices=('priority',), notimplemented=('roundrobin',))) + # modularity + self._add_option('hotfixes', BoolOption(default=False)) + def _configure_from_options(self, opts): """Configure repos from the opts. """