[Rpm-metadata] mergerepo issue

Zdenek Pavlas zpavlas at redhat.com
Thu Oct 17 09:00:57 UTC 2013

> In merge.py, _sort_func deletes one package if both have the same name, even
> they have different versions.

Yes, it does, but not always. Mergerepo keeps all package versions
from the first (arg. position-wise) repo where any name.arch appears,
and removes all other versions.

Merging versions from >1 repo is IMO perfectly legal, so I too think
this is a bug. But this was clearly intentional and fixing it is
a change in behavior (although it's pretty simple)

--- a/createrepo/merge.py
+++ b/createrepo/merge.py
@@ -70,7 +70,7 @@ class RepoMergeBase:
         for repo in repos:
             for pkg in repo.sack:
-                others = self.yumbase.pkgSack.searchNevra(name=pkg.name, arch=pkg.arch)
+                others = self.yumbase.pkgSack.searchNevra(pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)
                 # NOTE the above is definitely going to catch other versions which may
                 # be an invalid comparison
                 if len(others) > 1:

More information about the Rpm-metadata mailing list