make modifyrepo behave with sha256 as the default checksum
authorSeth Vidal <skvidal@fedoraproject.org>
Tue, 27 Jan 2009 16:20:54 +0000 (11:20 -0500)
committerSeth Vidal <skvidal@fedoraproject.org>
Tue, 27 Jan 2009 16:20:54 +0000 (11:20 -0500)
createrepo/utils.py
modifyrepo.py

index 48eddbad9ef486169d8b16bed4d1f5b4dfdf1076..3f6414beef19a665c866e92405cc3cbb22dddc25 100644 (file)
@@ -103,7 +103,7 @@ def checkAndMakeDir(dir):
 def checksum_and_rename(fn_path):
     """checksum the file rename the file to contain the checksum as a prefix
        return the new filename"""
-    csum = misc.checksum('sha', fn_path)
+    csum = misc.checksum('sha256', fn_path)
     fn = os.path.basename(fn_path)
     fndir = os.path.dirname(fn_path)
     csum_fn = csum + '-' + fn
index 632d82458ab1910d06d46e5eb427f9aaebd9b1f5..1efe9663de2a4c33712905a56b9b897e104d3401 100755 (executable)
@@ -35,6 +35,7 @@ class RepoMetadata:
         """ Parses the repomd.xml file existing in the given repo directory. """
         self.repodir = os.path.abspath(repo)
         self.repomdxml = os.path.join(self.repodir, 'repomd.xml')
+        self.checksum_type = 'sha256'
         if not os.path.exists(self.repomdxml):
             raise Exception('%s not found' % self.repomdxml)
         self.doc = minidom.parse(self.repomdxml)
@@ -84,7 +85,7 @@ class RepoMetadata:
         newmd.close()
         print "Wrote:", destmd
 
-        open_csum = checksum('sha', metadata)
+        open_csum = checksum(self.checksum_type, metadata)
 
 
         csum, destmd = checksum_and_rename(destmd)
@@ -105,13 +106,13 @@ class RepoMetadata:
         self._insert_element(data, 'location',
                              attrs={ 'href' : 'repodata/' + base_destmd })
         data.appendChild(self.doc.createTextNode("\n    "))
-        self._insert_element(data, 'checksum', attrs={ 'type' : 'sha' },
+        self._insert_element(data, 'checksum', attrs={ 'type' : self.checksum_type },
                              text=csum)
         data.appendChild(self.doc.createTextNode("\n    "))
         self._insert_element(data, 'timestamp',
                              text=str(os.stat(destmd).st_mtime))
         data.appendChild(self.doc.createTextNode("\n    "))
-        self._insert_element(data, 'open-checksum', attrs={ 'type' : 'sha' },
+        self._insert_element(data, 'open-checksum', attrs={ 'type' : self.checksum_type },
                              text=open_csum)
 
         data.appendChild(self.doc.createTextNode("\n  "))