From b5988c66af69662fd24e85fb125ef31c8156cf75 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 8 Oct 2010 13:36:13 -0600 Subject: [PATCH] Upload SHA 512 signatures for all installers to the server --- setup/upload.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/setup/upload.py b/setup/upload.py index 784ec1e6f6..f421ca7e18 100644 --- a/setup/upload.py +++ b/setup/upload.py @@ -6,9 +6,9 @@ __license__ = 'GPL v3' __copyright__ = '2009, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import os, re, cStringIO, base64, httplib, subprocess +import os, re, cStringIO, base64, httplib, subprocess, hashlib, shutil from subprocess import check_call -from tempfile import NamedTemporaryFile +from tempfile import NamedTemporaryFile, mkdtemp from setup import Command, __version__, installer_name, __appname__ @@ -331,5 +331,19 @@ class UploadToServer(Command): %(__version__, DOWNLOADS), shell=True) check_call('ssh divok /etc/init.d/apache2 graceful', shell=True) + tdir = mkdtemp() + for installer in installers(): + if not os.path.exists(installer): + continue + with open(installer, 'rb') as f: + raw = f.read() + fingerprint = hashlib.sha512(raw).hexdigest() + fname = os.path.basename(installer+'.sha512') + with open(os.path.join(tdir, fname), 'wb') as f: + f.write(fingerprint) + check_call('scp %s/*.sha512 divok:%s/signatures/' % (tdir, DOWNLOADS), + shell=True) + shutil.rmtree(tdir) +