-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathadd_cosigner
executable file
·76 lines (64 loc) · 2.85 KB
/
add_cosigner
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/python3
#
# This script is part of the workflow for BUILDERs to reproduce and sign the
# release binaries. (for builders who do not have sftp access to "electrum-downloads-airlock")
#
# env vars:
# - SSHUSER
#
#
# - BUILDER builds all binaries and checks they match the official releases
# (using release.sh, and perhaps some manual steps)
# - BUILDER creates a PR against https://github.com/spesmilo/electrum-signatures/
# to add their sigs for a given release, which then gets merged
# - SFTPUSER runs `$ SSHUSER=$SFTPUSER electrum/contrib/add_cosigner $BUILDER`
# - SFTPUSER runs `$ electrum/contrib/make_download $WWW_DIR`
# - $ (cd $WWW_DIR; git commit -a -m "add_cosigner"; git push)
# - SFTPUSER runs `$ electrum-web/publish.sh $SFTPUSER`
# - (for the website to be updated, both ThomasV and SomberNight needs to run publish.sh)
import re
import os
import sys
import importlib
import subprocess
if len(sys.argv) < 2:
print(f"usage: {os.path.basename(__file__)} <cosigner>", file=sys.stderr)
sys.exit(1)
# cd to project root
os.chdir(os.path.dirname(os.path.dirname(__file__)))
# load version.py; needlessly complicated alternative to "imp.load_source":
version_spec = importlib.util.spec_from_file_location('version', 'electrum/version.py')
version_module = importlib.util.module_from_spec(version_spec)
version_spec.loader.exec_module(version_module)
ELECTRUM_VERSION = version_module.ELECTRUM_VERSION
print("version", ELECTRUM_VERSION)
# GPG name of cosigner
cosigner = sys.argv[1]
version = version_win = version_mac = version_android = ELECTRUM_VERSION
files = {
"tgz": f"Electrum-{version}.tar.gz",
"tgz_srconly": f"Electrum-sourceonly-{version}.tar.gz",
"appimage": f"electrum-{version}-x86_64.AppImage",
"mac": f"electrum-{version_mac}.dmg",
"win": f"electrum-{version_win}.exe",
"win_setup": f"electrum-{version_win}-setup.exe",
"win_portable": f"electrum-{version_win}-portable.exe",
"apk_arm64": f"Electrum-{version_android}-arm64-v8a-release.apk",
"apk_armeabi": f"Electrum-{version_android}-armeabi-v7a-release.apk",
"apk_x86_64": f"Electrum-{version_android}-x86_64-release.apk",
}
for shortname, filename in files.items():
path = f"dist/{filename}"
link = f"https://download.electrum.org/{version}/{filename}"
if not os.path.exists(path):
os.system(f"wget -q {link} -O {path}")
if not os.path.getsize(path):
raise Exception(path)
sig_name = f"{filename}.{cosigner}.asc"
sig_url = f"https://raw.githubusercontent.com/spesmilo/electrum-signatures/master/{version}/{filename}/{sig_name}"
sig_path = f"dist/{sig_name}"
os.system(f"wget -nc {sig_url} -O {sig_path}")
if os.system(f"gpg --verify {sig_path} {path}") != 0:
raise Exception(sig_name)
print("Calling upload.sh now... This might take some time.")
subprocess.check_output(["./contrib/upload.sh", ])