diff options
| -rwxr-xr-x | release/sign-launcher.py | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/release/sign-launcher.py b/release/sign-launcher.py index ba5e490c..ffe23cc5 100755 --- a/release/sign-launcher.py +++ b/release/sign-launcher.py | |||
| @@ -20,6 +20,7 @@ This is intended to be run only by the official Repo release managers. | |||
| 20 | 20 | ||
| 21 | import argparse | 21 | import argparse |
| 22 | import os | 22 | import os |
| 23 | import re | ||
| 23 | import subprocess | 24 | import subprocess |
| 24 | import sys | 25 | import sys |
| 25 | 26 | ||
| @@ -49,18 +50,37 @@ def check(opts): | |||
| 49 | util.run(opts, ['gpg', '--verify', f'{opts.launcher}.asc']) | 50 | util.run(opts, ['gpg', '--verify', f'{opts.launcher}.asc']) |
| 50 | 51 | ||
| 51 | 52 | ||
| 52 | def postmsg(opts): | 53 | def get_version(opts): |
| 54 | """Get the version from |launcher|.""" | ||
| 55 | # Make sure we don't search $PATH when signing the "repo" file in the cwd. | ||
| 56 | launcher = os.path.join('.', opts.launcher) | ||
| 57 | cmd = [launcher, '--version'] | ||
| 58 | ret = util.run(opts, cmd, encoding='utf-8', stdout=subprocess.PIPE) | ||
| 59 | m = re.search(r'repo launcher version ([0-9.]+)', ret.stdout) | ||
| 60 | if not m: | ||
| 61 | sys.exit(f'{opts.launcher}: unable to detect repo version') | ||
| 62 | return m.group(1) | ||
| 63 | |||
| 64 | |||
| 65 | def postmsg(opts, version): | ||
| 53 | """Helpful info to show at the end for release manager.""" | 66 | """Helpful info to show at the end for release manager.""" |
| 54 | print(f""" | 67 | print(f""" |
| 55 | Repo launcher bucket: | 68 | Repo launcher bucket: |
| 56 | gs://git-repo-downloads/ | 69 | gs://git-repo-downloads/ |
| 57 | 70 | ||
| 58 | To upload this launcher directly: | 71 | You should first upload it with a specific version: |
| 59 | gsutil cp -a public-read {opts.launcher} {opts.launcher}.asc gs://git-repo-downloads/ | 72 | gsutil cp -a public-read {opts.launcher} gs://git-repo-downloads/repo-{version} |
| 73 | gsutil cp -a public-read {opts.launcher}.asc gs://git-repo-downloads/repo-{version}.asc | ||
| 74 | |||
| 75 | Then to make it the public default: | ||
| 76 | gsutil cp -a public-read gs://git-repo-downloads/repo-{version} gs://git-repo-downloads/repo | ||
| 77 | gsutil cp -a public-read gs://git-repo-downloads/repo-{version}.asc gs://git-repo-downloads/repo.asc | ||
| 60 | 78 | ||
| 61 | NB: You probably want to upload it with a specific version first, e.g.: | 79 | NB: If a rollback is necessary, the GS bucket archives old versions, and may be |
| 62 | gsutil cp -a public-read {opts.launcher} gs://git-repo-downloads/repo-3.0 | 80 | accessed by specifying their unique id number. |
| 63 | gsutil cp -a public-read {opts.launcher}.asc gs://git-repo-downloads/repo-3.0.asc | 81 | gsutil ls -la gs://git-repo-downloads/repo gs://git-repo-downloads/repo.asc |
| 82 | gsutil cp -a public-read gs://git-repo-downloads/repo#<unique id> gs://git-repo-downloads/repo | ||
| 83 | gsutil cp -a public-read gs://git-repo-downloads/repo.asc#<unique id> gs://git-repo-downloads/repo.asc | ||
| 64 | """) | 84 | """) |
| 65 | 85 | ||
| 66 | 86 | ||
| @@ -103,9 +123,10 @@ def main(argv): | |||
| 103 | opts.keys = [util.KEYID_DSA, util.KEYID_RSA, util.KEYID_ECC] | 123 | opts.keys = [util.KEYID_DSA, util.KEYID_RSA, util.KEYID_ECC] |
| 104 | util.import_release_key(opts) | 124 | util.import_release_key(opts) |
| 105 | 125 | ||
| 126 | version = get_version(opts) | ||
| 106 | sign(opts) | 127 | sign(opts) |
| 107 | check(opts) | 128 | check(opts) |
| 108 | postmsg(opts) | 129 | postmsg(opts, version) |
| 109 | 130 | ||
| 110 | return 0 | 131 | return 0 |
| 111 | 132 | ||
