Files
agent-radar 1a3a4ccde1
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:01:50 +08:00

120 lines
3.0 KiB
Bash

#!/usr/bin/env bash
# Re-sign all Mach-O files in a macOS bundle/directory with one identity.
#
# PyInstaller collects Python frameworks and native extension libraries from
# third-party packages. Re-signing every Mach-O file after collection keeps the
# backend executable, Python runtime, and native dependencies in one signature
# state before Tauri embeds them in the final app.
set -euo pipefail
TARGET="${1:?Usage: sign_macos_bundle.sh <target> [identity]}"
IDENTITY="${2:-${APPLE_SIGNING_IDENTITY:--}}"
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "ERROR: macOS code signing must run on Darwin"
exit 1
fi
if ! command -v codesign >/dev/null 2>&1; then
echo "ERROR: codesign not found"
exit 1
fi
if ! command -v file >/dev/null 2>&1; then
echo "ERROR: file not found"
exit 1
fi
if [[ ! -e "${TARGET}" ]]; then
echo "ERROR: signing target not found: ${TARGET}"
exit 1
fi
signing_args() {
printf '%s\n' --force --sign "${IDENTITY}"
if [[ "${IDENTITY}" == "-" ]]; then
printf '%s\n' --timestamp=none
fi
}
is_macho() {
file -b "$1" | grep -q "Mach-O"
}
is_inside_framework() {
[[ "$1" == *".framework/"* ]]
}
codesign_file() {
local path="$1"
local args=()
local arg
while IFS= read -r arg; do
args+=("${arg}")
done < <(signing_args)
codesign "${args[@]}" "${path}"
}
codesign_bundle() {
local path="$1"
local args=()
local arg
while IFS= read -r arg; do
args+=("${arg}")
done < <(signing_args)
codesign "${args[@]}" "${path}"
}
echo "Signing macOS native files in ${TARGET}"
echo "Signing identity: ${IDENTITY}"
signed_files=0
while IFS= read -r -d '' path; do
if is_inside_framework "${path}"; then
continue
fi
if is_macho "${path}"; then
codesign_file "${path}"
signed_files=$((signed_files + 1))
fi
done < <(find "${TARGET}" -type f -print0)
# Framework directories carry their own bundle signature. Sign them after the
# contained Mach-O files, then sign the app bundle last.
signed_frameworks=0
while IFS= read -r framework; do
if [[ -n "${framework}" ]]; then
codesign_bundle "${framework}"
signed_frameworks=$((signed_frameworks + 1))
fi
done < <(find "${TARGET}" -type d -name "*.framework" | sort -r)
if [[ "${TARGET}" == *.app ]]; then
codesign_bundle "${TARGET}"
fi
echo "Signed ${signed_files} Mach-O files and ${signed_frameworks} frameworks"
if [[ "${TARGET}" == *.app ]]; then
codesign --verify --deep --strict --verbose=2 "${TARGET}"
else
while IFS= read -r -d '' path; do
if is_inside_framework "${path}"; then
continue
fi
if is_macho "${path}"; then
codesign --verify --verbose=2 "${path}"
fi
done < <(find "${TARGET}" -type f -print0)
while IFS= read -r framework; do
if [[ -n "${framework}" ]]; then
codesign --verify --verbose=2 "${framework}"
fi
done < <(find "${TARGET}" -type d -name "*.framework" | sort -r)
fi