diff --git a/.github/workflows/deps.yaml b/.github/workflows/deps.yaml index 76ee1142..f6e9d92e 100644 --- a/.github/workflows/deps.yaml +++ b/.github/workflows/deps.yaml @@ -146,13 +146,13 @@ jobs: - name: Verify artifacts match checked-in deps run: | - python3 ./deps/verify_deps.py verify-artifact \ - --artifact deps-linux.tar.gz \ - --deps-dir deps/linux + python3 ./deps/verify_deps.py verify \ + --deps-dir deps/linux \ + --build-info deps/linux/build-info.json - python3 ./deps/verify_deps.py verify-artifact \ - --artifact deps-macos.tar.gz \ - --deps-dir deps/osx + python3 ./deps/verify_deps.py verify \ + --deps-dir deps/osx \ + --build-info deps/osx/build-info.json # This job updates the checked-in deps on main branch update-deps: diff --git a/deps/verify_deps.py b/deps/verify_deps.py index ebe1df41..6229664d 100755 --- a/deps/verify_deps.py +++ b/deps/verify_deps.py @@ -91,14 +91,15 @@ def verify_deps(deps_dir: Path, build_info: BuildInfo) -> Tuple[bool, List[str]] def main(): parser = argparse.ArgumentParser(description="Verify Lilliput dependencies") - parser.add_argument("--deps-dir", required=True, type=Path, - help="Directory containing dependencies (e.g., deps/linux or deps/osx)") + # Create subparsers first subparsers = parser.add_subparsers(dest="command", required=True) # Generate command generate_parser = subparsers.add_parser("generate", help="Generate build info for dependencies") + generate_parser.add_argument("--deps-dir", required=True, type=Path, + help="Directory containing dependencies") generate_parser.add_argument("--platform", required=True, choices=["linux", "macos"], help="Platform identifier") @@ -110,12 +111,14 @@ def main(): # Verify command verify_parser = subparsers.add_parser("verify", help="Verify deps against build info") + verify_parser.add_argument("--deps-dir", required=True, type=Path, + help="Directory containing dependencies") verify_parser.add_argument("--build-info", required=True, type=Path, help="Path to build info JSON file") args = parser.parse_args() - if not args.deps_dir.exists(): + if not os.path.exists(args.deps_dir): print(f"Error: deps directory not found: {args.deps_dir}", file=sys.stderr) sys.exit(1) @@ -128,12 +131,9 @@ def main(): output_file = args.output or args.deps_dir / "build-info.json" - # Convert BuildInfo to dict for JSON serialization - build_info_dict = build_info._asdict() - try: with open(output_file, "w") as f: - json.dump(build_info_dict, f, indent=4) + json.dump(build_info._asdict(), f, indent=4) print(f"Build info generated successfully: {output_file}") except (IOError, OSError) as e: print(f"Error writing build info: {e}", file=sys.stderr)