The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(termux): preserve copyright links and their shared license files
ethernet85d8c651ac7f
diff --git a/scripts/termux/runtime_libs.json b/scripts/termux/runtime_libs.jsonindex 1792df454b2..7f030f69aa9 100644--- a/scripts/termux/runtime_libs.json+++ b/scripts/termux/runtime_libs.json@@ -1,5 +1,10 @@{"_comment": "Pinned runtime libraries for Python, Node, uv, and ffmpeg. The ffmpeg set follows the real binaries' recursive DT_NEEDED dependencies; libc and Android system libraries remain platform-provided. Artifacts and hashes were verified from the Termux package pool.",+ "licenses": {+ "sha256": "a3265cd1cf7d04754f2fb683eaf5b21918263792fd714457127900c1d6d9bcd9",+ "url": "https://packages.termux.dev/apt/termux-main/pool/main/t/termux-licenses/termux-licenses_2.2_all.deb",+ "version": "2.2"+ },"libs": {"brotli": {"sha256": "db1502601d40fb44e6085ad8bfd9311a8b472e98db831ceec9d404c5708bb52c",diff --git a/scripts/termux/stage_runtime_libs.py b/scripts/termux/stage_runtime_libs.pyindex 7eeabb589c5..03f5da7e1a4 100644--- a/scripts/termux/stage_runtime_libs.py+++ b/scripts/termux/stage_runtime_libs.py@@ -126,7 +126,7 @@ def _ensure_extracted(work: Path, name: str, row: dict) -> Path:return extract-def stage(payload: Path, table: dict) -> Path:+def stage(payload: Path, table: dict, licenses: dict | None = None) -> Path:"""Stage every pinned runtime lib into <payload>/runtime-libs/lib/.Returns the merged output dir. Raises StageError on any failure; the@@ -138,7 +138,8 @@ def stage(payload: Path, table: dict) -> Path:work = payload / ".work" / "runtime-libs"manifest_path = payload / "runtime-libs" / MANIFEST_NAME- if _cache_valid(out, manifest_path, table):+ identity = {"libs": table, "licenses": licenses}+ if _cache_valid(out, manifest_path, identity):print(f"runtime libs already staged (manifest-verified): "f"{len(list(out.glob('*.so*')))} .so* -> {out}")return out@@ -174,17 +175,23 @@ def stage(payload: Path, table: dict) -> Path:notices = extract / PREFIX_REL / "share/doc"if notices.is_dir():target = payload / "runtime-libs/share/doc"- shutil.copytree(notices, target, dirs_exist_ok=True)+ shutil.copytree(notices, target, dirs_exist_ok=True, symlinks=True)merged += nprint(f" {name} {row['version']}: {n} new .so* -> runtime-libs/lib")if not any(out.glob("*.so*")):raise StageError("no shared objects staged")+ if licenses:+ extract = _ensure_extracted(work, "termux-licenses", licenses)+ shutil.copytree(+ extract / PREFIX_REL / "share/LICENSES", payload / "runtime-libs/share/LICENSES",+ dirs_exist_ok=True, symlinks=True,+ )# Manifest last: its existence is the promise that the build above# completed for the exact table.manifest = {- "table_sha256": _table_sha256(table),+ "table_sha256": _table_sha256(identity),"files": {p.name: _sha256_file(p) for p in sorted(out.glob("*.so*"))},}manifest_path.write_text(@@ -199,10 +206,9 @@ def main() -> int:print("usage: stage_runtime_libs.py <payload-dir>", file=sys.stderr)return 2payload = Path(sys.argv[1]).resolve()- table = json.loads(- (HERE / "runtime_libs.json").read_text(encoding="utf-8"))["libs"]+ table = json.loads((HERE / "runtime_libs.json").read_text(encoding="utf-8"))try:- stage(payload, table)+ stage(payload, table["libs"], table.get("licenses"))except Exception as exc: # noqa: BLE001 -- CLI boundary reports and exitsprint(f"runtime-lib staging failed: {exc}", file=sys.stderr)return 1