forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add scaffolding for notarization on MacOS (JuliaLang#34120)
- Loading branch information
1 parent
0edadf1
commit c5b5e95
Showing
4 changed files
with
100 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
julia/ | ||
dmg/ | ||
*.dmg | ||
notarize-*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.automation.apple-events</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# Note that you need to have exported `APPLEID` and `APPLEID_PASSWORD` for this to work. | ||
|
||
# Get the UUID from a notarization-upload*.xml file | ||
function extract_uuid() | ||
{ | ||
PLIST_FILE="$1" | ||
|
||
SED_PATTERN='.*([[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}).*' | ||
/usr/libexec/PlistBuddy -c "print notarization-upload:RequestUUID" "${PLIST_FILE}" 2>/dev/null | ||
if [[ $? != 0 ]]; then | ||
sed -n -E "s/${SED_PATTERN}/\1/p" "${PLIST_FILE}" 2>/dev/null | head -1 | ||
fi | ||
} | ||
|
||
# Continually probe and ask if Apple is done notarizing our precious binary bits | ||
function wait_until_completed() | ||
{ | ||
UUID="$1" | ||
PLIST_FILE="$2" | ||
echo "Waiting until UUID ${UUID} is done processing...." | ||
|
||
while true; do | ||
xcrun altool --notarization-info "${UUID}" --username "${APPLEID}" --password "${APPLEID_PASSWORD}" --output-format xml > "${PLIST_FILE}" | ||
STATUS=$(/usr/libexec/PlistBuddy -c "print notarization-info:Status" "${PLIST_FILE}" 2>/dev/null) | ||
|
||
# Process loop exit conditions | ||
if [[ ${STATUS} == "success" ]]; then | ||
echo "Notarization finished" | ||
return 0 | ||
elif [[ ${STATUS} == "in progress" ]]; then | ||
echo -n "." | ||
sleep 10 | ||
continue | ||
else | ||
echo "Notarization failed with status ${STATUS}" | ||
exit 1 | ||
fi | ||
done | ||
} | ||
|
||
if [[ "$#" != 1 ]]; then | ||
echo "Usage: $0 notarize-upload-<suffix>.xml" | ||
exit 1 | ||
fi | ||
|
||
# Get input parameters | ||
UPLOAD_PLIST_FILE="$1" | ||
SUFFIX="${UPLOAD_PLIST_FILE#"notarize-upload-"}" | ||
SUFFIX="${SUFFIX%".xml"}" | ||
|
||
# Extract UUID from uploaded plist file | ||
UUID=$(extract_uuid "${UPLOAD_PLIST_FILE}") | ||
if [[ -z "${UUID}" ]]; then | ||
echo "ERROR: Could not extract UUID value from ${UPLOAD_PLIST_FILE}" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Wait until the UUID is done processing | ||
wait_until_completed "${UUID}" "notarize-check-${SUFFIX}.xml" |