mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-10 18:59:56 +00:00
ship-ci / ci (push) Waiting to run
Rebased onto merged main (was stacked on #1023/#1024, whose venue work is
now in main) so it no longer carries a stale content_packs.py that would
revert 1023's build_pack fixes.
- build_vst_pack: slice a fat .vst3 tree to one platform (keep its binary
dir + shared bundle files, drop the two foreign platform dirs and src/
build trees). Pins create_system=3 like build_pack — without it the same
tree hashes differently on a Windows runner (native .vst3 are built there),
breaking the precomputable-hash guarantee exactly where it matters.
- Publish wiring: 'python tools/content_packs.py <vst-root> --vst --version N
--publish' builds+uploads vst-<plat>-vN releases for mac/win/linux and emits
a platform-keyed {url,sha256,bytes} manifest — the shape rig_builder's
data/vst_packs.json consumes. publish() refactored onto a shared
_publish_release helper (venue behaviour unchanged).
- Tests: slice keeps target+shared/drops foreign, per-platform binary,
reproducibility, unknown-platform reject, and a simulated-win32 guard that
fails if the create_system pin is dropped. selfcheck covers the VST path.
Original build_vst_pack by Matthew Harris Glover; reworked for the create_system
fix, publish wiring, and rebase.
Signed-off-by: byrongamatos <xasiklas@gmail.com>
Co-authored-by: byrongamatos <xasiklas@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
92 lines
3.8 KiB
Python
92 lines
3.8 KiB
Python
"""VST-pack slicing (tools/content_packs.build_vst_pack): each platform pack
|
|
keeps only its own binaries + the shared bundle files, drops the rest, and is
|
|
reproducible."""
|
|
import zipfile
|
|
from pathlib import Path
|
|
|
|
from tools import content_packs
|
|
|
|
|
|
def _fake_vst_tree(root: Path):
|
|
# One fat .vst3 with all three platform binaries + shared files, plus a
|
|
# src/ build tree that must never ship.
|
|
c = root / "amps" / "Foo.vst3" / "Contents"
|
|
(c / "MacOS").mkdir(parents=True)
|
|
(c / "x86_64-win").mkdir(parents=True)
|
|
(c / "x86_64-linux").mkdir(parents=True)
|
|
(c / "Resources").mkdir(parents=True)
|
|
(c / "MacOS" / "Foo").write_bytes(b"mac-binary")
|
|
(c / "x86_64-win" / "Foo.vst3").write_bytes(b"win-binary")
|
|
(c / "x86_64-linux" / "Foo.so").write_bytes(b"linux-binary")
|
|
(c / "Info.plist").write_bytes(b"<plist/>")
|
|
(c / "Resources" / "moduleinfo.json").write_bytes(b"{}")
|
|
(root / "src" / "build").mkdir(parents=True)
|
|
(root / "src" / "build" / "junk.o").write_bytes(b"objfile")
|
|
|
|
|
|
def _names(zip_path):
|
|
with zipfile.ZipFile(zip_path) as zf:
|
|
return set(zf.namelist())
|
|
|
|
|
|
def test_slice_keeps_target_platform_and_shared_drops_foreign(tmp_path):
|
|
root = tmp_path / "vst"
|
|
_fake_vst_tree(root)
|
|
content_packs.build_vst_pack(root, tmp_path / "mac.zip", "mac")
|
|
names = _names(tmp_path / "mac.zip")
|
|
|
|
base = "amps/Foo.vst3/Contents"
|
|
assert f"{base}/MacOS/Foo" in names # target binary kept
|
|
assert f"{base}/Info.plist" in names # shared kept
|
|
assert f"{base}/Resources/moduleinfo.json" in names # shared kept
|
|
assert f"{base}/x86_64-win/Foo.vst3" not in names # foreign dropped
|
|
assert f"{base}/x86_64-linux/Foo.so" not in names # foreign dropped
|
|
assert not any(n.startswith("src/") for n in names) # build trees never ship
|
|
|
|
|
|
def test_each_platform_gets_its_own_binary(tmp_path):
|
|
root = tmp_path / "vst"
|
|
_fake_vst_tree(root)
|
|
wanted = {"mac": "MacOS/Foo", "win": "x86_64-win/Foo.vst3", "linux": "x86_64-linux/Foo.so"}
|
|
for plat, rel in wanted.items():
|
|
content_packs.build_vst_pack(root, tmp_path / f"{plat}.zip", plat)
|
|
names = _names(tmp_path / f"{plat}.zip")
|
|
assert f"amps/Foo.vst3/Contents/{rel}" in names
|
|
others = [v for k, v in wanted.items() if k != plat]
|
|
for o in others:
|
|
assert f"amps/Foo.vst3/Contents/{o}" not in names
|
|
|
|
|
|
def test_slice_is_reproducible(tmp_path):
|
|
root = tmp_path / "vst"
|
|
_fake_vst_tree(root)
|
|
a = content_packs.build_vst_pack(root, tmp_path / "a.zip", "linux")
|
|
b = content_packs.build_vst_pack(root, tmp_path / "b.zip", "linux")
|
|
assert a == b and a["sha256"]
|
|
|
|
|
|
def test_slice_pins_create_system_for_cross_runner_reproducibility(tmp_path, monkeypatch):
|
|
# ZipInfo defaults create_system from the host OS (0 on Windows, 3 on Unix),
|
|
# and it lands in the central directory — so without an explicit pin the same
|
|
# tree hashes differently on a Windows runner, breaking the precomputable-hash
|
|
# guarantee exactly where it matters (native .vst3 are built on Windows). A
|
|
# same-machine reproducibility test can't catch that; simulate win32 and
|
|
# assert the pin forces 3 regardless.
|
|
monkeypatch.setattr(zipfile.sys, "platform", "win32")
|
|
root = tmp_path / "vst"
|
|
_fake_vst_tree(root)
|
|
content_packs.build_vst_pack(root, tmp_path / "w.zip", "linux")
|
|
with zipfile.ZipFile(tmp_path / "w.zip") as zf:
|
|
assert all(i.create_system == 3 for i in zf.infolist())
|
|
|
|
|
|
def test_unknown_platform_rejected(tmp_path):
|
|
root = tmp_path / "vst"
|
|
_fake_vst_tree(root)
|
|
try:
|
|
content_packs.build_vst_pack(root, tmp_path / "x.zip", "bsd")
|
|
except ValueError as e:
|
|
assert "unknown platform" in str(e)
|
|
else:
|
|
raise AssertionError("build_vst_pack accepted an unknown platform")
|