Revision: 27211
http://sourceforge.net/p/bibdesk/svn/27211
Author: hofman
Date: 2022-01-05 10:34:54 +0000 (Wed, 05 Jan 2022)
Log Message:
-----------
Use notarytool in build script. Rename options.
Modified Paths:
--------------
trunk/bibdesk/build_release.py
Modified: trunk/bibdesk/build_release.py
===================================================================
--- trunk/bibdesk/build_release.py 2022-01-01 14:40:32 UTC (rev 27210)
+++ trunk/bibdesk/build_release.py 2022-01-05 10:34:54 UTC (rev 27211)
@@ -9,15 +9,13 @@
#
# SYNOPSIS
-# build_release.sh [-i identity] [-u username] [-p password] [-o out] [-a
zip|dmg|]
+# build_release.sh [-s sign_id] [-n notarize_password] [-o out] [-a zip|dmg|]
#
# OPTIONS
-# -i --identity
+# -s --sign
# Codesign identity, not codesigned when empty
-# -u, --username
-# Username for notarization, not notarized when empty
-# -p, --password
-# Password for notarization, defaults to @keychain:AC_PASSWORD
+# -n, --notarize
+# Keychain profile name for notarization, not notarized when empty
# -o, --out
# Output directory for the final archive and appcast, defaults to the
user's Desktop
# -a, --archive
@@ -140,60 +138,14 @@
print("codesign_bibdesk.sh exited with status %s" % (rc))
assert rc == 0, "code signing failed"
-def notarize_dmg_or_zip(archive_path, username, password):
+def notarize_archive(archive_path, password):
- print("notarize %s" % (archive_path))
-
- bundle_id = "net.sourceforce.bibdesk" + os.path.splitext(archive_path)[1]
- notarize_cmd = ["xcrun", "altool", "--notarize-app",
"--primary-bundle-id", bundle_id, "--username", username, "--password",
password, "--output-format", "xml", "--file", archive_path]
+ notarize_cmd = ["xcrun", "notarytool", "submit", "--keychain-profile",
password, "--wait", archive_path]
print(" ".join(notarize_cmd))
- notarize_task = Popen(notarize_cmd, cwd=SOURCE_DIR, stdout=PIPE,
stderr=PIPE)
- [output, error] = notarize_task.communicate()
- rc = notarize_task.returncode
- print("altool --notarize-app exited with status %s" % (rc))
- assert rc == 0, "notarization failed\n%s" % (output)
-
- output_stream = io.BytesIO(output)
- output_pl = plistlib.readPlist(output_stream)
- output_stream.close()
- sys.stderr.write("%s\n" % (output))
- assert "notarization-upload" in output_pl, "missing notarization-upload
key in reply %s" % (output)
-
- request_uuid = output_pl["notarization-upload"]["RequestUUID"]
-
- while True:
-
- sleep(20)
-
- notarize_cmd = ["xcrun", "altool", "--notarization-info",
request_uuid, "--username", username, "--password", password,
"--output-format", "xml"]
- #print(" ".join(notarize_cmd))
- notarize_task = Popen(notarize_cmd, cwd=SOURCE_DIR, stdout=PIPE,
stderr=PIPE)
- [output, error] = notarize_task.communicate()
- rc = notarize_task.returncode
- assert rc == 0, "status request failed"
-
- output_stream = io.BytesIO(output)
- output_pl = plistlib.readPlist(output_stream)
- assert "notarization-info" in output_pl, "missing notarization-upload
key in reply %s" % (output)
- status = output_pl["notarization-info"]["Status"]
-
- if status == "invalid":
- # open the URL
- log_url = output_pl["notarization-info"]["LogFileURL"]
- Popen(["/usr/bin/open", log_url])
- break
- elif status == "in progress":
- sys.stderr.write("notarization status not available yet for %s\n"
% (request_uuid))
- continue
- else:
- # staple?
- sys.stderr.write("notarization succeeded\n")
- sys.stdout.write("%s\n" % (output))
-
- log_url = output_pl["notarization-info"]["LogFileURL"]
- Popen(["/usr/bin/open", "-g", log_url])
-
- break
+ x = Popen(notarize_cmd, cwd=SOURCE_DIR)
+ rc = x.wait()
+ print("notarytool exited with status %s" % (rc))
+ assert rc == 0, "notarization failed"
def create_dmg_of_application(new_version_number, create_new):
@@ -527,39 +479,39 @@
def get_options():
- identity = ""
- username = ""
- password = "@keychain:AC_PASSWORD"
+ sign = ""
+ notarize = ""
out = os.path.join(os.getenv("HOME"), "Desktop")
archive = ""
+ test = False
try:
- opts, args = getopt.getopt(sys.argv[1:], "i:u:p:o:a:", ["identity=",
"username=", "password=", "out=", "archive="])
+ opts, args = getopt.getopt(sys.argv[1:], "s:n:o:a:t", ["sign=",
"notarize=", "out=", "archive=", "test"])
except:
sys.stderr.write("error reading options\n")
for opt, arg in opts:
- if opt in ["-i", "--identity"]:
- identity = arg
- elif opt in ["-u", "--username"]:
- username = arg
- elif opt in ["-p", "--password"]:
- password = arg
+ if opt in ["-s", "--sign"]:
+ sign = arg
+ elif opt in ["-n", "--notarize"]:
+ notarize = arg
elif opt in ["-o", "--out"]:
out = arg
elif opt in ["-a", "--archive"]:
archive = arg
+ elif opt in ["-t", "--test"]:
+ test = True
- return identity, username, password, out, archive
+ return sign, notarize, out, archive, test
if __name__ == '__main__':
- identity, username, password, out, archive = get_options()
+ sign_id, notarize_password, out, archive, test = get_options()
clean_and_build()
- if identity != "":
- codesign(identity)
+ if sign_id != "":
+ codesign(sign_id)
else:
sys.stderr.write("\nWARNING: built product will not be codesigned\n\n")
@@ -570,10 +522,10 @@
else:
archive_path = create_dmg_of_application(new_version_string, archive
== "dmg")
- if username != "":
+ if notarize_password != "":
# will bail if any part fails
- notarize_dmg_or_zip(archive_path, username, password)
-
+ notarize_archive(archive_path, notarize_password)
+ `
if archive_path.endswith("dmg"):
# xcrun stapler staple BibDesk.app-1.4.zip
staple_cmd = ["xcrun", "stapler", "staple", archive_path]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit