2 commits - modifyrepo.py

[email protected] (James Antill) Mon, 10 Mar 2014 19:40:55 +0000 (UTC)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 modifyrepo.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2028b941bda0fecf0bc244159ed902ba88a50def
Merge: 9ab426e 1ede96f
Author: James Antill <[email protected]>
Date:   Mon Mar 10 15:40:51 2014 -0400

    Merge branch 'master' of ssh://yum.baseurl.org/srv/projects/createrepo/git/createrepo
    
    * 'master' of ssh://yum.baseurl.org/srv/projects/createrepo/git/createrepo: (2 commits)
      Fix open_checksum and open_size calculation in RepoMetadata.add().
      ...

commit 9ab426e6b0ee75246da5d635d4bf0786fc1ccc9a
Author: Michael Schroeder <[email protected]>
Date:   Tue Feb 25 14:26:32 2014 +0100

    Patch: allow 'sha' checksum type for modifyrepo
    
    createrepo allows 'sha' as alias for 'sha1', so why not modifyrepo?

diff --git a/modifyrepo.py b/modifyrepo.py
index 3c8a8bd..2ed3f57 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -147,7 +147,7 @@ class RepoMetadata:
         new_rd.checksum = (self.checksum_type, csum)
         new_rd.size = str(os.stat(destmd).st_size)
         if self.compress:
-            new_rd.openchecksum = oldmd.checksums.hexdigests().popitem()
+            new_rd.openchecksum = (self.checksum_type, oldmd.checksums.hexdigests().popitem()[1])
             new_rd.opensize = str(oldmd.checksums.length)
         new_rd.timestamp = str(int(os.stat(destmd).st_mtime))
         self.repoobj.repoData[new_rd.type] = new_rd
@@ -236,7 +236,7 @@ def main(args):
     if opts.compress_type not in _available_compression:
         print "Compression %s not available: Please choose from: %s" % (opts.compress_type, ', '.join(_available_compression))
         return 1
-    if opts.sumtype not in _available_checksums:
+    if opts.sumtype != 'sha' and opts.sumtype not in _available_checksums:
         print "Checksum %s not available: Please choose from: %s" % (opts.sumtype, ', '.join(_available_checksums))
         return 1
     repomd.compress_type = opts.compress_type