From 8c4f1b02ed09a4378fa82a8c6de229b105a860b0 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Wed, 1 Apr 2026 20:02:08 +0100 Subject: [PATCH] fix: move revision info retrieval to the base `FlowCfg` In d6d53f6, the logic to record the commit hash (and shortened version) was added to the sim flow, but in reality since it is used in the deploy it needs to be on every flow. Move the computation of this information to the base `FlowCfg` object, after all expansion has taken place to fill in the `proj_root`. This should now work for the other flows (e.g. formal). Signed-off-by: Alex Jones --- src/dvsim/flow/base.py | 6 ++++++ src/dvsim/sim/flow.py | 7 +------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dvsim/flow/base.py b/src/dvsim/flow/base.py index 847650f1..4ae7d2c3 100644 --- a/src/dvsim/flow/base.py +++ b/src/dvsim/flow/base.py @@ -26,6 +26,7 @@ rm_path, subst_wildcards, ) +from dvsim.utils.git import git_commit_hash if TYPE_CHECKING: from dvsim.job.deploy import Deploy @@ -152,6 +153,11 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: # _expand and add the code at the start. self._expand() + # After initialisation & expansion, save some useful revision metadata + proj_root = Path(self.proj_root) + self.commit = git_commit_hash(path=proj_root, short=False) + self.commit_short = git_commit_hash(path=proj_root, short=True) + # Construct the path variables after variable expansion. reports_dir = Path(self.scratch_base_path) / "reports" self.results_dir = reports_dir / self.rel_path diff --git a/src/dvsim/sim/flow.py b/src/dvsim/sim/flow.py index 35de0c63..2ba51873 100644 --- a/src/dvsim/sim/flow.py +++ b/src/dvsim/sim/flow.py @@ -44,7 +44,7 @@ from dvsim.tool.utils import get_sim_tool_plugin from dvsim.utils import TS_FORMAT, rm_path from dvsim.utils.fs import relative_to -from dvsim.utils.git import git_commit_hash, git_https_url_with_commit +from dvsim.utils.git import git_https_url_with_commit __all__ = ("SimCfg",) @@ -176,11 +176,6 @@ def __init__(self, flow_cfg_file, hjson_data, args, mk_config) -> None: super().__init__(flow_cfg_file, hjson_data, args, mk_config) - # After initialisation & expansion, save some useful revision metadata - proj_root = Path(self.proj_root) - self.commit = git_commit_hash(path=proj_root, short=False) - self.commit_short = git_commit_hash(path=proj_root, short=True) - def _expand(self) -> None: # Choose a wave format now. Note that this has to happen after parsing # the configuration format because our choice might depend on the