Re: mergerepo issue

Zdenek Pavlas <[email protected]> Thu, 17 Oct 2013 05:00:57 -0400 (EDT)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
> 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: