Track install state by installation id
This commit is contained in:
@@ -10,7 +10,11 @@ from zipfile import ZipFile
|
||||
from .fsutil import ensure_relative, sha256_bytes, sha256_file
|
||||
from .models import Lockfile, Registry, VALID_STRATEGIES
|
||||
from .bsipa import bootstrap_health_error, check_bsipa_health, planning_requires_bootstrap
|
||||
from .state import downloads_dir, plans_dir, plugin_downloads_dir
|
||||
from .state import (
|
||||
downloads_dir,
|
||||
plans_dir,
|
||||
plugin_downloads_dir,
|
||||
)
|
||||
|
||||
|
||||
ALLOWED_BSIPA_TOP_LEVEL = {"IPA", "Libs", "Plugins"}
|
||||
@@ -96,6 +100,7 @@ def create_plan(
|
||||
repo_root: Path,
|
||||
selected: set[str] | None = None,
|
||||
require_bootstrap: bool = True,
|
||||
install_id: str | None = None,
|
||||
) -> tuple[dict[str, Any], Path]:
|
||||
selected_ids = (
|
||||
_expand_required_dependencies(selected, registry, lockfile)
|
||||
@@ -106,7 +111,7 @@ def create_plan(
|
||||
warnings: list[str] = []
|
||||
|
||||
if require_bootstrap and planning_requires_bootstrap(lockfile.plugins, selected_ids):
|
||||
health = check_bsipa_health(instance_path, state_root, instance)
|
||||
health = check_bsipa_health(instance_path, state_root, instance, install_id=install_id)
|
||||
if not health["ok"]:
|
||||
raise ValueError(bootstrap_health_error(health))
|
||||
|
||||
@@ -175,7 +180,9 @@ def create_plan(
|
||||
"warnings": warnings,
|
||||
"changes": changes,
|
||||
}
|
||||
plan_path = plans_dir(state_root, instance) / f"plan-{_now_slug()}.json"
|
||||
if install_id:
|
||||
plan["installId"] = install_id
|
||||
plan_path = plans_dir(state_root, instance, install_id=install_id) / f"plan-{_now_slug()}.json"
|
||||
with plan_path.open("w", encoding="utf-8") as handle:
|
||||
json.dump(plan, handle, indent=2, sort_keys=True)
|
||||
handle.write("\n")
|
||||
|
||||
Reference in New Issue
Block a user