Add BSIPA bootstrap support
This commit is contained in:
@@ -9,6 +9,7 @@ from zipfile import ZipFile
|
||||
|
||||
from .fsutil import ensure_relative, sha256_bytes, sha256_file
|
||||
from .models import Lockfile, Registry, VALID_STRATEGIES
|
||||
from .bsipa import BSIPA_PLUGIN_ID, check_bsipa_health
|
||||
from .state import downloads_dir, plans_dir, plugin_downloads_dir
|
||||
|
||||
|
||||
@@ -74,11 +75,20 @@ def create_plan(
|
||||
state_root: Path,
|
||||
repo_root: Path,
|
||||
selected: set[str] | None = None,
|
||||
require_bootstrap: bool = True,
|
||||
) -> tuple[dict[str, Any], Path]:
|
||||
selected_ids = selected or {plugin.id for plugin in lockfile.plugins}
|
||||
changes: list[dict[str, Any]] = []
|
||||
warnings: list[str] = []
|
||||
|
||||
has_locked_bsipa = any(plugin.id == BSIPA_PLUGIN_ID for plugin in lockfile.plugins)
|
||||
planning_ordinary_plugins = any(plugin_id != BSIPA_PLUGIN_ID for plugin_id in selected_ids)
|
||||
if require_bootstrap and has_locked_bsipa and planning_ordinary_plugins:
|
||||
health = check_bsipa_health(instance_path, state_root, instance)
|
||||
if not health["ok"]:
|
||||
joined = "; ".join(health["messages"])
|
||||
raise ValueError(f"BSIPA bootstrap is not healthy; run bootstrap first: {joined}")
|
||||
|
||||
for locked in lockfile.plugins:
|
||||
if locked.id not in selected_ids:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user