Integrate corrected char expressions into Liam code36
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build/verify one trusted persona debug profile over unchanged code33 media.
|
||||
"""Build/verify one trusted persona debug profile with an explicit immutable media bundle.
|
||||
|
||||
No gateway mutations, voice selection, model calls or device installation.
|
||||
Default profile can be built and verified separately without publishing a main APK.
|
||||
@@ -32,12 +32,15 @@ def file_sha(p):
|
||||
return hashlib.file_digest(f, 'sha256').hexdigest()
|
||||
|
||||
|
||||
def flags(profile, version):
|
||||
pin = select.catalog()['mediaBundles']['black-correct03']['indexSha256']
|
||||
return ['-PcharacterProfile='+profile, '-PactionVersionCode='+str(version),
|
||||
def flags(profile, version, media_bundle='black-correct03'):
|
||||
media = select.catalog()['mediaBundles'][media_bundle]
|
||||
pin = media['indexSha256']
|
||||
return ['-PcharacterProfile='+profile, '-PcharacterMediaBundle='+media_bundle,
|
||||
'-PavatarUserNetworkActions='+str(media.get('networkActionsAllowed',False)).lower(),
|
||||
'-PactionVersionCode='+str(version),
|
||||
'-PnaturalManifestSha=0a3c4918ba746019cf1df885bec66e5858a8950997dac4f64e7d37094be64dad',
|
||||
'-PemotionManifestSha='+pin] + ['-P'+name+'=true' for name in (
|
||||
'avatarUserNetworkActions', 'avatarUserAssetCandidate', 'avatarActionCandidate',
|
||||
'avatarUserAssetCandidate', 'avatarActionCandidate',
|
||||
'avatarNatural', 'avatarMouthCandidate', 'avatarFullActionCandidate', 'avatarPlaybackClockFix',
|
||||
'avatarStartupFix', 'presenceCandidate', 'faceDiagnosticsFix', 'cameraCompatibilityFix',
|
||||
'cameraDirectYuv', 'cameraPreviewStream', 'cameraProbeDiagnostic')]
|
||||
@@ -47,26 +50,32 @@ def build_dir(profile):
|
||||
return ROOT/('app/build' if profile == 'main' else 'app/build/characters/'+profile)
|
||||
|
||||
|
||||
def verify(apk, profile, version):
|
||||
def verify(apk, profile, version, media_bundle='black-correct03'):
|
||||
catalog = select.catalog()
|
||||
role = catalog['profiles'][profile]
|
||||
media = catalog['mediaBundles']['black-correct03']
|
||||
media = catalog['mediaBundles'][media_bundle]
|
||||
selected = select.selection(ROOT/'app/src/main/assets', profile, emotion_sha=media['indexSha256'],
|
||||
user_assets=True, mouth=True, startup=True)
|
||||
user_assets=True, mouth=True, startup=True, media_bundle=media_bundle)
|
||||
require(file_sha(BASELINE) == BASELINE_SHA, 'code33 rollback drift')
|
||||
with zipfile.ZipFile(BASELINE) as old, zipfile.ZipFile(apk) as new:
|
||||
names = lambda z: {n for n in z.namelist() if n.startswith('assets/') and not n.endswith('/')}
|
||||
require(names(new) == names(old) == {'assets/'+n for n in selected['files']}, 'APK selection inventory mismatch')
|
||||
require(names(new) == {'assets/'+n for n in selected['files']}, 'APK selection inventory mismatch')
|
||||
if media_bundle == 'black-correct03':
|
||||
require(names(new) == names(old), 'code33 inventory drift')
|
||||
for name in names(new):
|
||||
raw = new.read(name)
|
||||
row = selected['files'][name[7:]]
|
||||
require(raw == old.read(name) and len(raw) == row['bytes'] and select.digest(raw) == row['sha256'],
|
||||
require(len(raw) == row['bytes'] and select.digest(raw) == row['sha256'],
|
||||
'APK media drift: '+name)
|
||||
if media_bundle == 'black-correct03' or name in names(old):
|
||||
require(raw == old.read(name), 'shared/retained code33 bytes drift: '+name)
|
||||
if name.endswith('.mp4'):
|
||||
require(new.getinfo(name).compress_type == zipfile.ZIP_STORED, 'video compression drift')
|
||||
for name in ('startup_poster', 'startup_black_tulle_poster'):
|
||||
n = 'res/drawable-nodpi-v4/'+name+'.png'
|
||||
require(new.read(n) == old.read(n), 'poster resource drift')
|
||||
poster_path='res/drawable-nodpi-v4/'+media['posterResource']+'.png'
|
||||
require(new.read(poster_path)==new.read('assets/'+media['bootstrapRoot']+'poster.png'), 'selected poster mismatch')
|
||||
# Read real DEX static values rather than trusting a generated Java file.
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
dex_text = ''
|
||||
@@ -87,7 +96,7 @@ def verify(apk, profile, version):
|
||||
'STARTUP_MANIFEST_SHA': media['bootstrapSha256']}
|
||||
for field, value in expected.items():
|
||||
require(dex_values.get(field) == '"'+value+'"', 'APK DEX mismatch: '+field)
|
||||
for field, value in {'AVATAR_NETWORK_ACTIONS_ALLOWED': True, 'AVATAR_USER_ASSET_CANDIDATE': True,
|
||||
for field, value in {'AVATAR_NETWORK_ACTIONS_ALLOWED': media.get('networkActionsAllowed',False), 'AVATAR_USER_ASSET_CANDIDATE': True,
|
||||
'PERMISSION_CONNECTION_RETENTION': role['permissionConnectionRetention']}.items():
|
||||
require(dex_values.get(field) == str(value).lower(), 'APK DEX boolean mismatch: '+field)
|
||||
require(dex_values.get('VERSION_CODE') == str(version) and
|
||||
@@ -111,7 +120,9 @@ def verify(apk, profile, version):
|
||||
re.search(r'android:allowBackup[^\n]*', xml)[0], 'backup mismatch')
|
||||
return {'profile': profile, 'application_id': role['applicationId'], 'persona': role['persona'],
|
||||
'version_name': version_name, 'version_code': version, 'certificate_sha256': CERT,
|
||||
'index_sha256': media['indexSha256'], 'assets_unchanged': len(selected['files']),
|
||||
'index_sha256': media['indexSha256'], 'media_bundle':media_bundle, 'asset_files_verified':len(selected['files']),
|
||||
'assets_unchanged': len(selected['files']) if media_bundle=='black-correct03' else None,
|
||||
'network_actions_allowed':media.get('networkActionsAllowed',False),
|
||||
'poster_resources_unchanged': 2, 'provider_authorities': authorities,
|
||||
'actual_dex_verified': True, 'device': 'not_run', 'gateway_changed': False}
|
||||
|
||||
@@ -143,11 +154,13 @@ def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--profile', choices=sorted(select.catalog()['profiles']), default='lvbu-test')
|
||||
parser.add_argument('--version-code', type=int)
|
||||
parser.add_argument('--media-bundle',choices=sorted(select.catalog()['mediaBundles']),default='black-correct03')
|
||||
parser.add_argument('--build', action='store_true')
|
||||
parser.add_argument('--publish', action='store_true')
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
minimum = select.catalog()['profiles'][args.profile].get('minimumVersionCode', 34)
|
||||
minimum = max(select.catalog()['profiles'][args.profile].get('minimumVersionCode', 34),
|
||||
select.catalog()['mediaBundles'][args.media_bundle].get('minimumVersionCode',0))
|
||||
args.version_code = args.version_code if args.version_code is not None else minimum
|
||||
require(args.version_code >= minimum, 'fresh character version required')
|
||||
require(not args.publish or args.profile != 'main', 'main publication outside this task')
|
||||
@@ -156,9 +169,9 @@ def main():
|
||||
'published character version is immutable; choose a new code')
|
||||
if args.build:
|
||||
subprocess.run([str(ROOT/'scripts/build.sh'), ':app:assembleDebug', ':app:compileDebugAndroidTestKotlin',
|
||||
*flags(args.profile, args.version_code)], check=True, cwd=ROOT)
|
||||
*flags(args.profile, args.version_code, args.media_bundle)], check=True, cwd=ROOT)
|
||||
apk = build_dir(args.profile)/'outputs/apk/debug/app-debug.apk'
|
||||
report = verify(apk, args.profile, args.version_code)
|
||||
report = verify(apk, args.profile, args.version_code, args.media_bundle)
|
||||
if args.publish:
|
||||
report = publish(apk, report)
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
Reference in New Issue
Block a user