Her sey MD5 yerine SHA1 kullanacak sekilde degistirildi. Artik butunluk kontrollerinin hepsi SHA1 ile yapiliyor..

Belgede guncellendigi gibi, files icerisindeki MD5Sum, Hash ile degisti..
This commit is contained in:
A. Murat Eren
2005-06-21 08:41:28 +00:00
parent f64b019892
commit 4c0357ba07
9 changed files with 22 additions and 22 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ class PisiBuild:
# check if source already cached
destpath = fetch.filedest + "/" + fetch.filename
if os.access(destpath, os.R_OK):
if util.md5_file(destpath) == self.spec.source.archiveMD5:
if util.sha1_file(destpath) == self.spec.source.archiveSHA1:
ui.info('%s [cached]\n' % self.spec.source.archiveName)
return
+4 -4
View File
@@ -7,7 +7,7 @@ class FileInfo:
self.path = getNodeText(getNode(node, "Path"))
self.type = getNodeText(getNode(node, "Type"))
self.size = int(getNodeText(getNode(node, "Size")))
self.md5Sum = getNodeText(getNode(node, "MD5Sum"))
self.hash = getNodeText(getNode(node, "Hash"))
def elt(self, dom):
## FIXME: looking for a better way to do it
@@ -19,12 +19,12 @@ class FileInfo:
typeElt.appendChild(dom.createTextNode(type))
sizeElt = dom.createElement("Size")
sizeElt.appendChild(dom.createTextNode(str(size)))
md5Elt = dom.createElement("MD5Sum")
md5Elt.appendChild(dom.createTextNode(md5sum))
hashElt = dom.createElement("Hash")
hashElt.appendChild(dom.createTextNode(hash))
elt.appendChild(pathElt)
elt.appendChild(typeElt)
elt.appendChild(sizeElt)
elt.appendChild(md5Elt)
elt.appendChild(hashElt)
return elt
class Files(XmlFile):
+1 -1
View File
@@ -63,7 +63,7 @@ class SpecFile(XmlFile):
self.source.archiveUri = getNodeText(archiveNode).strip()
self.source.archiveName = basename(self.source.archiveUri)
self.source.archiveType = getNodeAttribute(archiveNode, "archType")
self.source.archiveMD5 = getNodeAttribute(archiveNode, "md5sum")
self.source.archiveSHA1 = getNodeAttribute(archiveNode, "sha1sum")
patchElts = self.getChildElts("Source/Patches")
if patchElts:
self.source.patches = [PatchInfo(p) for p in patchElts]
+5 -5
View File
@@ -4,7 +4,7 @@
import os
import sys
import md5
import sha
import shutil
import statvfs
@@ -67,15 +67,15 @@ def get_file_hashes(top):
for root, dirs, files in os.walk(top, topdown=False):
for file in files:
f = os.path.join(root, file)
yield (f, md5_file(f))
yield (f, sha1_file(f))
def copy_dir(src, dest):
"""copy source dir to destination dir recursively"""
raise UtilError("not implemented")
def md5_file(filename):
"""calculate md5 hash of filename"""
m = md5.new()
def sha1_file(filename):
"""calculate sha1 hash of filename"""
m = sha.new()
f = file(filename, 'rb')
for l in f:
m.update(l)
+1 -1
View File
@@ -13,7 +13,7 @@
<Email>hotmail@redhat.com</Email>
</Packager>
<License>As-Is</License>
<Archive archType="targz" md5sum="5988e7aeb0ae4dac8d83561265984cc9">
<Archive archType="targz" sha1sum="66f3c77b87a160951b180447f4a6dce68ad2f71b">
ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/popt-1.7.tar.gz
</Archive>
<Patches>
+4 -4
View File
@@ -34,8 +34,8 @@ class ArchiveFileTestCase(unittest.TestCase):
assert pathexists(testfile)
# check file integrity
self.assertEqual(util.md5_file(testfile),
"171545adab7b51ebf6ec5575d3000a95")
self.assertEqual(util.sha1_file(testfile),
"5af9dd7d754f788cf511c57ce0af3d555fed009d")
def testUnpackZip(self):
ctx = context.Context("tests/sandbox/sandbox.pspec")
@@ -57,8 +57,8 @@ class ArchiveFileTestCase(unittest.TestCase):
assert pathexists(testfile)
# check file integrity
self.assertEqual(util.md5_file(testfile),
"1e0c3f1e4664ee8ca67caea8b6b12ea4")
self.assertEqual(util.sha1_file(testfile),
"06d0ee5ba49eccae6bc20552d55b3ba5ad52995e")
# check for symbolic links
testfile = targetDir + "/sandbox/deneme/hed"
+2 -2
View File
@@ -16,8 +16,8 @@ class FetcherTestCase(unittest.TestCase):
self.fetch.fetch()
destpath = self.fetch.filedest + "/" + self.fetch.filename
if os.access(destpath, os.R_OK):
self.assertEqual(util.md5_file(destpath),
self.ctx.spec.source.archiveMD5)
self.assertEqual(util.sha1_file(destpath),
self.ctx.spec.source.archiveSHA1)
suite = unittest.makeSuite(FetcherTestCase)
+1 -1
View File
@@ -13,7 +13,7 @@
<Email>meren@uludag.org.tr</Email>
</Packager>
<License>As-Is</License>
<Archive archType="zip" md5sum="2ac9dfd81c07a91019d628268fee6ce1">
<Archive archType="zip" sha1sum="b1e61fe4a840fbe624a01136e33343cdd1b0bf06">
http://cekirdek.uludag.org.tr/~meren/sandbox.zip
</Archive>
<History>
+3 -3
View File
@@ -20,9 +20,9 @@ class SpecReadTestCase(unittest.TestCase):
self.assertEqual(self.spec.source.release,
"3")
def testMD5Sum(self):
self.assertEqual(self.spec.source.archiveMD5,
"5988e7aeb0ae4dac8d83561265984cc9")
def testSHA1Sum(self):
self.assertEqual(self.spec.source.archiveSHA1,
"66f3c77b87a160951b180447f4a6dce68ad2f71b")
def testLenPackages(self):
self.assertEqual(len(self.spec.packages), 1)