From 158829a4189fdda2ccd6112497e15b1a3f457cd9 Mon Sep 17 00:00:00 2001 From: mac Date: Wed, 11 Nov 2026 21:23:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E9=BD=90=E5=85=AC=E8=AF=81=E7=AD=89?= =?UTF-8?q?=E5=BE=85=E4=B8=AD=E6=96=AD=E5=90=8E=E7=9A=84=E5=8E=9F=E4=BA=A7?= =?UTF-8?q?=E7=89=A9=E5=AE=89=E5=85=A8=E6=81=A2=E5=A4=8D=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/deliver.py | 95 +++++++++++++++------ verification/UnifiedLUTNotaryResume133.json | 13 +++ 开发交接.md | 2 +- 3 files changed, 82 insertions(+), 28 deletions(-) create mode 100644 verification/UnifiedLUTNotaryResume133.json diff --git a/tools/deliver.py b/tools/deliver.py index 83bbb79..32d8a82 100644 --- a/tools/deliver.py +++ b/tools/deliver.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Single-install Release delivery; keeps a product lock through host acceptance.""" from pathlib import Path -import subprocess,os,json,shutil,plistlib,uuid,sys,datetime,hashlib,time +import subprocess,os,json,shutil,plistlib,uuid,sys,datetime,hashlib,time,argparse,tempfile,re from template_payload import template_files ROOT=Path(__file__).resolve().parent.parent CACHE=Path('/Users/mac/Library/Caches/CodexBuilds/com.dayu.color') @@ -84,7 +84,43 @@ def write_template_file(target,data,mode,flags): finally: temp.unlink(missing_ok=True) +def resume_notary(submission,archive,expected_hash,source): + if not re.fullmatch(r'[0-9a-f]{40}',source or ''):raise RuntimeError('恢复须提供原始完整编译提交') + if not re.fullmatch(r'[0-9a-f]{64}',expected_hash or '') or hashlib.sha256(archive.read_bytes()).hexdigest()!=expected_hash:raise RuntimeError('公证提交 ZIP 摘要不匹配,停止恢复') + run('git','cat-file','-e',source+'^{commit}');identity(APP,'com.dayu.color');run('codesign','--verify','--deep','--strict',str(APP)) + # Validate the exact submitted bundle, including symlinks; never rebuild or re-sign. + with tempfile.TemporaryDirectory(prefix='notary-resume-',dir=CACHE) as scratch: + run('ditto','-x','-k',str(archive),scratch) + submitted=Path(scratch)/APP.name;identity(submitted,'com.dayu.color') + live={str(p.relative_to(APP)) for p in APP.rglob('*')};saved={str(p.relative_to(submitted)) for p in submitted.rglob('*')} + if live!=saved:raise RuntimeError('待安装 APP 与已提交 ZIP 内容清单不同') + for relative in live: + a=APP/relative;b=submitted/relative + if a.is_symlink() or b.is_symlink():same=a.is_symlink() and b.is_symlink() and os.readlink(a)==os.readlink(b) + elif a.is_dir() or b.is_dir():same=a.is_dir() and b.is_dir() + else:same=a.read_bytes()==b.read_bytes() + if not same:raise RuntimeError('待安装 APP 与已提交 ZIP 不一致:'+relative) + unregister(submitted/PLUGIN) + preflight=json.loads((CACHE/'release-preflight.json').read_text()) + if not preflight.get('pass'):raise RuntimeError('缺少通过的原始发布前检查') + print('Exact submitted APP verified; querying original Apple submission '+submission,flush=True) + failures=0 + while True: + try: + result=json.loads(run('xcrun','notarytool','info',submission,'--keychain-profile',PROFILE,'--keychain',KEYCHAIN,'--output-format','json'));failures=0 + except subprocess.CalledProcessError: + failures+=1 + if failures>=3:raise RuntimeError('连续三次无法读取 Apple 公证状态;产物保留,可继续原提交恢复') + time.sleep(15);continue + if result.get('id')!=submission:raise RuntimeError('公证编号不匹配') + if result.get('status')!='In Progress':return result + time.sleep(15) + def main(): + parser=argparse.ArgumentParser(description=__doc__) + parser.add_argument('--resume-notary');parser.add_argument('--submitted-zip-sha256');parser.add_argument('--compiled-source') + args=parser.parse_args() + if not args.resume_notary and (args.submitted_zip_sha256 or args.compiled_source):parser.error('摘要与编译提交仅用于恢复原公证提交') 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()))) old=None;stage=None @@ -92,32 +128,37 @@ def main(): ids=run('security','find-identity','-v','-p','codesigning') if IDENTITY not in ids:raise RuntimeError('有效发布证书或私钥不可用') if any(l.endswith('/Contents/MacOS/大鱼调色') for l in run('ps','-axo','comm=').splitlines()):raise RuntimeError('请先正常退出当前大鱼调色窗口') - print('Building final Release',flush=True) - run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'clean','build',log=CACHE/'release-build.log') - for source,bundled,_ in template_files(): - target=APP/BUNDLED_TEMPLATES/bundled - target.parent.mkdir(parents=True,exist_ok=True) - shutil.copyfile(ROOT/'template'/source,target) - target.chmod(0o644) - # Sources on exFAT can be exposed as owner-only. Installer changes ownership to root. - (APP/'Contents/Resources/Basis_balanceWheel.png').chmod(0o644) - identity(APP,'com.dayu.color');plugin=APP/PLUGIN;identity(plugin,'com.dayu.color.XPC') - # Xcode registers its build product with Launch Services. Keep the host from - # discovering this generated copy while signing/notarization are pending. - unregister(plugin);unregister(LOOSE) - for name in ['FxPlug','PluginManager']:run('codesign','--force','--timestamp','--options','runtime','--sign',IDENTITY,str(plugin/'Contents/Frameworks'/(name+'.framework'))) - run('codesign','--force','--timestamp','--options','runtime','--sign',IDENTITY,str(plugin)) - run('codesign','--force','--timestamp','--options','runtime','--entitlements',str(ROOT/'大鱼调色/Wrapper Application/SandboxEntitlements.entitlements'),'--sign',IDENTITY,str(APP)) - 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=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' - if archive.exists():archive.unlink() - run('ditto','-c','-k','--keepParent',str(APP),str(archive));print('Submitting signed Release to Apple',flush=True) - result=json.loads(run('xcrun','notarytool','submit',str(archive),'--keychain-profile',PROFILE,'--keychain',KEYCHAIN,'--wait','--output-format','json'));(CACHE/'notary-result.json').write_text(json.dumps(result,indent=2)) + if args.resume_notary: + result=resume_notary(args.resume_notary,archive,args.submitted_zip_sha256,args.compiled_source) + (CACHE/'notary-result.json').write_text(json.dumps(result,indent=2)) + else: + print('Building final Release',flush=True) + run('xcodebuild','-project','大鱼调色.xcodeproj','-scheme','Wrapper Application','-configuration','Release','-enableAddressSanitizer','NO','-derivedDataPath',str(CACHE/'DerivedData'),'clean','build',log=CACHE/'release-build.log') + for source,bundled,_ in template_files(): + target=APP/BUNDLED_TEMPLATES/bundled + target.parent.mkdir(parents=True,exist_ok=True) + shutil.copyfile(ROOT/'template'/source,target) + target.chmod(0o644) + # Sources on exFAT can be exposed as owner-only. Installer changes ownership to root. + (APP/'Contents/Resources/Basis_balanceWheel.png').chmod(0o644) + identity(APP,'com.dayu.color');plugin=APP/PLUGIN;identity(plugin,'com.dayu.color.XPC') + # Xcode registers its build product with Launch Services. Keep the host from + # discovering this generated copy while signing/notarization are pending. + unregister(plugin);unregister(LOOSE) + for name in ['FxPlug','PluginManager']:run('codesign','--force','--timestamp','--options','runtime','--sign',IDENTITY,str(plugin/'Contents/Frameworks'/(name+'.framework'))) + run('codesign','--force','--timestamp','--options','runtime','--sign',IDENTITY,str(plugin)) + run('codesign','--force','--timestamp','--options','runtime','--entitlements',str(ROOT/'大鱼调色/Wrapper Application/SandboxEntitlements.entitlements'),'--sign',IDENTITY,str(APP)) + 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=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' + if archive.exists():archive.unlink() + run('ditto','-c','-k','--keepParent',str(APP),str(archive));print('Submitting signed Release to Apple',flush=True) + result=json.loads(run('xcrun','notarytool','submit',str(archive),'--keychain-profile',PROFILE,'--keychain',KEYCHAIN,'--wait','--output-format','json'));(CACHE/'notary-result.json').write_text(json.dumps(result,indent=2)) if result.get('status')!='Accepted': if result.get('id'):run('xcrun','notarytool','log',result['id'],'--keychain-profile',PROFILE,'--keychain',KEYCHAIN,str(CACHE/'notary-rejection.json')) raise RuntimeError('Apple未Accepted,正式旧版未替换') @@ -154,7 +195,7 @@ def main(): if entries:break time.sleep(.5) if len(entries)!=1 or not entries[0].rstrip().endswith('\t'+str(DEST/PLUGIN)):raise RuntimeError('PluginKit发现多份/错误版本: '+registry) - record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=template_hashes[str(TEMPLATE.relative_to(TEMPLATE_ROOT))],installedTemplateSHA256=template_hashes,shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest()) + record=dict(status='installed-awaiting-host-verification',path=str(DEST),bundleID='com.dayu.color',version=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleShortVersionString'],build=plistlib.loads((DEST/'Contents/Info.plist').read_bytes())['CFBundleVersion'],team='B3W25FX5H5',notaryID=result['id'],notaryStatus=result['status'],gatekeeper=gate,sourceCommit=args.compiled_source or run('git','rev-parse','HEAD'),deliveryToolCommit=run('git','rev-parse','HEAD'),templatePath=str(TEMPLATE),templateSHA256=template_hashes[str(TEMPLATE.relative_to(TEMPLATE_ROOT))],installedTemplateSHA256=template_hashes,shaderSHA256=hashlib.sha256((DEST/PLUGIN/'Contents/Resources/default.metallib').read_bytes()).hexdigest()) if old:record['previousInstallBackup']=str(old) output=ROOT/'verification/Delivery.json';output.write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n') run('open',str(DEST));print('FORMAL_INSTALLED. Run installed self-test and host verification; type complete only after success. Type leave to preserve pending state.',flush=True) diff --git a/verification/UnifiedLUTNotaryResume133.json b/verification/UnifiedLUTNotaryResume133.json new file mode 100644 index 0000000..e7ab19e --- /dev/null +++ b/verification/UnifiedLUTNotaryResume133.json @@ -0,0 +1,13 @@ +{ + "version": "1.22.1", + "build": 133, + "sourceCommit": "7f833757da243f2a4610c23c36ec278b44c80ad4", + "notaryID": "0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d", + "notaryStatus": "In Progress", + "waitCommandInterrupted": true, + "submittedZIP_SHA256": "7b3a0c068482834f1db96162c84d84af1419cb74429bb3a17edc10b3af85156a", + "preflightPassed": true, + "preflightChecks": 1028, + "installed": false, + "resume": "tools/deliver.py --resume-notary --submitted-zip-sha256 --compiled-source " +} diff --git a/开发交接.md b/开发交接.md index 3f80dac..d8e4535 100644 --- a/开发交接.md +++ b/开发交接.md @@ -10,7 +10,7 @@ 已实现:移除来源切换菜单、统一可展开分类树、自动捕获开窗缓存帧、后台预载当前在线页(并发 2)、独立在线预览缓存与取消状态、安装后立即刷新本地子分类。新帧不连续上传,保留“更新预览”操作。预览缩略图最长边 640、最多 230400 像素,服务器不保存帧。首次无缓存帧时在收到第一帧后自动补载。主 APP 和安装说明同步更新。 -已通过 68 项模拟网络/真实本地导入检查与 40 项本地浏览器回归,覆盖空缓存首次补载、竖屏 640 上限、关窗取消、二级分类折叠及离线可用。最终源码 `7f833757da243f2a4610c23c36ec278b44c80ad4` 已从独立 HTTPS 检出构建,921 个跟踪文件逐字节核对。Release 构建及 1,028 项发布前检查通过,APP 公证 `0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d` 当前 In Progress;旧版尚未替换。132 在公证等待期间发现离线按钮边界问题,已停止安装;正式旧版仍为 131。133 补齐后台错误不影响本地按钮、缓存帧编码不等待本地 LUT 解析队列。尚未安装、公证或发行 133。下一步:完成回归,保存源码检查点后正式构建、公证、唯一安装和 FCP 合成色卡验收,再制包与 Release 下载核验。验收只用合成图,不改用户时间线。 +已通过 68 项模拟网络/真实本地导入检查与 40 项本地浏览器回归,覆盖空缓存首次补载、竖屏 640 上限、关窗取消、二级分类折叠及离线可用。最终源码 `7f833757da243f2a4610c23c36ec278b44c80ad4` 已从独立 HTTPS 检出构建,921 个跟踪文件逐字节核对。Release 构建及 1,028 项发布前检查通过,APP 公证 `0a1d2d49-1a03-4cd4-acbe-ba37f1fee42d` 当前 In Progress;等待命令异常中断,旧版尚未替换。已添加只恢复原提交的交付入口,核对原 ZIP SHA-256 和完整 APP 文件/符号链接一致性后继续查询,不重编、不重签、不重传。恢复参数见 [恢复记录](verification/UnifiedLUTNotaryResume133.json)。132 在公证等待期间发现离线按钮边界问题,已停止安装;正式旧版仍为 131。133 补齐后台错误不影响本地按钮、缓存帧编码不等待本地 LUT 解析队列。尚未安装、公证或发行 133。下一步:完成回归,保存源码检查点后正式构建、公证、唯一安装和 FCP 合成色卡验收,再制包与 Release 下载核验。验收只用合成图,不改用户时间线。 131 的完整交付记录见 [此前交接](research/OnlineLUTRelease131Handoff.md)、[发行](verification/Release1.22.0.json)、[恢复](verification/Recovery1.22.0.json)。站点文章与主 APP 更新通道仍为 1.21.8(126),本轮不变。