Discussion:
mergerepo issue
Zeng, Jingjian (HBO)
2013-10-07 18:27:42 UTC
Permalink
Hi,

In merge.py, _sort_func deletes one package if both have the same name, even they have different versions. This caused a bug for me, and I have to add comparison of versions to make my code work.

My use case is: I have a yum repo on S3, every time I have a newer version of the product, I would run createrepo on this version, and merge repomd with the one on S3. Because they have the same name, the default mergerepo doesn't work.

Please tell me whether I did it the right way.

Thanks
JJ
---------------------------------------------------------------------
This e-mail is intended only for the use of the addressees. Any copying, forwarding, printing or other use of this e-mail by persons other than the addressees is not authorized. This e-mail may contain information that is privileged, confidential and exempt from disclosure. If you are not the intended recipient, please notify us immediately by return e-mail (including the original message in your reply) and then delete and discard all copies of the e-mail.

Thank you.

---------------------------------------------------------------------
Zdenek Pavlas
2013-10-17 09:00:57 UTC
Permalink
Post by Zeng, Jingjian (HBO)
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:

Loading...