Skip to content

Commit

Permalink
exclude non-modular rpm filtered by name of their (enabled) modular e…
Browse files Browse the repository at this point in the history
…quivalent
  • Loading branch information
Martin Hatina authored and dmach committed Feb 9, 2018
1 parent 25c3a76 commit 220657c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
21 changes: 19 additions & 2 deletions dnf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions dnf/conf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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. """

Expand Down

0 comments on commit 220657c

Please sign in to comment.