mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
refactor: one autorun worktree path and checkout
This commit is contained in:
1 parent
6c92b0172e
commit
eec4ff9972
6 files changed
+29
-17
No files matched your search
@@ -19,6 +19,7 @@ from pathlib import Path
|
||||
|
||||
from core.artifacts import TIMESTAMP_KEYS
|
||||
from core.hostguard import LockBusy, free_gb, global_lock, lock_busy
|
||||
from core.paths import AUTORUN_DIR, AUTORUN_WORKTREE
|
||||
from core.statefile import now_iso, save_state
|
||||
from unattended.breaker import may_push, refresh_breaker
|
||||
from unattended.jobs import AutorunError, BLOCKED, DEFERRED, FAILED, Job, OK, REFUSED, Step, job_env
|
||||
@@ -34,9 +35,6 @@ from unattended.worktree import (
|
||||
)
|
||||
|
||||
|
||||
AUTORUN_DIR = Path(".cache") / "autorun"
|
||||
|
||||
|
||||
ALERT_FREE_GB = 100
|
||||
LOG_DAYS = 30
|
||||
SEGFAULT_CODES = (139, -11)
|
||||
@@ -81,7 +79,7 @@ class Context:
|
||||
|
||||
@property
|
||||
def worktree(self) -> Path:
|
||||
return self.home / "worktree"
|
||||
return self.repo / AUTORUN_WORKTREE
|
||||
|
||||
@property
|
||||
def state_path(self) -> Path:
|
||||
|
||||
@@ -11,6 +11,8 @@ import subprocess
|
||||
from collections.abc import Callable, Sequence
|
||||
from pathlib import Path
|
||||
|
||||
from core.gitclone import GitRefused
|
||||
from core.gitclone import main_checkout as gitclone_main_checkout
|
||||
from core.paths import REPO_ROOT
|
||||
from unattended.jobs import AutorunError, BLOCKED, CommitRule, FAILED, token_env
|
||||
|
||||
@@ -158,7 +160,7 @@ def push_batch(worktree: Path, gate_base: str, regate: Callable[[], bool]) -> st
|
||||
|
||||
def main_checkout() -> Path:
|
||||
"""The main checkout, also when this script runs from a linked worktree."""
|
||||
proc = git(REPO_ROOT, "rev-parse", "--path-format=absolute", "--git-common-dir",
|
||||
check=False)
|
||||
common = Path(proc.stdout.strip()) if proc.returncode == 0 else REPO_ROOT / ".git"
|
||||
return common.parent
|
||||
try:
|
||||
return gitclone_main_checkout(REPO_ROOT)
|
||||
except GitRefused:
|
||||
return REPO_ROOT
|
||||
Reference in new issue
Block a user