Separate source repos from workspace clones
This commit is contained in:
+9
-1
@@ -36,6 +36,7 @@ class GitConfig:
|
||||
@dataclass
|
||||
class WorkspaceConfig:
|
||||
config_path: Path
|
||||
original_root: Path
|
||||
workspace_root: Path
|
||||
series_root: Path
|
||||
socket_root: Path
|
||||
@@ -50,6 +51,7 @@ def load_config(config_path: Path) -> WorkspaceConfig:
|
||||
raw = json.loads(config_path.read_text(encoding="utf-8"))
|
||||
base_dir = config_path.parent
|
||||
|
||||
original_root = expand_path(raw.get("original_root", "~/dev/rv/repos"), base_dir)
|
||||
workspace_root = expand_path(raw.get("workspace_root", "~/dev/workspace/rv"), base_dir)
|
||||
series_root = expand_path(raw.get("series_root", str(workspace_root / "series")), base_dir)
|
||||
socket_root = expand_path(raw.get("socket_root", str(workspace_root / "sockets")), base_dir)
|
||||
@@ -57,7 +59,11 @@ def load_config(config_path: Path) -> WorkspaceConfig:
|
||||
|
||||
candidate_values = raw.get("tools_root_candidates")
|
||||
if not candidate_values:
|
||||
candidate_values = [raw.get("tools_root", "~/dev/workspace/tools/rv32i-hazard3-env")]
|
||||
candidate_values = [
|
||||
raw.get("tools_root", str(workspace_root / "tools" / "rv32i-hazard3-env")),
|
||||
str(original_root / "rv32i-hazard3-env"),
|
||||
"~/dev/rv/tools/rv32i-hazard3-env",
|
||||
]
|
||||
tools_root_candidates = [expand_path(value, base_dir) for value in candidate_values]
|
||||
|
||||
tools_root = next((path for path in tools_root_candidates if path.exists()), tools_root_candidates[0])
|
||||
@@ -75,6 +81,7 @@ def load_config(config_path: Path) -> WorkspaceConfig:
|
||||
|
||||
return WorkspaceConfig(
|
||||
config_path=config_path,
|
||||
original_root=original_root,
|
||||
workspace_root=workspace_root,
|
||||
series_root=series_root,
|
||||
socket_root=socket_root,
|
||||
@@ -998,6 +1005,7 @@ def run_tmux_container(config: WorkspaceConfig, args: argparse.Namespace) -> Non
|
||||
|
||||
def print_config(config: WorkspaceConfig) -> None:
|
||||
print(f"config_path\t{config.config_path}")
|
||||
print(f"original_root\t{config.original_root}")
|
||||
print(f"workspace_root\t{config.workspace_root}")
|
||||
print(f"series_root\t{config.series_root}")
|
||||
print(f"socket_root\t{config.socket_root}")
|
||||
|
||||
Reference in New Issue
Block a user