Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
13 lines
991 B
Python
13 lines
991 B
Python
from pathlib import Path
|
|
import difflib,json,hashlib,subprocess
|
|
p=Path('/tmp/erri-launcher-resupply-1140');root=Path('/home/jakub/devel/escapistsrereintroduced');paths=sorted([*p.glob('addons/**/*.c'),*p.glob('tests/test_*.py')]);parts=[];manifest={}
|
|
for f in paths:
|
|
rel=str(f.relative_to(p));before=(p/'baseline'/rel).read_text();after=f.read_text()
|
|
if before==after:continue
|
|
assert (root/rel).read_text()==before,rel+' target changed since baseline'
|
|
parts.extend(difflib.unified_diff(before.splitlines(True),after.splitlines(True),fromfile='a/'+rel,tofile='b/'+rel))
|
|
manifest[rel]=hashlib.sha256(f.read_bytes()).hexdigest()
|
|
(p/'fix.patch').write_text(''.join(parts));(p/'source-manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
|
|
r=subprocess.run(['git','apply','--check',str(p/'fix.patch')],cwd=root,text=True,capture_output=True);(p/'apply-check.log').write_text(r.stdout+r.stderr);assert r.returncode==0,r.stderr
|
|
print(len(manifest),'changed files; apply check passed')
|