diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-01-21 11:17:45 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-01-29 16:05:35 +0100 |
commit | cfd04ad2d7fee5d4a3fb3c6df16e611a7c9fc6ab (patch) | |
tree | 5d6b4899a3a664a011fc05593b39fafc87939ee5 /bin/just-lock.py | |
parent | da4d4ef676cbe971b80d52a581cf7c8e0869d9ab (diff) | |
download | justbuild-cfd04ad2d7fee5d4a3fb3c6df16e611a7c9fc6ab.tar.gz |
just-lock: Add support for 'tree structure' roots
Based on f0473730 and 22ef0a16
Diffstat (limited to 'bin/just-lock.py')
-rwxr-xr-x | bin/just-lock.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/just-lock.py b/bin/just-lock.py index 75ca7da8..7e108d27 100755 --- a/bin/just-lock.py +++ b/bin/just-lock.py @@ -549,7 +549,7 @@ def get_repo_to_import(config: Json) -> str: def get_base_repo_if_computed(repo: Json) -> Optional[str]: """If repository is computed, return the base repository name.""" - if repo.get("type") == "computed": + if repo.get("type") in ["computed", "tree structure"]: return cast(str, repo.get("repo")) return None @@ -716,7 +716,7 @@ def rewrite_repo(repo_spec: Json, *, remote_type: str, existing_repos: List[str] = repo.get("repositories", []) new_repos = [assign[k] for k in existing_repos] repo = dict(repo, **{"repositories": new_repos}) - elif repo.get("type") == "computed": + elif repo.get("type") in ["computed", "tree structure"]: target: str = repo.get("repo", None) repo = dict(repo, **{"repo": assign[target]}) if absent and isinstance(repo, dict): @@ -1642,9 +1642,10 @@ def bisimilar_repos(repos: Json) -> List[List[str]]: elif a["type"] == "git": return (a["commit"] == b["commit"] and a.get("subdir", ".") == b.get("subdir", ".")) - elif a["type"] == "computed": - if (a.get("config", {}) != b.get("config", {}) - or a["target"] != b["target"]): + elif a["type"] in ["computed", "tree structure"]: + if (a["type"] == "computed" + and (a.get("config", {}) != b.get("config", {}) + or a["target"] != b["target"])): return False if a["repo"] == b["repo"]: return True @@ -1857,7 +1858,7 @@ def deduplicate(repos: Json, user_keep: List[str]) -> Json: # Update target repos of precomputed roots if isinstance(desc.get("repository"), dict): repo_root: Json = desc["repository"] - if repo_root["type"] == "computed" and \ + if repo_root["type"] in ["computed", "tree structure"] and \ repo_root["repo"] in renaming: repo_root = \ dict(repo_root, **{"repo": renaming[repo_root["repo"]]}) |