build: package verified Dayu Color app and FCP template using PKG Forge skill
这个提交包含在:
1 父节点
cd54104b6a
当前提交
2bb062c82f
2 个文件已更改
+117
没有与搜索条件相匹配的文件
@@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Package the verified formal Dayu Color installation through the PKG Forge skill."""
|
||||
import argparse
|
||||
import datetime
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
APP = Path("/Library/Plug-Ins/FxPlug/大鱼调色.app")
|
||||
CACHE = Path.home() / "Library/Caches/CodexBuilds/com.dayu.color"
|
||||
LOCK = Path.home() / ".codex/app-delivery-locks/com.dayu.color.lock"
|
||||
|
||||
|
||||
def run(*args, cwd=None):
|
||||
return subprocess.check_output(args, cwd=cwd, text=True, stderr=subprocess.STDOUT).strip()
|
||||
|
||||
|
||||
def history(profile, keychain):
|
||||
return json.loads(run("xcrun", "notarytool", "history", "--keychain-profile", profile,
|
||||
"--keychain", keychain, "--output-format", "json"))["history"]
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--pkg-forge-repo", type=Path,
|
||||
default=Path.home() / "Documents/dayu-git/repositories/pkg-forge")
|
||||
parser.add_argument("--output-dir", type=Path, default=ROOT.parent / "发行包")
|
||||
parser.add_argument("--prepare-only", action="store_true")
|
||||
args = parser.parse_args()
|
||||
args.output_dir = args.output_dir.expanduser().resolve()
|
||||
forge = args.pkg_forge_repo.expanduser().resolve()
|
||||
skill = forge / "skills/pkg-forge/scripts"
|
||||
assert (skill / "package_fxplug.py").is_file(), "请指定含 pkg-forge 技能的 PKG 工坊 checkout"
|
||||
delivery = json.loads((ROOT / "verification/Delivery.json").read_text())
|
||||
info = plistlib.loads((APP / "Contents/Info.plist").read_bytes())
|
||||
assert delivery["status"] == "verified" and delivery["path"] == str(APP)
|
||||
assert info["CFBundleIdentifier"] == "com.dayu.color"
|
||||
assert (info["CFBundleShortVersionString"], info["CFBundleVersion"]) == (delivery["version"], delivery["build"])
|
||||
args.output_dir.mkdir(parents=True, exist_ok=True)
|
||||
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="大鱼调色", phase="PKG packaging", started=datetime.datetime.now(datetime.timezone.utc).isoformat())))
|
||||
try:
|
||||
source = APP / "Contents/Resources/FCP Templates"
|
||||
staged = CACHE / "pkg-inputs/大鱼调色/大鱼调色"
|
||||
staged.mkdir(parents=True, exist_ok=True)
|
||||
hashes = {}
|
||||
for name in ["大鱼调色.moef", "large.png", "small.png"]:
|
||||
data = (source / name).read_bytes()
|
||||
assert data == (ROOT / "template" / name).read_bytes(), name
|
||||
target = staged / name
|
||||
if target.exists():
|
||||
os.chflags(target, 0)
|
||||
target.write_bytes(data)
|
||||
target.chmod(0o644)
|
||||
if name.endswith(".png"):
|
||||
os.chflags(target, 2)
|
||||
hashes[name] = hashlib.sha256(data).hexdigest()
|
||||
for folder in [staged, staged.parent]:
|
||||
folder.chmod(0o755)
|
||||
keychain = str(Path.home() / "Library/Keychains/login.keychain-db")
|
||||
profile = "codex-dayu-notary-B3W25FX5H5"
|
||||
version = info["CFBundleShortVersionString"]
|
||||
manifest = dict(name="大鱼调色", output=str(args.output_dir / "大鱼调色.pkg"),
|
||||
identifierPrefix="com.dayu.color.installer", resources=[dict(source=str(APP)),
|
||||
dict(source=str(staged.parent), destination="~/Movies/Motion Templates.localized/Effects.localized")],
|
||||
signing=dict(identity="Developer ID Installer: zhong luo (B3W25FX5H5)", profile=profile,
|
||||
keychain=keychain, notaryKeychain=keychain),
|
||||
appearance=dict(title="大鱼调色", subtitle="适用于 Final Cut Pro 与 Motion 的原生调色效果",
|
||||
badgeImage=str(ROOT / "design/dayu-color-app-icon-v1.png"), authorContact="https://dayu.media"),
|
||||
pages=dict(welcome="安装大鱼调色 " + version + ",包含原生 FxPlug 调色插件和 Final Cut Pro 效果入口。",
|
||||
readme="系统要求:macOS 14.6 或更高版本。本发行构建适用于 Apple Silicon Mac。\n\n安装内容:\n/Library/Plug-Ins/FxPlug/大鱼调色.app\n登录用户“影片/Motion Templates/Effects/大鱼调色”中的效果模板与预览图。\n\n重新打开 Final Cut Pro 后,在“效果 → 大鱼调色”中应用;Motion 中可选择原生滤镜。\n本安装包不包含用户自选 LUT、预设或媒体文件。",
|
||||
license="", conclusion="大鱼调色已安装。请完成插件 APP 的系统提示,随后退出并重新打开 Final Cut Pro / Motion。\n如果效果未出现,可在访达打开 /Library/Plug-Ins/FxPlug/大鱼调色.app 后再次启动宿主。"))
|
||||
manifest_path = CACHE / "dayu-color-package-manifest.json"
|
||||
manifest_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n")
|
||||
command = ["/usr/bin/python3", str(skill / "package_fxplug.py"), "--repo", str(forge), "--manifest", str(manifest_path)]
|
||||
subprocess.run(command + ["--check"], check=True)
|
||||
if args.prepare_only:
|
||||
print("清单:" + str(manifest_path))
|
||||
return
|
||||
before = {x["id"] for x in history(profile, keychain)}
|
||||
log_path = CACHE / "pkg-release-build.log"
|
||||
with log_path.open("w") as log:
|
||||
subprocess.run(command, stdout=log, stderr=subprocess.STDOUT, check=True)
|
||||
package = args.output_dir / ("大鱼调色-" + version + ".pkg")
|
||||
report_path = ROOT / "verification/Package.json"
|
||||
subprocess.run(["/usr/bin/python3", str(skill / "verify_fxplug_package.py"), "--manifest", str(manifest_path),
|
||||
"--package", str(package), "--report", str(report_path)], check=True)
|
||||
jobs = [x for x in history(profile, keychain) if x["id"] not in before and x["name"] == package.name]
|
||||
assert len(jobs) == 1, "安装包已生成,请核对公证 ID;不要重复提交同一包"
|
||||
job = json.loads(run("xcrun", "notarytool", "info", jobs[0]["id"], "--keychain-profile", profile,
|
||||
"--keychain", keychain, "--output-format", "json"))
|
||||
assert job["status"] == "Accepted"
|
||||
report = json.loads(report_path.read_text())
|
||||
report.update(notarization=job, appCompiledSource=delivery["sourceCommit"], appBuild=info["CFBundleVersion"],
|
||||
packageBuilderRemote="https://dayu.media/git/dayu/pkg-forge.git",
|
||||
packageBuilderCommit=run("git", "rev-parse", "HEAD", cwd=forge), templateSHA256=hashes,
|
||||
installedAppHostAcceptance="verification/HostLUTLoading.json",
|
||||
installScope="本轮仅生成并验包,未再次执行系统安装;正式 APP 已有独立宿主验收。")
|
||||
report_path.write_text(json.dumps(report, ensure_ascii=False, indent=2) + "\n")
|
||||
print("正式安装包:" + str(package))
|
||||
finally:
|
||||
(LOCK / "owner.json").unlink()
|
||||
LOCK.rmdir()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -35,3 +35,5 @@
|
||||
`tools/create_group_fold_host_fixture.py` 可创建独立的合成验收时间线,用于检查新实例仅基础调节默认启用、分组展开/折叠与数值保留。风格 LUT 总组停用会旁路全部五层;停用的输入或风格 LUT 不加载其文件。
|
||||
|
||||
LUT 文件夹扫描、逐项校验/复制和选择文件后的解析均在后台执行;导入期间可继续搜索、滚动和选择,刷新按钮临时变为“取消”。失败或取消会移除本次新复制的文件并保留既有库。目录与缩略图只为可见范围创建控件,预览逐项出现;快速切换时仅应用最后一次选择。24个65级合成LUT与3,025项库的响应测试见 [LUTResponsiveness.json](verification/LUTResponsiveness.json)。
|
||||
|
||||
正式 PKG 打包使用 PKG 工坊源码中的 `pkg-forge` 技能。运行 `python3 Packaging/build_pkg.py --pkg-forge-repo /实际/PKG工坊源码目录`,默认输出到上级“发行包”目录;先使用 `--prepare-only` 可只检查清单。打包使用已验证的正式 APP,并从相同 APP 资源中核对、整理 FCP 模板与缩略图,不重签或重建调色 APP。生成包将要求正常退出四种 FCP/Motion 宿主并在登录用户会话验证注册;签名公证和真实展开验包由该技能的原打包器与校验器完成。已有同名版本包不会覆盖。
|
||||
在新工单中引用
屏蔽一个用户