mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Upload GPG signatures as well as SHA512 hashes of installer files
This commit is contained in:
parent
a573b1f168
commit
b1664c7417
@ -5,7 +5,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import os, subprocess, hashlib, shutil, glob, stat, sys, time, shlex
|
import os, subprocess, hashlib, shutil, glob, stat, sys, time
|
||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
from tempfile import NamedTemporaryFile, mkdtemp, gettempdir
|
from tempfile import NamedTemporaryFile, mkdtemp, gettempdir
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
@ -48,17 +48,25 @@ def installer_description(fname):
|
|||||||
|
|
||||||
def upload_signatures():
|
def upload_signatures():
|
||||||
tdir = mkdtemp()
|
tdir = mkdtemp()
|
||||||
|
scp = ['scp']
|
||||||
|
try:
|
||||||
for installer in installers():
|
for installer in installers():
|
||||||
if not os.path.exists(installer):
|
if not os.path.exists(installer):
|
||||||
continue
|
continue
|
||||||
|
sig = os.path.join(tdir, os.path.basename(installer+'.sig'))
|
||||||
|
scp.append(sig)
|
||||||
|
check_call([os.path.expanduser('~/kovid/env/private/gpg-as-kovid'), '--output', sig, '--detach-sig', installer])
|
||||||
with open(installer, 'rb') as f:
|
with open(installer, 'rb') as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
fingerprint = hashlib.sha512(raw).hexdigest()
|
fingerprint = hashlib.sha512(raw).hexdigest()
|
||||||
fname = os.path.basename(installer+'.sha512')
|
sha512 = os.path.join(tdir, os.path.basename(installer+'.sha512'))
|
||||||
with open(os.path.join(tdir, fname), 'wb') as f:
|
with open(sha512, 'wb') as f:
|
||||||
f.write(fingerprint)
|
f.write(fingerprint)
|
||||||
check_call('scp %s/*.sha512 code:/srv/code/signatures/' % tdir, shell=True)
|
scp.append(sha512)
|
||||||
check_call(shlex.split('ssh code chown -R http:http /srv/code/signatures'))
|
for srv in 'code main'.split():
|
||||||
|
check_call(scp + ['{0}:/srv/{0}/signatures/'.format(srv)])
|
||||||
|
check_call(['ssh', srv, 'chown', '-R', 'http:http', '/srv/%s/signatures' % srv])
|
||||||
|
finally:
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
|
|
||||||
class ReUpload(Command): # {{{
|
class ReUpload(Command): # {{{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user