From eb763ea6d17606c0e9835ea563c9b020c930d099 Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sun, 20 Nov 2022 11:26:06 +0100 Subject: [PATCH] Use the new notarytool --- bin/notarize_vimr.sh | 17 ++++--------- bin/wait_for_notarization.py | 46 ------------------------------------ 2 files changed, 4 insertions(+), 59 deletions(-) delete mode 100755 bin/wait_for_notarization.py diff --git a/bin/notarize_vimr.sh b/bin/notarize_vimr.sh index c9cad01e..5eeae6cd 100755 --- a/bin/notarize_vimr.sh +++ b/bin/notarize_vimr.sh @@ -8,21 +8,12 @@ main() { echo "### Notarizing" ditto -c -k --keepParent VimR.app VimR.app.zip - echo "#### Uploading" - local -x request_uuid - request_uuid=$(xcrun altool --notarize-app --primary-bundle-id "com.qvacua.VimR" --username "hataewon@gmail.com" --password "@keychain:dev-notar" --file VimR.app.zip | grep RequestUUID | sed -E 's/.* = (.*)/\1/') - readonly request_uuid - - echo "#### Uploaded" - echo "Use 'xcrun altool --notarization-history 0 -u hataewon@gmail.com -p @keychain:dev-notar' or" - echo "'xcrun altool --notarization-info ${request_uuid} -u hataewon@gmail.com -p @keychain:dev-notar'" + echo "#### Notarizing" + xcrun notarytool submit VimR.app.zip \ + --keychain-profile "apple-dev-notar" \ + --wait popd >/dev/null - pushd "$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null - echo "#### Waiting for notarization ${request_uuid} to finish" - ./bin/wait_for_notarization.py - popd /dev/null xcrun stapler staple VimR.app echo "### Notarization finished" diff --git a/bin/wait_for_notarization.py b/bin/wait_for_notarization.py deleted file mode 100755 index bbd300a7..00000000 --- a/bin/wait_for_notarization.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -from waiting import wait, TimeoutExpired -import os -import subprocess - - -def check_status(request_uuid: str) -> bool: - proc = subprocess.run( - f"xcrun altool --notarization-info {request_uuid} -u hataewon@gmail.com -p @keychain:dev-notar".split(), - capture_output=True - ) - lines = proc.stdout.decode("utf-8").split("\n") - - success = [line for line in lines if "Status: success" in line] - inprog = [line for line in lines if "Status: in progress" in line] - invalid = [line for line in lines if "Status: invalid" in line] - - if invalid: - print("### ERROR: notarization unsuccessful!") - exit(1) - - if success: - print("### Notarization successful") - return True - - if inprog: - print("### Notarization in progress") - return False - - print("### Notarization status unclear, probably in progress") - return False - - -if __name__ == "__main__": - request_uuid = os.environ["request_uuid"] - print(f"### Waiting for request {request_uuid}") - - try: - wait(lambda: check_status(request_uuid), timeout_seconds=60*60, sleep_seconds=30) - except TimeoutExpired: - print("### ERROR: Timeout of 1h!") - exit(1) - except Exception as err: - print(f"### ERROR: err") - exit(1)