diff options
author | Mike Frysinger <vapier@google.com> | 2021-09-30 23:13:04 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2021-10-06 17:02:56 +0000 |
commit | 6a74c91f50c404d9a3a181f586de94aa2c3f0101 (patch) | |
tree | 8a3ed0eb13c8494fbfd4432359b370bd8b32ce64 /release/sign-launcher.py | |
parent | 669efd0fd7929c2a3de486921b8243faa3034aa3 (diff) | |
download | git-repo-6a74c91f50c404d9a3a181f586de94aa2c3f0101.tar.gz |
sign-launcher: make the help text more automatic
Rather than display "3.0" all the time and confuse people, extract
the version from the launcher we're signing and display that.
Also reformat the text to follow our current practice: upload the
versioned launcher by itself first, and then later copy that over
the default.
And while we're here, add tips for rollbacks.
Change-Id: I1654425c88e5c67d78879f2f33ad685c59be14dc
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/319637
Reviewed-by: Xin Li <delphij@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'release/sign-launcher.py')
-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 | ||