[Rpm-metadata] 2 commits - createrepo/readMetadata.py
valentina at osuosl.org
valentina at osuosl.org
Mon Oct 31 10:41:10 UTC 2016
createrepo/readMetadata.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
New commits:
commit 65bcc31251c544c353b63f67e686bdce1f6c37e0
Merge: 0904d34 cb0ee67
Author: Valentina Mukhamedzhanova <umirra at gmail.com>
Date: Mon Oct 31 11:34:27 2016 +0100
Merge pull request #1 from dmnks/bz1174380
Fix --update for pkgs with same nevra. BZ 1174380
commit cb0ee67fbe6ee63951aa7030ecc318c276d537c7
Author: Michal Domonkos <mdomonko at redhat.com>
Date: Fri Sep 16 13:49:32 2016 +0200
Fix --update for pkgs with same nevra. BZ 1174380
Make sure we don't mess up the primary file on --update by writing
duplicate entries to it when the repo contains multiple rpms with the
same nevra in their headers.
diff --git a/createrepo/readMetadata.py b/createrepo/readMetadata.py
index 30781da..ad70895 100644
--- a/createrepo/readMetadata.py
+++ b/createrepo/readMetadata.py
@@ -108,7 +108,16 @@ class MetadataIndex(object):
"""
if relpath in self.pkg_tups_by_path:
pkgtup = self.pkg_tups_by_path[relpath]
- return self._repo.sack.searchPkgTuple(pkgtup)[0]
+ pos = self._repo.sack.searchPkgTuple(pkgtup)
+ if len(pos) == 1:
+ return pos[0]
+ elif len(pos) > 1:
+ # Multiple matches for this pkgtup so look at their relpath
+ if self.opts.get('verbose'):
+ print _("Warning: Duplicate nevra detected for %s") % relpath
+ for po in pos:
+ if po.relativepath == relpath:
+ return po
return None
More information about the Rpm-metadata
mailing list