Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS,macOS: Add logging of duplicate codesign binaries #54987

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion sky/tools/sky_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,25 @@ def assert_valid_codesign_config(
either entitlements or without_entitlements."""
if _contains_duplicates(entitlements):
log_error('ERROR: duplicate value(s) found in entitlements.txt')
log_error_items(sorted(entitlements))
sys.exit(os.EX_DATAERR)

if _contains_duplicates(without_entitlements):
log_error('ERROR: duplicate value(s) found in without_entitlements.txt')
log_error_items(sorted(without_entitlements))
sys.exit(os.EX_DATAERR)

if _contains_duplicates(unsigned_binaries):
log_error('ERROR: duplicate value(s) found in unsigned_binaries.txt')
log_error_items(sorted(unsigned_binaries))
sys.exit(os.EX_DATAERR)

if _contains_duplicates(entitlements + without_entitlements + unsigned_binaries):
log_error('ERROR: value(s) found in both entitlements and without_entitlements.txt')
log_error(
'ERROR: duplicate value(s) found between '
'entitlements.txt, without_entitlements.txt, unsigned_binaries.txt'
)
log_error_items(sorted(entitlements + without_entitlements + unsigned_binaries))
sys.exit(os.EX_DATAERR)

binaries = set()
Expand Down Expand Up @@ -254,6 +261,12 @@ def log_error(message):
print(message, file=sys.stderr)


def log_error_items(items):
"""Writes each item indented to stderr, followed by a newline."""
for item in items:
log_error(' ' + item)


def strip_binary(binary_path, unstripped_copy_path):
"""Makes a copy of an unstripped binary, then strips symbols from the binary."""
assert_file(binary_path, 'binary to strip')
Expand Down