Retain failed native preflight diagnostics before stopping delivery

这个提交包含在:
mac 于 2026-11-02 13:57:02 +08:00 提交
1 父节点 eeeee102cd
当前提交 06d531c443
1 个文件已更改
+12 -2
+12 -2
查看文件
@@ -29,6 +29,16 @@ def identity(path,expected):
def unregister(path):
reg=run('pluginkit','-m','-A','-D','-v','-i','com.dayu.color.XPC')
if any(l.rstrip().endswith('\t'+str(path)) for l in reg.splitlines()):run('pluginkit','-r',str(path))
def self_test(executable,report):
result=subprocess.run([str(executable),'--self-test'],cwd=ROOT,text=True,capture_output=True)
report.write_text(result.stdout)
report.with_suffix('.stderr').write_text(result.stderr)
try:parsed=json.loads(result.stdout)
except json.JSONDecodeError:raise RuntimeError('原生自检未返回有效结果,诊断已保留:'+str(report))
if result.returncode or not parsed.get('pass'):
failed=[x.get('name') for x in parsed.get('results',[]) if not x.get('pass',True)]
raise RuntimeError('原生自检未通过,正式旧版未替换。诊断:'+str(report)+';失败项:'+str(failed))
return parsed
def main():
hosts_closed();CACHE.mkdir(parents=True,exist_ok=True);LOCK.parent.mkdir(parents=True,exist_ok=True);LOCK.mkdir()
(LOCK/'owner.json').write_text(json.dumps(dict(PID=os.getpid(),cwd=str(ROOT),product='大鱼调色',started=datetime.datetime.now(datetime.timezone.utc).isoformat())))
@@ -49,7 +59,7 @@ def main():
run('codesign','--verify','--deep','--strict',str(APP))
details=run('codesign','-dvvv',str(APP))
if 'TeamIdentifier=B3W25FX5H5' not in details or 'Timestamp=' not in details or 'runtime' not in details:raise RuntimeError('签名身份/时间戳/runtime未通过')
preflight=json.loads(run(str(plugin/'Contents/MacOS/大鱼调色 XPC Service'),'--self-test'))
preflight=self_test(plugin/'Contents/MacOS/大鱼调色 XPC Service',CACHE/'release-preflight.json')
(CACHE/'release-preflight.json').write_text(json.dumps(preflight,ensure_ascii=False,indent=2)+'\n')
if not preflight.get('pass'):raise RuntimeError('Release集成自检失败,正式旧版未替换')
archive=CACHE/'notarization-submission.zip'
@@ -66,7 +76,7 @@ def main():
os.replace(stage,DEST);stage=None
try:
identity(DEST,'com.dayu.color');run('codesign','--verify','--deep','--strict',str(DEST));run('xcrun','stapler','validate',str(DEST));gate=run('spctl','--assess','--type','execute','--verbose=2',str(DEST))
installedTest=json.loads(run(str(DEST/PLUGIN/'Contents/MacOS/大鱼调色 XPC Service'),'--self-test'))
installedTest=self_test(DEST/PLUGIN/'Contents/MacOS/大鱼调色 XPC Service',CACHE/'installed-self-test.json')
if not installedTest.get('pass'):raise RuntimeError('正式安装版原生集成自检失败')
(ROOT/'verification/InstalledSelfTest.json').write_text(json.dumps(installedTest,ensure_ascii=False,indent=2)+'\n')
run('open',str(DEST))