108 lines
5.4 KiB
Python
108 lines
5.4 KiB
Python
"""Pin the qualified native UI fixes at the release-copy boundary.
|
|
|
|
The release checker reads four FileDataIDs through the existing CascLib
|
|
CLI. Changing any UI body requires adding a newly qualified SHA-256 here;
|
|
no packaged client or runtime startup depends on the build-time checker.
|
|
"""
|
|
import hashlib
|
|
import subprocess
|
|
import tempfile
|
|
from pathlib import Path
|
|
|
|
REPORTER_FDI = 1967886
|
|
CREATE_FDI = 8209459
|
|
MAINLINE_CHATFRAME_FDI = 7208188
|
|
SHARED_CHATFRAME_FDI = 7208194
|
|
QUALIFIED = {
|
|
REPORTER_FDI: {
|
|
'13e805ac7960863721cb1fba303094bba4e6cfe9120b63ae3db4e0796b8a7e82',
|
|
},
|
|
CREATE_FDI: {
|
|
# Installed isolated original-backdrop child over the reminder root.
|
|
'966252cfd57c07e21ec98172f9b27180075638ab30c6e009a4dccb3072500c67',
|
|
},
|
|
MAINLINE_CHATFRAME_FDI: {
|
|
# Original CHAT_MSG_SYSTEM handler; exact reminder only is suppressed here.
|
|
'11434749ae7d3f6dc3d895ea4b68aaf0e69da9e18e86454b60c7c11dcb60813c',
|
|
# d2b2 whisper-name and reminder handlers with the qualified staff formatter.
|
|
'44e7cb74d04514de0e6aca96125be78d8dd38178cf0b809fc8dca88c64ed600d',
|
|
},
|
|
SHARED_CHATFRAME_FDI: {
|
|
# Remove the ineffective duplicate AddMessage interception.
|
|
'd9252b748f715d0c793ca265df10bd9c6ed80875a12f56d9b4343be46a43c856',
|
|
},
|
|
}
|
|
PATHS = {
|
|
REPORTER_FDI: 'interface/addons/blizzard_ptrfeedback/blizzard_ptrfeedback.lua',
|
|
CREATE_FDI: 'interface/addons/blizzard_charactercreate/camelot/blizzard_charactercreate.lua',
|
|
MAINLINE_CHATFRAME_FDI: 'interface/addons/blizzard_chatframebase/mainline/chatframeoverrides.lua',
|
|
SHARED_CHATFRAME_FDI: 'interface/addons/blizzard_chatframebase/shared/chatframe.lua',
|
|
}
|
|
|
|
|
|
def _require_no_reminder_addon(client):
|
|
addons = Path(client) / '_classic_beta_/Interface/AddOns'
|
|
for name in ('WoWHybridIssueReporter', 'WoWHybridReminderREA'):
|
|
path = addons / name
|
|
if path.exists() or path.is_symlink():
|
|
raise ValueError(f'Reminder addon {name} remains in the final release')
|
|
|
|
|
|
def _sha(path):
|
|
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
|
|
|
|
|
|
def verify_ui_lineage(client, tool, *, scratch):
|
|
"""Check the final fresh release store, not an ancestor's receipt."""
|
|
client, tool = Path(client).resolve(), Path(tool).resolve()
|
|
if not tool.is_file():
|
|
raise ValueError('Existing CascLib CLI required to verify native UI release fixes')
|
|
_require_no_reminder_addon(client)
|
|
before = _sha(client / '.build.info')
|
|
with tempfile.TemporaryDirectory(prefix='ui-release-check-', dir=scratch) as directory:
|
|
directory = Path(directory)
|
|
ids, names, output = directory / 'ids.txt', directory / 'listfile.csv', directory / 'readback'
|
|
ids.write_text(''.join(f'{fid}\n' for fid in PATHS), encoding='ascii')
|
|
names.write_text(''.join(f'{fid};{path}\n' for fid, path in PATHS.items()), encoding='ascii')
|
|
result = subprocess.run([str(tool), 'extract-batch', '--from-list', str(ids), str(output),
|
|
'--storage', str(client), '--listfile', str(names)],
|
|
capture_output=True, text=True, check=False)
|
|
if result.returncode:
|
|
raise ValueError('Could not read the four required UI assets from the final release CASC')
|
|
selected = {}
|
|
for fid, name in PATHS.items():
|
|
path = output / name
|
|
if not path.is_file():
|
|
raise ValueError(f'Required UI asset {fid} is missing from the final release')
|
|
digest = _sha(path)
|
|
if digest not in QUALIFIED[fid]:
|
|
feature = {REPORTER_FDI: 'Issue Reporter removal', CREATE_FDI: 'character creation',
|
|
MAINLINE_CHATFRAME_FDI: 'Code of Conduct reminder removal',
|
|
SHARED_CHATFRAME_FDI: 'original shared ChatFrame restoration'}[fid]
|
|
raise ValueError(f'{feature} is absent or unqualified in the final release; preserve its new reviewed UI body before building')
|
|
selected[str(fid)] = digest
|
|
if _sha(client / '.build.info') != before:
|
|
raise ValueError('Release CASC identity changed during UI fix verification')
|
|
return {'status': 'PASS_QUALIFIED_NATIVE_UI_NO_REMINDER_ADDON',
|
|
'build_info_sha256': before, 'selected_sha256': selected,
|
|
'native_visual_acceptance_verified': False}
|
|
|
|
|
|
def verify_inherited_ui_lineage(linux_client, target_client, release):
|
|
"""Windows copies the Linux release assets; require that exact proven build."""
|
|
proof = release.get('ui_fix_lineage', {})
|
|
selected = proof.get('selected_sha256', {})
|
|
if (proof.get('status') != 'PASS_QUALIFIED_NATIVE_UI_NO_REMINDER_ADDON'
|
|
or set(selected) != {str(fid) for fid in PATHS}
|
|
or any(selected[str(fid)] not in QUALIFIED[fid] for fid in PATHS)):
|
|
raise ValueError('Linux input lacks the qualified native UI release proof')
|
|
expected = proof.get('build_info_sha256')
|
|
if not isinstance(expected, str) or _sha(Path(linux_client) / '.build.info') != expected:
|
|
raise ValueError('Linux UI fix proof does not match its current CASC build')
|
|
if target_client is not None and _sha(Path(target_client) / '.build.info') != expected:
|
|
raise ValueError('Windows copied CASC differs from the qualified Linux build')
|
|
_require_no_reminder_addon(linux_client)
|
|
if target_client is not None:
|
|
_require_no_reminder_addon(target_client)
|
|
return proof
|