diff options
author | kdmukai <kdmukai@gmail.com> | 2022-12-13 08:51:50 -0600 |
---|---|---|
committer | kdmukai <kdmukai@gmail.com> | 2022-12-19 11:18:24 -0600 |
commit | 7121fd8fa7de50ff67157f81f9e0f267b9795dbb (patch) | |
tree | b1a6964effbc1e9f88458ba274211d2a05188681 /test/get_previous_releases.py | |
parent | 6061eb6564105ad54703a7cf3282590d0e1a7f28 (diff) | |
download | bitcoin-7121fd8fa7de50ff67157f81f9e0f267b9795dbb.tar.xz |
test: self-sign previous release binaries for arm64 macOS
Diffstat (limited to 'test/get_previous_releases.py')
-rwxr-xr-x | test/get_previous_releases.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/get_previous_releases.py b/test/get_previous_releases.py index ca06d7b8f8..e91c20da77 100755 --- a/test/get_previous_releases.py +++ b/test/get_previous_releases.py @@ -152,6 +152,34 @@ def download_binary(tag, args) -> int: return ret Path(tarball).unlink() + + if tag >= "v23" and platform == "arm64-apple-darwin": + # Starting with v23 there are arm64 binaries for ARM (e.g. M1, M2) macs, but they have to be signed to run + binary_path = f'{os.getcwd()}/{tag}/bin/' + + for arm_binary in os.listdir(binary_path): + # Is it already signed? + ret = subprocess.run( + ['codesign', '-v', binary_path + arm_binary], + stderr=subprocess.DEVNULL, # Suppress expected stderr output + ).returncode + if ret == 1: + # Have to self-sign the binary + ret = subprocess.run( + ['codesign', '-s', '-', binary_path + arm_binary] + ).returncode + if ret != 0: + print(f"Failed to self-sign {tag} {arm_binary} arm64 binary") + return 1 + + # Confirm success + ret = subprocess.run( + ['codesign', '-v', binary_path + arm_binary] + ).returncode + if ret != 0: + print(f"Failed to verify the self-signed {tag} {arm_binary} arm64 binary") + return 1 + return 0 |