[PATCH 03/21] Don't assume MD5 for the lookaside cache
Mathieu Bridon
bochecha at fedoraproject.org
Wed May 6 11:52:59 UTC 2015
From: Mathieu Bridon <bochecha at daitauha.fr>
This paves the way for changing the hash type in the future.
---
src/pyrpkg/__init__.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
index 910bb2e..b32effc 100644
--- a/src/pyrpkg/__init__.py
+++ b/src/pyrpkg/__init__.py
@@ -913,7 +913,9 @@ class Commands(object):
cmd = ['curl', '--fail', '-o', '/dev/null', '--show-error',
'--progress-bar', '-F', 'name=%s' % self.module_name,
- '-F', 'md5sum=%s' % file_hash, '-F', 'file=@%s' % file]
+ '-F', '%ssum=%s' % (self.lookasidehash, file_hash),
+ '-F', 'file=@%s' % file]
+
if self.quiet:
cmd.append('-s')
cmd.append(self.lookaside_cgi)
@@ -1662,7 +1664,7 @@ class Commands(object):
raise rpkgError('Could not check out %s' % branch)
return
- def file_exists(self, pkg_name, filename, md5sum):
+ def file_exists(self, pkg_name, filename, checksum):
"""
Return True if the given file exists in the lookaside cache, False
if not.
@@ -1679,7 +1681,7 @@ class Commands(object):
# 'filename' here appears to be what differentiates this
# request from an actual file upload.
post_data = [('name', pkg_name),
- ('md5sum', md5sum),
+ ('%ssum' % self.lookasidehash, checksum),
('filename', filename)]
curl = self._create_curl()
--
2.1.0
More information about the rel-eng
mailing list