31 lines
2.2 KiB
Python
31 lines
2.2 KiB
Python
"""Fix DLL resolution exclusively in a standalone QA Apache binary directory."""
|
|
from pathlib import Path
|
|
import json, hashlib, shutil
|
|
ROOT=Path(__file__).resolve().parent.parent
|
|
PRIVATE=ROOT/'storage/app/private/investmoz-v2/portal-audit'
|
|
read=lambda p:json.loads(Path(p).read_text(encoding='utf-8-sig'))
|
|
sha=lambda p:hashlib.sha256(Path(p).read_bytes()).hexdigest()
|
|
plan=read(PRIVATE/'portal-stability-latest.json');source=Path(plan['source'])
|
|
diagnosis=read(PRIVATE/'portal-stability-dll-diagnosis.json')
|
|
broken=[d for d in diagnosis['dependencies'] if d['missing_required_exports_in_apache']]
|
|
assert len(broken)==1 and broken[0]['dependency']=='nghttp2.dll' and not broken[0]['missing_in_php']
|
|
original=Path(plan['apache_executable']).parent
|
|
binary=source/'apache-qa/compatible-bin'
|
|
assert not binary.exists()
|
|
shutil.copytree(original,binary)
|
|
shutil.copyfile(broken[0]['php_path'],binary/'nghttp2.dll')
|
|
assert sha(binary/'httpd.exe')==sha(original/'httpd.exe')
|
|
assert sha(binary/'nghttp2.dll')==broken[0]['php_sha256']
|
|
conf=Path(plan['apache_conf']).read_text(encoding='utf-8')
|
|
conf=conf.replace('127.0.0.1:18443','127.0.0.1:18444').replace('127.0.0.1:18105','127.0.0.1:18106')
|
|
conf=conf.replace('portal-investidor.test:18443','portal-investidor.test:18444')
|
|
conf=conf.replace('/httpd.pid','/compatible-httpd.pid').replace('/error.log','/compatible-error.log')
|
|
corrected=source/'apache-qa/compatible-httpd.conf';corrected.write_text(conf,encoding='utf-8')
|
|
plan['compatible_apache_executable']=str(binary/'httpd.exe');plan['compatible_apache_conf']=str(corrected)
|
|
plan['runtime_correction']={'dependency':'nghttp2.dll','required_export':broken[0]['missing_required_exports_in_apache'][0],
|
|
'before_sha256':broken[0]['apache_sha256'],'after_sha256':broken[0]['php_sha256'],
|
|
'scope':'QA-only binary copy; destination dependency replacement remains an additional proposed change, not authorized activation',
|
|
'apache_executable_identical':True,'php_modules_and_ini_identical':True,'active_files_modified':False}
|
|
(PRIVATE/'portal-stability-latest.json').write_text(json.dumps(plan,ensure_ascii=False,indent=2),encoding='utf-8')
|
|
print(json.dumps({'result':'QA_dependency_corrected','dll':'nghttp2.dll','active_files_modified':False,'candidate_runtime_requires_review':True}))
|