From 7bc20a630246656d754e488d9825d8d41765f3cc Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Sun, 28 Jun 2026 10:58:59 +0200 Subject: [PATCH] Fix: installierte Engine-Build-Nummer lesen (Format 'version: NNNN') + .gitattributes (LF) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - _installed_engine_build matchte nur 'build: (N)' / 'bNNNN', aber der aktuelle llama-server meldet 'version: 9821 (hash)'. Dadurch war installed_build immer None → Engine-Badge fiel auf ungenauen mtime-Vergleich zurueck. Jetzt praeziser Build-Nummer-Vergleich (latest > installed). - .gitattributes erzwingt LF fuer *.sh/*.service/*.timer: die Box hatte core.autocrlf aktiv und checkte deploy.sh mit CRLF aus -> 'set -euo pipefail' wurde zu 'pipefail\r' (invalid option name), Deploy brach ab. Co-Authored-By: Claude Opus 4.8 --- .gitattributes | 12 ++++++++++++ backend/services/maintenance.py | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b63161c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +# Shell-/Deploy-Skripte MÜSSEN LF behalten — sonst bricht der Deploy auf der Box +# (CRLF macht `set -euo pipefail` zu `pipefail\r` → "invalid option name"). +*.sh text eol=lf +*.bash text eol=lf + +# systemd-Units und Service-Configs ebenfalls LF. +*.service text eol=lf +*.timer text eol=lf + +# Windows-Batch-Wrapper bleiben CRLF. +*.cmd text eol=crlf +*.bat text eol=crlf diff --git a/backend/services/maintenance.py b/backend/services/maintenance.py index 359446f..eea19a3 100644 --- a/backend/services/maintenance.py +++ b/backend/services/maintenance.py @@ -42,7 +42,10 @@ def _installed_engine_build() -> int | None: out = subprocess.run([bin_path, "--version"], capture_output=True, text=True, timeout=20, env=env) txt = (out.stderr or "") + (out.stdout or "") - if (m := re.search(r"build:\s*\S+\s*\((\d+)\)", txt)) or (m := re.search(r"\bb(\d{3,})\b", txt)): + # Formate je nach Build: "version: 9821 (hash)" (aktuell), "build: (9821)", "b9821". + if (m := re.search(r"version:\s*(\d{3,})", txt)) \ + or (m := re.search(r"build:\s*\S+\s*\((\d+)\)", txt)) \ + or (m := re.search(r"\bb(\d{3,})\b", txt)): return int(m.group(1)) except Exception: return None