[Rpm-metadata] createrepo/utils.py modifyrepo.py
skvidal at osuosl.org
skvidal at osuosl.org
Tue Jan 27 16:24:25 UTC 2009
createrepo/utils.py | 2 +-
modifyrepo.py | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 95e001874f35b417903c374e813f5121eec4464a
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Tue Jan 27 11:20:54 2009 -0500
make modifyrepo behave with sha256 as the default checksum
diff --git a/createrepo/utils.py b/createrepo/utils.py
index 48eddba..3f6414b 100644
--- a/createrepo/utils.py
+++ b/createrepo/utils.py
@@ -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
diff --git a/modifyrepo.py b/modifyrepo.py
index 632d824..1efe966 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -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 "))
More information about the Rpm-metadata
mailing list