Use notarytool instead of altool for notarization.

This commit is contained in:
John Preston 2023-09-05 16:42:12 +04:00
parent 9f0a756f71
commit 191f832e52
2 changed files with 5 additions and 157 deletions

View File

@ -402,66 +402,8 @@ if [ "$BuildTarget" == "mac" ] || [ "$BuildTarget" == "macstore" ]; then
cd "$ReleasePath"
fi
fi
if [ "$NotarizeRequestId" == "" ]; then
echo "Beginning notarization process."
set +e
xcrun altool --notarize-app --primary-bundle-id "com.tdesktop.Telegram" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" --file "$SetupFile" > request_uuid.txt
set -e
while IFS='' read -r line || [[ -n "$line" ]]; do
Prefix=$(echo $line | cut -d' ' -f 1)
Value=$(echo $line | cut -d' ' -f 3)
if [ "$Prefix" == "RequestUUID" ]; then
RequestUUID=$Value
fi
done < "request_uuid.txt"
if [ "$RequestUUID" == "" ]; then
cat request_uuid.txt
Error "Could not extract Request UUID."
fi
echo "Request UUID: $RequestUUID"
rm request_uuid.txt
else
RequestUUID=$NotarizeRequestId
echo "Continue notarization process with Request UUID: $RequestUUID"
fi
RequestStatus=
LogFile=
while [[ "$RequestStatus" == "" ]]; do
sleep 5
xcrun altool --notarization-info "$RequestUUID" --username "$AC_USERNAME" --password "@keychain:AC_PASSWORD" > request_result.txt
while IFS='' read -r line || [[ -n "$line" ]]; do
Prefix=$(echo $line | cut -d' ' -f 1)
Value=$(echo $line | cut -d' ' -f 2)
if [ "$Prefix" == "LogFileURL:" ]; then
LogFile=$Value
fi
if [ "$Prefix" == "Status:" ]; then
if [ "$Value" == "in" ]; then
echo "In progress..."
else
RequestStatus=$Value
echo "Status: $RequestStatus"
fi
fi
done < "request_result.txt"
done
if [ "$RequestStatus" != "success" ]; then
echo "Notarization problems, response:"
cat request_result.txt
if [ "$LogFile" != "" ]; then
echo "Requesting log: $LogFile"
curl $LogFile
fi
Error "Notarization FAILED."
fi
rm request_result.txt
if [ "$LogFile" != "" ]; then
echo "Requesting log: $LogFile"
curl $LogFile > request_log.txt
fi
echo "Beginning notarization process."
xcrun notarytool submit "$SetupFile" --keychain-profile "preston" --wait
xcrun stapler staple "$ReleasePath/$BundleName"
if [ "$MacArch" != "" ]; then
@ -543,34 +485,3 @@ sleep 1;
echo -en "\007";
sleep 1;
echo -en "\007";
if [ "$BuildTarget" == "mac" ]; then
if [ -f "$ReleasePath/request_log.txt" ]; then
DisplayingLog=
while IFS='' read -r line || [[ -n "$line" ]]; do
if [ "$DisplayingLog" == "1" ]; then
echo $line
else
Prefix=$(echo $line | cut -d' ' -f 1)
Value=$(echo $line | cut -d' ' -f 2)
if [ "$Prefix" == '"issues":' ]; then
if [ "$Value" != "null" ]; then
echo "NB! Notarization log issues:"
echo $line
DisplayingLog=1
else
DisplayingLog=0
fi
fi
fi
done < "$ReleasePath/request_log.txt"
if [ "$DisplayingLog" != "0" ] && [ "$DisplayingLog" != "1" ]; then
echo "NB! Notarization issues not found:"
cat "$ReleasePath/request_log.txt"
else
rm "$ReleasePath/request_log.txt"
fi
else
echo "NB! Notarization log not found :("
fi
fi

View File

@ -109,53 +109,9 @@ if building:
finish(1, 'Adding tdesktop to archive.')
print('Beginning notarization process.')
lines = subprocess.check_output('xcrun altool --notarize-app --primary-bundle-id "com.tdesktop.Telegram" --username "' + username + '" --password "@keychain:AC_PASSWORD" --file "' + archive + '"', stderr=subprocess.STDOUT, shell=True).decode('utf-8')
print('Response received.')
uuid = ''
for line in lines.split('\n'):
parts = line.strip().split(' ')
if len(parts) > 2 and parts[0] == 'RequestUUID':
uuid = parts[2]
if uuid == '':
finish(1, 'Could not extract Request UUID. Response: ' + lines)
print('Request UUID: ' + uuid)
else:
print('Continue with request UUID: ' + uuid)
requestStatus = ''
logUrl = ''
while requestStatus == '':
time.sleep(5)
print('Checking...')
lines = subprocess.check_output('xcrun altool --notarization-info "' + uuid + '" --username "' + username + '" --password "@keychain:AC_PASSWORD"', stderr=subprocess.STDOUT, shell=True).decode('utf-8')
statusFound = False
for line in lines.split('\n'):
parts = line.strip().split(' ')
if len(parts) > 1:
if parts[0] == 'LogFileURL:':
logUrl = parts[1]
elif parts[0] == 'Status:':
if parts[1] == 'in':
print('In progress.')
statusFound = True
else:
requestStatus = parts[1]
print('Status: ' + requestStatus)
statusFound = True
if not statusFound:
print('Nothing: ' + lines)
if requestStatus != 'success':
print('Notarization problems, response: ' + lines)
if logUrl != '':
print('Requesting log...')
result = subprocess.call('curl ' + logUrl, shell=True)
if result != 0:
finish(1, 'Error calling curl ' + logUrl)
finish(1, 'Notarization failed.')
logLines = ''
if logUrl != '':
print('Requesting log...')
logLines = subprocess.check_output('curl ' + logUrl, shell=True).decode('utf-8')
result = subprocess.call('xcrun notarytool submit "' + archive + '" --keychain-profile "preston" --wait', shell=True)
if result != 0:
finish(1, 'Notarizing the archive.')
result = subprocess.call('xcrun stapler staple Telegram.app', shell=True)
if result != 0:
finish(1, 'Error calling stapler')
@ -175,25 +131,6 @@ if building:
subprocess.call('mv ' + archive + ' ' + outputFolder + '/', shell=True)
subprocess.call('rm -rf ' + today, shell=True)
print('Finished.')
if logLines != '':
displayingLog = 0
for line in logLines.split('\n'):
if displayingLog == 1:
print(line)
else:
parts = line.strip().split(' ')
if len(parts) > 1 and parts[0] == '"issues":':
if parts[1] != 'null':
print('NB! Notarization log issues:')
print(line)
displayingLog = 1
else:
displayingLog = -1
if displayingLog == 0:
print('NB! Notarization issues not found: ' + logLines)
else:
print('NB! Notarization log not found.')
finish(0)
commandPath = scriptPath + '/../../out/' + conf + '/' + outputFolder + '/command.txt'