Description of problem: After calling latest() on the query, if a package is included in multiple repos, a copy from each repo is still returned. Version-Release number of selected component (if applicable): python3-dnf-3.0.3-2.fc29.noarch How reproducible: 100% Steps to Reproduce: 1. Create a repo with a single package 2. Run following script: #!/usr/bin/env python import logging import os import tempfile ---- %< ---- import dnf REPO = "file://" + os.path.dirname(os.path.abspath(__file__)) logging.basicConfig(level=logging.WARNING) base = dnf.Base() base.conf.cachedir = tempfile.mkdtemp() repo = dnf.repo.Repo('main', base.conf) repo.baseurl = REPO repo.enable() base.repos.add(repo) repo.priority = 20 repo = dnf.repo.Repo('lookaside', base.conf) repo.baseurl = REPO repo.enable() base.repos.add(repo) repo.priority = 10 base.fill_sack(load_system_repo=False) query = base.sack.query().latest() for pkg in query.filter(name="dummy-basesystem"): # REPLACE NAME print("Found %s in %s" % (pkg.name, pkg.repoid)) ---- %< ---- Actual results: With python3-dnf-3.0.3-2.fc29.noarch I'm getting the package in both main and lookaside repo. Expected results: With python3-dnf-2.7.5-2.fc27.noarch only the package in lookaside is returned. Additional info: If the call to latest() is removed, then both versions return all copies of the package.
This is expected behavior. In the past, query().latest() returned only one match and was hiding RPMs with the same NEVRA from different repos. There was also a bug that query().latest(n) returned n packages. Now it returns all packages with n latest NEVRAs. My suggestion is to use either first [0] or last [-1] returned package according what you need to achieve in the program.