Просмотр исходного кода

doctor: distinguish locked OSS container profile

高宇轩 3 месяцев назад
Родитель
Сommit
0e97c75f0c
1 измененных файлов с 18 добавлено и 3 удалено
  1. 18 3
      tools/doctor_linux.py

+ 18 - 3
tools/doctor_linux.py

@@ -205,8 +205,18 @@ def build_report() -> dict[str, Any]:
         probe_python_venv(venv),
     ]
     missing = [item["name"] for item in tools if not item.get("present")]
-    # Core acceptance: python3 + iverilog + td2026. OSS CAD / venv may be degraded.
-    core_missing = [n for n in ("python3", "iverilog", "td2026") if n in missing]
+    profile = os.environ.get("PROD2U_DOCTOR_PROFILE", "full").strip().lower()
+    if profile == "full":
+        required = ("python3", "iverilog", "td2026")
+    elif profile == "oss":
+        required = (
+            "python3", "git", "iverilog", "vvp", "verilator", "yosys", "sby"
+        )
+    else:
+        raise ValueError(f"unsupported doctor profile: {profile}")
+    required_missing = [name for name in required if name in missing]
+    optional_missing = [name for name in missing if name not in required]
+    td_present = next(item["present"] for item in tools if item["name"] == "td2026")
     return {
         "schema": "prod2u-toolchain-doctor-v1",
         "generated_at_utc": datetime.now(timezone.utc).isoformat(),
@@ -224,7 +234,12 @@ def build_report() -> dict[str, Any]:
         },
         "tools": tools,
         "missing": missing,
-        "status": "pass" if not core_missing else "degraded",
+        "profile": profile,
+        "required": list(required),
+        "required_missing": required_missing,
+        "optional_missing": optional_missing,
+        "td_status": "AVAILABLE" if td_present else "TD_BLOCKED_MISSING_VENDOR_INPUT",
+        "status": "pass" if not required_missing else "degraded",
     }