summaryrefslogtreecommitdiff
path: root/bin/just-import-git.py
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-01-13 10:47:52 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2025-01-13 12:55:16 +0100
commit48171d6a20823ea8157b723b223ca0129ac42fde (patch)
tree7bda14a16fd37b487ecccadc1fa5e3d918669b2b /bin/just-import-git.py
parentb633eff69df5cec368c4fc5d24674829f8a0b0c0 (diff)
downloadjustbuild-48171d6a20823ea8157b723b223ca0129ac42fde.tar.gz
import tools: Fix rewrite of unneeded fields
The rewrite logic assumes that for repositories taken as layers we will not have certain fields and so they are unconditionally reassigned. Fix this by extending the existing check for bindings to include also alternative roots and root files.
Diffstat (limited to 'bin/just-import-git.py')
-rwxr-xr-xbin/just-import-git.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/bin/just-import-git.py b/bin/just-import-git.py
index 7cf3f7c7..288ea35b 100755
--- a/bin/just-import-git.py
+++ b/bin/just-import-git.py
@@ -282,14 +282,16 @@ def rewrite_repo(repo_spec: Json,
if absent and isinstance(repo, dict):
repo["pragma"] = dict(repo.get("pragma", {}), **{"absent": True})
new_spec["repository"] = repo
- for key in ["target_root", "rule_root", "expression_root"]:
- if key in repo_spec:
- new_spec[key] = assign[repo_spec[key]]
- for key in ["target_file_name", "rule_file_name", "expression_file_name"]:
- if key in repo_spec:
- new_spec[key] = repo_spec[key]
- # rewrite bindings, if actually needed to be imported
+ # rewrite other roots and bindings, if actually needed to be imported
if not as_layer:
+ for key in ["target_root", "rule_root", "expression_root"]:
+ if key in repo_spec:
+ new_spec[key] = assign[repo_spec[key]]
+ for key in [
+ "target_file_name", "rule_file_name", "expression_file_name"
+ ]:
+ if key in repo_spec:
+ new_spec[key] = repo_spec[key]
bindings = repo_spec.get("bindings", {})
new_bindings = {}
for k, v in bindings.items():