From 32562381d23f0d5522eaa4217d4f6d5450f05d15 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Sun, 21 Aug 2011 11:40:13 +0000 Subject: check sha1sum of existing files --- MgaRepo/binrepo.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py index 51a1940..1ad3549 100644 --- a/MgaRepo/binrepo.py +++ b/MgaRepo/binrepo.py @@ -57,7 +57,10 @@ def download_binary(topdir, sha1, filename): url = mirror.normalize_path(url + "/" + sha1) dest = os.path.join(topdir, 'SOURCES', filename) if os.path.exists(dest): - return 1 + if file_hash(dest) == sha1: + return 1 + else: + raise Error, "File with incorrect sha1sum: %s" % dest context = {"dest": dest, "url": url} try: cmd = string.Template(fmt).substitute(context) -- cgit v1.2.1