Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
36 lines
1.8 KiB
Python
36 lines
1.8 KiB
Python
#!/usr/bin/python3
|
|
"""Prepare a private Openbox runtime using local APT metadata and installed dependencies."""
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import apt
|
|
|
|
ROOT=Path(__file__).resolve().parents[2]
|
|
destination=ROOT/'build_blender_native'/'desktop-runtime'
|
|
archives=destination/'archives';archives.mkdir(parents=True,exist_ok=True)
|
|
cache=apt.Cache();pending=[cache['openbox'].candidate];selected={}
|
|
while pending:
|
|
version=pending.pop()
|
|
if version is None:raise RuntimeError('OPENBOX_PACKAGE_UNAVAILABLE')
|
|
name=version.package.name
|
|
if name in selected:continue
|
|
selected[name]=version
|
|
for dependency in version.get_dependencies('Depends','PreDepends'):
|
|
if dependency.installed_target_versions:continue
|
|
candidates=dependency.target_versions
|
|
if not candidates:raise RuntimeError('DEPENDENCY_UNAVAILABLE: '+dependency.rawstr)
|
|
candidate=next((item for item in candidates if item==item.package.candidate),candidates[0])
|
|
pending.append(candidate)
|
|
report={'schemaVersion':1,'status':'PREPARED_UNVERIFIED','validation':'NOT_RUN','packages':[]}
|
|
for name,version in selected.items():
|
|
archive_name=Path(version.filename).name
|
|
cached=Path('/var/cache/apt/archives')/archive_name
|
|
if cached.is_file() and not (archives/archive_name).exists():shutil.copyfile(cached,archives/archive_name)
|
|
file=Path(version.fetch_binary(str(archives),allow_unauthenticated=False))
|
|
subprocess.run(['dpkg-deb','--extract',str(file),str(destination)],check=True)
|
|
report['packages'].append({'name':name,'version':version.version,'sha256':hashlib.sha256(file.read_bytes()).hexdigest(),'bytes':file.stat().st_size})
|
|
(destination/'manifest.json').write_text(json.dumps(report,indent=2)+'\n')
|
|
print(json.dumps({'directory':str(destination),**report}),flush=True)
|