Guard Linux speech runtime dependency closure and relocatable lookup
This commit is contained in:
1 parent
210f2b0136
commit
e71cace91f
5 files changed
+80
-1
No files matched your search
@@ -40,6 +40,24 @@ def sha(path):
|
||||
return result.hexdigest()
|
||||
|
||||
|
||||
def verify_linux_closure(directory):
|
||||
"""Reject build-tree lookup and undeclared ELF dependencies before release."""
|
||||
helper = shared_helper("build_runtime.py")
|
||||
directory = Path(directory)
|
||||
artifacts = [directory / "searchi-speech-worker"] + sorted(directory.glob("*.so*"))
|
||||
names = {path.name for path in artifacts}
|
||||
for path in artifacts:
|
||||
metadata = helper.elf_dynamic(path)
|
||||
if metadata.get("RPATH") or metadata.get("RUNPATH") != ["$ORIGIN"]:
|
||||
raise ValueError(f"Linux speech runtime requires origin-only RUNPATH: {path.name}")
|
||||
allowed = names | helper.LINUX_SYSTEM_LIBRARIES
|
||||
if path.name == "libggml-vulkan.so":
|
||||
allowed = allowed | {"libvulkan.so.1"}
|
||||
missing = set(metadata.get("NEEDED", [])) - allowed
|
||||
if missing:
|
||||
raise ValueError(f"Unpackaged Linux speech dependency for {path.name}: {sorted(missing)}")
|
||||
|
||||
|
||||
def validate_source(source):
|
||||
revision = subprocess.check_output(["git", "-C", str(source), "rev-parse", "HEAD"], text=True).strip()
|
||||
dirty = subprocess.check_output(["git", "-C", str(source), "status", "--porcelain"], text=True).strip()
|
||||
@@ -113,6 +131,8 @@ def main():
|
||||
raise ValueError("Ambiguous speech dependency basename")
|
||||
shutil.copy2(path, stage / path.name)
|
||||
records[path.name] = {"path": path.name, "bytes": path.stat().st_size, "sha256": digest}
|
||||
if args.device == "auto" and sys.platform.startswith("linux"):
|
||||
verify_linux_closure(stage)
|
||||
manifest = {"schema": 1, "upstream_commit": UPSTREAM, "device": args.device,
|
||||
"distribution": args.device == "auto", "source_hashes": source_hashes,
|
||||
"files": list(records.values()), "native_os_gpu_checks": "unexecuted"}
|
||||
|
||||
Reference in new issue
Block a user