diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-02-17 15:03:13 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-02-20 13:12:38 +0100 |
commit | 8b4dbd31cc55e15a364f568ec2aec3d856b1bebe (patch) | |
tree | df0deb0a9fd3f8ab5285fa3b73239f94595d034f /bin | |
parent | 8432937e6b1d26abb2be1fdc5e141c0105ff6f1c (diff) | |
download | justbuild-8b4dbd31cc55e15a364f568ec2aec3d856b1bebe.tar.gz |
just-lock: Fix missing inherited pragmas
Transitive 'file'-type repositories should inherit any pragmas
suported by the new repository type they are rewritten as.
Extend import tests to avoid regressing on this issue in the
future.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/just-lock.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/just-lock.py b/bin/just-lock.py index d396ad54..3f1ed1ae 100755 --- a/bin/just-lock.py +++ b/bin/just-lock.py @@ -669,6 +669,14 @@ def rewrite_file_repo(repo: Json, remote_type: str, remote_stub: Dict[str, Any], subdir: str = os.path.normpath(repo.get("path", ".")) if subdir != ".": changes["subdir"] = subdir + # keep ignore special and absent pragmas + pragma = {} + if repo.get("pragma", {}).get("special", None) == "ignore": + pragma["special"] = "ignore" + if repo.get("pragma", {}).get("absent", False): + pragma["absent"] = True + if pragma: + changes["pragma"] = pragma return dict(remote_stub, **changes) elif remote_type == "file": # for imports from local checkouts, file repos remain type 'file'; only @@ -690,6 +698,15 @@ def rewrite_file_repo(repo: Json, remote_type: str, remote_stub: Dict[str, Any], if existing != ".": subdir = os.path.join(existing, subdir) changes["subdir"] = subdir + # keep special and absent pragmas + pragma = {} + special: Json = repo.get("pragma", {}).get("special", None) + if special: + pragma["special"] = special + if repo.get("pragma", {}).get("absent", False): + pragma["absent"] = True + if pragma: + changes["pragma"] = pragma return dict(remote_stub, **changes) elif remote_type == "git tree": # for imports from git-trees, file repos become 'git tree' types; the @@ -716,6 +733,14 @@ def rewrite_file_repo(repo: Json, remote_type: str, remote_stub: Dict[str, Any], subdir=subdir, upstream=None, fail_context=fail_context) + # keep ignore special and absent pragmas + pragma = {} + if repo.get("pragma", {}).get("special", None) == "ignore": + pragma["special"] = "ignore" + if repo.get("pragma", {}).get("absent", False): + pragma["absent"] = True + if pragma: + remote_desc["pragma"] = pragma return remote_desc fail("Unsupported remote type!") |