FDS/OS 1.0
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compare complete independently restored builds; retain mismatches as evidence."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
from release_artifacts import compare
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('first', type=Path)
|
||||
parser.add_argument('second', type=Path)
|
||||
parser.add_argument('--report', required=True, type=Path)
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
if args.first.resolve() == args.second.resolve():
|
||||
raise ValueError('Specify two independently restored build trees')
|
||||
if args.report.exists() or args.report.is_symlink():
|
||||
raise ValueError('Report output already exists')
|
||||
report = compare(args.first, args.second)
|
||||
with args.report.open('x') as stream:
|
||||
stream.write(json.dumps(report, indent=2) + '\n')
|
||||
for item in report['artifacts']:
|
||||
print(('PASS' if item['identical'] else 'MISMATCH') + ': ' + item['name'])
|
||||
if report['status'] != 'passed':
|
||||
raise ValueError(f'Builds differ; inspect {args.report}')
|
||||
print(f'PASS: all {len(report["artifacts"])} artifacts are byte-identical: {args.report}')
|
||||
print('NOTE: this comparison establishes matching bytes; retain each isolated build log as execution evidence')
|
||||
except (OSError, ValueError, KeyError) as error:
|
||||
sys.exit(f'ERROR: {error}')
|
||||
Reference in New Issue
Block a user