|
@@ -69,6 +69,7 @@ def build_firmware_package(
|
|
|
source_closure_unchanged: bool,
|
|
source_closure_unchanged: bool,
|
|
|
bitstream_path: Path = BITSTREAM,
|
|
bitstream_path: Path = BITSTREAM,
|
|
|
td_report_path: Path = TD_REPORT,
|
|
td_report_path: Path = TD_REPORT,
|
|
|
|
|
+ evidence_dir: Path | None = None,
|
|
|
) -> Path:
|
|
) -> Path:
|
|
|
if not bitstream_path.is_file():
|
|
if not bitstream_path.is_file():
|
|
|
raise FileNotFoundError(f"bitstream not found: {bitstream_path}")
|
|
raise FileNotFoundError(f"bitstream not found: {bitstream_path}")
|
|
@@ -164,6 +165,13 @@ def build_firmware_package(
|
|
|
# Source closure manifest
|
|
# Source closure manifest
|
|
|
add_and_hash(ROOT / "config" / "source_closure.json", "config/source_closure.json")
|
|
add_and_hash(ROOT / "config" / "source_closure.json", "config/source_closure.json")
|
|
|
|
|
|
|
|
|
|
+ # Optional verification/matrix evidence
|
|
|
|
|
+ if evidence_dir is not None and evidence_dir.is_dir():
|
|
|
|
|
+ for ev_file in evidence_dir.rglob("*"):
|
|
|
|
|
+ if ev_file.is_file():
|
|
|
|
|
+ arcname = "evidence/" + "/".join(ev_file.relative_to(evidence_dir).parts)
|
|
|
|
|
+ add_and_hash(ev_file, arcname)
|
|
|
|
|
+
|
|
|
# Manifest and SHA256SUMS
|
|
# Manifest and SHA256SUMS
|
|
|
manifest_text = json.dumps(manifest, indent=2, sort_keys=True) + "\n"
|
|
manifest_text = json.dumps(manifest, indent=2, sort_keys=True) + "\n"
|
|
|
add_text_and_hash(manifest_text, "PACKAGE-MANIFEST.json")
|
|
add_text_and_hash(manifest_text, "PACKAGE-MANIFEST.json")
|
|
@@ -181,6 +189,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
parser.add_argument("--source-closure-unchanged", action="store_true")
|
|
parser.add_argument("--source-closure-unchanged", action="store_true")
|
|
|
parser.add_argument("--bitstream", type=Path, default=BITSTREAM)
|
|
parser.add_argument("--bitstream", type=Path, default=BITSTREAM)
|
|
|
parser.add_argument("--td-report", type=Path, default=TD_REPORT)
|
|
parser.add_argument("--td-report", type=Path, default=TD_REPORT)
|
|
|
|
|
+ parser.add_argument("--evidence-dir", type=Path, default=None)
|
|
|
args = parser.parse_args(argv)
|
|
args = parser.parse_args(argv)
|
|
|
|
|
|
|
|
try:
|
|
try:
|
|
@@ -192,6 +201,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
source_closure_unchanged=args.source_closure_unchanged,
|
|
source_closure_unchanged=args.source_closure_unchanged,
|
|
|
bitstream_path=args.bitstream,
|
|
bitstream_path=args.bitstream,
|
|
|
td_report_path=args.td_report,
|
|
td_report_path=args.td_report,
|
|
|
|
|
+ evidence_dir=args.evidence_dir,
|
|
|
)
|
|
)
|
|
|
except FileNotFoundError as exc:
|
|
except FileNotFoundError as exc:
|
|
|
print(f"blocked: {exc}", file=sys.stderr)
|
|
print(f"blocked: {exc}", file=sys.stderr)
|