Verify and repair Assistent SQLite native bundle on provision.
Extend seed/verify to require SQLitePCLRaw bundle or runtimes and copy native e_sqlite3 when repairing extension DLLs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -245,6 +245,8 @@ for root in roots:
|
|||||||
dll_dir = dll.parent
|
dll_dir = dll.parent
|
||||||
sqlite = dll_dir / "Microsoft.Data.Sqlite.dll"
|
sqlite = dll_dir / "Microsoft.Data.Sqlite.dll"
|
||||||
pcl = list(dll_dir.glob("SQLitePCLRaw*.dll"))
|
pcl = list(dll_dir.glob("SQLitePCLRaw*.dll"))
|
||||||
|
bundle = dll_dir / "SQLitePCLRaw.bundle_e_sqlite3.dll"
|
||||||
|
native = list(dll_dir.glob("runtimes/**/e_sqlite3.*")) + list(dll_dir.glob("runtimes/**/libe_sqlite3.*"))
|
||||||
found.append({
|
found.append({
|
||||||
"path": str(dll.parent.parent) if dll.parent.name.startswith("net") else str(dll_dir),
|
"path": str(dll.parent.parent) if dll.parent.name.startswith("net") else str(dll_dir),
|
||||||
"name": "swarm-assistent",
|
"name": "swarm-assistent",
|
||||||
@@ -252,6 +254,8 @@ for root in roots:
|
|||||||
"dll_dir": str(dll_dir),
|
"dll_dir": str(dll_dir),
|
||||||
"sqlite_dll": sqlite.is_file(),
|
"sqlite_dll": sqlite.is_file(),
|
||||||
"sqlitepcl": bool(pcl),
|
"sqlitepcl": bool(pcl),
|
||||||
|
"sqlite_bundle": bundle.is_file(),
|
||||||
|
"sqlite_native": bool(native),
|
||||||
})
|
})
|
||||||
print(json.dumps(found))
|
print(json.dumps(found))
|
||||||
"""
|
"""
|
||||||
@@ -270,7 +274,13 @@ for root in (Path("/mnt/swarm_data"), Path("/opt/swarmui")):
|
|||||||
dlls.append(dll)
|
dlls.append(dll)
|
||||||
|
|
||||||
def has_sqlite(d):
|
def has_sqlite(d):
|
||||||
return (d / "Microsoft.Data.Sqlite.dll").is_file() and list(d.glob("SQLitePCLRaw*.dll"))
|
if not (d / "Microsoft.Data.Sqlite.dll").is_file():
|
||||||
|
return False
|
||||||
|
if not list(d.glob("SQLitePCLRaw*.dll")):
|
||||||
|
return False
|
||||||
|
return (d / "SQLitePCLRaw.bundle_e_sqlite3.dll").is_file() or list(
|
||||||
|
d.glob("runtimes/**/e_sqlite3.*")
|
||||||
|
) or list(d.glob("runtimes/**/libe_sqlite3.*"))
|
||||||
|
|
||||||
donors = [d.parent for d in dlls if has_sqlite(d.parent)]
|
donors = [d.parent for d in dlls if has_sqlite(d.parent)]
|
||||||
if not donors:
|
if not donors:
|
||||||
@@ -306,6 +316,15 @@ for dll in dlls:
|
|||||||
fp = src / name
|
fp = src / name
|
||||||
if fp.is_file():
|
if fp.is_file():
|
||||||
shutil.copy2(fp, dest / name)
|
shutil.copy2(fp, dest / name)
|
||||||
|
for sub in ("runtimes",):
|
||||||
|
sp = src / sub
|
||||||
|
if sp.is_dir():
|
||||||
|
for fp in sp.rglob("*"):
|
||||||
|
if fp.is_file():
|
||||||
|
rel = fp.relative_to(src)
|
||||||
|
out = dest / rel
|
||||||
|
out.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
shutil.copy2(fp, out)
|
||||||
copied.append({"dll_dir": str(dest), "from": str(src)})
|
copied.append({"dll_dir": str(dest), "from": str(src)})
|
||||||
print(json.dumps({"copied": copied, "missing": missing, "dlls": [str(d) for d in dlls]}))
|
print(json.dumps({"copied": copied, "missing": missing, "dlls": [str(d) for d in dlls]}))
|
||||||
"""
|
"""
|
||||||
@@ -415,12 +434,18 @@ def verify_assistent_sqlite_bins(cfg: Config, host: str, log: Log) -> bool:
|
|||||||
"или смотри journalctl -u swarmui"
|
"или смотри journalctl -u swarmui"
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
if row.get("sqlite_dll") and row.get("sqlitepcl"):
|
if row.get("sqlite_dll") and row.get("sqlitepcl") and (
|
||||||
log(f"Assistent {name}: Microsoft.Data.Sqlite + SQLitePCLRaw рядом с DLL")
|
row.get("sqlite_bundle") or row.get("sqlite_native")
|
||||||
|
):
|
||||||
|
log(f"Assistent {name}: Microsoft.Data.Sqlite + SQLitePCLRaw (+ native) рядом с DLL")
|
||||||
ok_any = True
|
ok_any = True
|
||||||
|
elif row.get("sqlite_dll") and row.get("sqlitepcl"):
|
||||||
|
log(
|
||||||
|
f"⚠ Assistent {name}: Microsoft.Data.Sqlite есть, но нет bundle/native — "
|
||||||
|
"Крафт-память может падать; нужен ≥0.15.6 + restart"
|
||||||
|
)
|
||||||
elif row.get("sqlite_dll"):
|
elif row.get("sqlite_dll"):
|
||||||
log(f"Assistent {name}: Microsoft.Data.Sqlite есть (SQLitePCLRaw не найден)")
|
log(f"⚠ Assistent {name}: Microsoft.Data.Sqlite есть (SQLitePCLRaw не найден)")
|
||||||
ok_any = True
|
|
||||||
else:
|
else:
|
||||||
where = row.get("dll_dir") or "bin/{Debug,Release}/net*"
|
where = row.get("dll_dir") or "bin/{Debug,Release}/net*"
|
||||||
log(
|
log(
|
||||||
|
|||||||
Reference in New Issue
Block a user