Re: createrepo cache and checksum type

James Antill <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Organization Fedora
Message-ID <[email protected]>
On Fri, 2009-04-17 at 19:12 +0300, Axel Thimm wrote:
> Hi,
> 
> it looks like the current cache implementation doesn't distinguish
> between different checksum types, so when switching back and forth
> between sha and sha256 checksum types createrepo may pick up the wrong
> checksum.
[...]
> The "key" is computed with the default checksum type which may not be
> the same as self.checksum_type

 I think this is the real bug, and fixing it will solve your problem?
I've committed:

commit 6ab7964d633cadbecb387b98353342b19f178a28
Author: James Antill <[email protected]>
Date:   Fri Apr 17 14:22:49 2009 -0400

    Use the same checksum type for the key, as for the data in the key

diff --git a/createrepo/yumbased.py b/createrepo/yumbased.py
index b820fd8..32eed04 100644
--- a/createrepo/yumbased.py
+++ b/createrepo/yumbased.py
@@ -60,7 +60,7 @@ class CreateRepoPackage(YumLocalPackage):
         if type(self.hdr[rpm.RPMTAG_HDRID]) is not types.NoneType:
             t.append("".join(self.hdr[rpm.RPMTAG_HDRID]))
 
-        kcsum = misc.Checksums()
+        kcsum = misc.Checksums(checksums=[self.checksum_type])
         kcsum.update("".join(t))
         key = kcsum.hexdigest()
                                                 

-- 
James Antill <[email protected]>
Fedora
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.