mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 15:56:01 +00:00
feat: ship proot, DirectAudio, Xbox, Comet and hand tracking as CI-built add-on packs (#1198)
* perf: download hand tracking models and native libs on first use * feat: build and publish add-on packs in CI, add Xbox and Comet packs * feat: ship proot and DirectAudio drivers as CI-built packs * test: hand tracking readiness requires the tracking pack * ci: attach PR test-build packs to the PR release instead of Components
This commit is contained in:
1 parent
ece1df0da8
commit
61254786e6
72 files changed
+710
-112
No files matched your search
@@ -12,6 +12,14 @@ from zipfile import ZipFile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
MANIFEST = Path('app/build/runtime-inputs.json')
|
||||
PACKS = Path('app/build/packs')
|
||||
# Runtime trees shipped as add-on packs (tools/packs/build.sh) rather than inside the APK.
|
||||
PACKED = {'assets/linuxfs/usr/local/lib/droiddeck-xbox/': 'xbox', 'assets/linuxfs/usr/local/lib/droiddeck-comet/': 'comet',
|
||||
'assets/directaudio/': 'directaudio'}
|
||||
PACKED_FILES = {'lib/arm64-v8a/libproot.so': ('proot', 'libproot.so'),
|
||||
'lib/arm64-v8a/libproot-loader.so': ('proot', 'libproot-loader.so')}
|
||||
PACKED_LIBRARIES = ['lib/arm64-v8a/libopencv_java4.so', 'lib/arm64-v8a/libmediapipe_tasks_jni.so']
|
||||
PACK_NAMES = ['proot', 'directaudio', 'tracking', 'xbox', 'comet']
|
||||
SOURCE_PATHS = ['app/build.gradle', 'app/src/main/cpp/fakeinput_steam.cpp', 'app/src/main/assets/pulseaudio.tzst',
|
||||
'tools/linuxfs', 'tools/proot', 'tools/aaudio-sink', 'tools/directaudio',
|
||||
'tools/gamescope/release.env', 'tools/droiddeck-esync/release.env',
|
||||
@@ -157,10 +165,49 @@ def verify(root=ROOT):
|
||||
return data
|
||||
|
||||
|
||||
def pack_digests(root, name):
|
||||
path = root / PACKS / (name + '.tar.zst')
|
||||
if not path.is_file():
|
||||
raise ValueError('Missing add-on pack ' + name + '. Run tools/packs/build.sh app/build/packs.')
|
||||
process = subprocess.Popen(['zstd', '-dc', str(path)], stdout=subprocess.PIPE)
|
||||
digests = {}
|
||||
try:
|
||||
with tarfile.open(fileobj=process.stdout, mode='r|') as archive:
|
||||
for member in archive:
|
||||
if member.isfile():
|
||||
digests[member.name] = hashlib.sha256(archive.extractfile(member).read()).hexdigest()
|
||||
finally:
|
||||
process.stdout.close()
|
||||
if process.wait():
|
||||
raise ValueError('Invalid add-on pack ' + name)
|
||||
return digests
|
||||
|
||||
|
||||
def check_apk(apk, root=ROOT):
|
||||
data = verify(root)
|
||||
packs = {name: pack_digests(root, name) for name in PACK_NAMES}
|
||||
with ZipFile(apk) as package:
|
||||
names = set(package.namelist())
|
||||
for library in PACKED_LIBRARIES:
|
||||
if library in names:
|
||||
raise ValueError('APK still carries ' + library + ', which the tracking pack provides')
|
||||
if library.rsplit('/', 1)[1] not in packs['tracking']:
|
||||
raise ValueError('Tracking pack missing ' + library)
|
||||
for name, output in data['outputs'].items():
|
||||
if name in PACKED_FILES:
|
||||
pack, rel = PACKED_FILES[name]
|
||||
if name in names:
|
||||
raise ValueError('APK still carries ' + name + ', which the ' + pack + ' pack provides')
|
||||
if packs[pack].get(rel) != output['sha256']:
|
||||
raise ValueError('Add-on pack ' + pack + ' is missing or has a stale ' + name)
|
||||
continue
|
||||
prefix = next((p for p in PACKED if name.startswith(p)), None)
|
||||
if prefix:
|
||||
if name in names:
|
||||
raise ValueError('APK still carries ' + name + ', which the ' + PACKED[prefix] + ' pack provides')
|
||||
if packs[PACKED[prefix]].get(name[len(prefix):]) != output['sha256']:
|
||||
raise ValueError('Add-on pack ' + PACKED[prefix] + ' is missing or has a stale ' + name)
|
||||
continue
|
||||
try:
|
||||
content = package.read(name)
|
||||
except KeyError:
|
||||
|
||||
Reference in new issue
Block a user