Files
ARCADIA-Studio/harness/experiments/save-diagnostics-package-20261001/raw/scripts/setup-package46-native.py
T

43 lines
2.1 KiB
Python

from pathlib import Path
import hashlib, json, shutil
root = Path(__file__).resolve().parent / 'package46'
record = json.loads((root / 'extraction-check.json').read_text())
bundle = Path(record['bundle'])
sha = lambda p: hashlib.sha256(p.read_bytes()).hexdigest()
assert sha(bundle / 'arcadia-studio.exe') == 'e9cce9355525ecdc59bfae12608b1e0272167acef5a86b25368ef547e08886ff'
assert sha(bundle / 'libunwind.dll') == 'f45604a12e8bcd839fd86f667c1be1cc7c4f9da2b3c69ff381ac708f0e1ae7d4'
native = root / 'qa/native46'
native.mkdir()
(native / 'captures').mkdir()
work = root / 'working'
work.mkdir()
fixture = bundle / 'examples/release1'
def inventory(p):
return {f.relative_to(p).as_posix(): {'bytes': f.stat().st_size, 'sha256': sha(f)}
for f in p.rglob('*') if f.is_file()}
baseline = inventory(fixture)
assert len(baseline) == 37
for name in ['collision-a', 'external-b']:
shutil.copytree(fixture, work / name)
assert inventory(work / name) == baseline
fresh = work / 'fresh-c'
fresh.mkdir()
for f in fixture.rglob('*'):
if f.is_file() and f.suffix != '.arcadia':
p = fresh / f.relative_to(fixture)
p.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(f, p)
assert len(inventory(fresh)) == 7 and not list(fresh.rglob('*.arcadia'))
receipt = {'source': '0e83157e09d52e6152df91208e41693b62da2d46',
'package_documentation_source': 'ef28f1784efe6717b0ca72c0eb3c97bc30ebfe47',
'archive_sha256': record['archive_sha256'], 'bundle': str(bundle),
'baseline': baseline, 'fresh_companions': inventory(fresh),
'declared_rename': {'activity': '61f7bbfb-74a4-5540-9182-2583dfb27a49',
'before': 'Assess pressure alarm', 'after': 'Assess pressure alarm Package46'},
'external_dependency': 'oa/activities/activity_oa_restore_work.arcadia',
'external_comment': '\n// Package46 observed external-edit probe\n'}
with (native / 'baseline.json').open('x', encoding='utf-8') as f:
json.dump(receipt, f, indent=2); f.write('\n')
print(json.dumps({k: v for k, v in receipt.items() if k not in ['baseline', 'fresh_companions']}, indent=2))