Skip to content

Commit

Permalink
build: Update MacOSX packages notarization support
Browse files Browse the repository at this point in the history
  • Loading branch information
g-bougard committed Nov 3, 2023
1 parent 4dc85b0 commit a19b776
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion contrib/macosx/glpi-agent-packaging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ if [ -n "$NOTARIZE_USER" -a -n "$NOTARIZE_PASSWORD" -a -n "$NOTARIZE_TEAMID" -a
<key>team_id</key>
<string>$NOTARIZE_TEAMID</string>
<key>password</key>
<string>@env:NOTARIZE_PASSWORD</string>
<string>$NOTARIZE_PASSWORD</string>
</dict>
BUILD_INFO
fi
Expand Down
59 changes: 42 additions & 17 deletions contrib/macosx/munkipkg.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- munkipkg.orig 2023-11-02 15:01:22.396891562 +0100
+++ munkipkg 2023-11-02 20:08:17.670089202 +0100
+++ munkipkg 2023-11-03 16:19:06.698095251 +0100
@@ -63,6 +63,8 @@

BUILD_INFO_FILE = "build-info"
Expand Down Expand Up @@ -59,47 +59,72 @@
else:
raise MunkiPkgError(
- "apple_id + password or keychain_profile"
+ "apple_id + password + team_id or keychain_profile"
+ "apple_id + team_id + password or keychain_profile"
"must be specified in notarization_info."
)

@@ -722,13 +741,16 @@
@@ -722,28 +741,24 @@
add_authentication_options(cmd, build_info)

retcode, proc_stdout, proc_stderr = run_subprocess(cmd)
+ if retcode:
+ print("notarytool: FAILURE " + proc_stderr, file=sys.stderr)
+ raise MunkiPkgError("Notarization upload failed. Unable to run xcrun notarytool")
+ print("notarytool: " + proc_stderr, file=sys.stderr)
+ raise MunkiPkgError("Notarization upload failed.")
+
if proc_stdout.startswith('Generated JWT'):
proc_stdout = proc_stdout.split('\n',1)[1]
try:
output = readPlistFromString(proc_stdout.encode("UTF-8"))
except ExpatError:
print(proc_stderr, file=sys.stderr)
- print(proc_stderr, file=sys.stderr)
- raise MunkiPkgError("Notarization upload failed. Unable to run xcrun altool")
+ raise MunkiPkgError("Notarization upload failed. Unable to run xcrun notarytool")
+ print("notarytool: " + proc_stderr, file=sys.stderr)
+ raise MunkiPkgError("Notarization upload failed.")

if retcode:
for product_error in output.get('product-errors', []):
@@ -737,7 +759,7 @@
file=sys.stderr
)
raise MunkiPkgError("Notarization failed")
- if retcode:
- for product_error in output.get('product-errors', []):
- print(
- "altool: FAILURE " + product_error.get('message', 'UNKNOWN ERROR'),
- file=sys.stderr
- )
- raise MunkiPkgError("Notarization failed")
-
+
try:
request_id = output['id']
display("id " + request_id, options.quiet, "notarytool")
@@ -760,8 +782,11 @@
display(output['message'], options.quiet, "notarytool")
except KeyError:
- raise MunkiPkgError("Unexpected output from altool")
+ raise MunkiPkgError("Unexpected output from notarytool")

return request_id

@@ -760,8 +775,12 @@
'plist',
]
add_authentication_options(cmd, build_info)
-
+
retcode, proc_stdout, proc_stderr = run_subprocess(cmd)
+ if retcode:
+ print("notarytool: FAILURE " + proc_stderr, file=sys.stderr)
+ raise MunkiPkgError("Notarization check failed. Unable to run xcrun notarytool")
+ print("notarytool: " + proc_stderr, file=sys.stderr)
+ raise MunkiPkgError("Notarization check failed.")
+
if proc_stdout.startswith('Generated JWT'):
proc_stdout = proc_stdout.split('\n',1)[1]

@@ -769,10 +788,10 @@
output = readPlistFromString(proc_stdout.encode("UTF-8"))
except ExpatError:
print(proc_stderr, file=sys.stderr)
- raise MunkiPkgError("Notarization check failed. Unable to run xcrun notarytool")
- if retcode or 'message' not in output:
- print("altool: " + output.get('success-message', 'Unexpected response'))
- print("altool: DEBUG output follows")
+ raise MunkiPkgError("Notarization check failed.")
+ if 'message' not in output:
+ print("notarytool: " + output.get('success-message', 'Unexpected response'))
+ print("notarytool: DEBUG output follows")
print(output)
state['status'] = 'Unknown'
else:

0 comments on commit a19b776

Please sign in to comment.