diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-05-11 17:50:58 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2022-05-12 09:10:51 +0200 |
commit | b1b3f5bc981724a984ee4183ccb1fc456423411d (patch) | |
tree | 4d171e479cf6dcdc137dba4e8dcf4a326350bfb7 | |
parent | db639a5a95c4698873e652b5ea4e00353747b8e8 (diff) | |
download | justbuild-b1b3f5bc981724a984ee4183ccb1fc456423411d.tar.gz |
bootstrap-tarverser: normalize paths before creating directories
... so that destinations like "foo/." are handled correctly.
Also, support linking to "." in trees by only late creation of the
input directory.
-rwxr-xr-x | bin/bootstrap-traverser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/bootstrap-traverser.py b/bin/bootstrap-traverser.py index 1839eaa3..6ddf76ee 100755 --- a/bin/bootstrap-traverser.py +++ b/bin/bootstrap-traverser.py @@ -34,6 +34,7 @@ def build_known(desc, *, root): return os.path.join(root, "KNOWN", desc["data"]["id"]) def link(src, dest): + dest = os.path.normpath(dest) os.makedirs(os.path.dirname(dest), exist_ok=True) os.symlink(src, dest) @@ -50,11 +51,12 @@ def build_tree(desc, *, config, root, graph): tree_dir = os.path.normpath(os.path.join(root, "TREE", tree_id)) if os.path.isdir(tree_dir): return tree_dir - os.makedirs(tree_dir) tree_desc = graph["trees"][tree_id] for location, desc in tree_desc.items(): link(build(desc, config=config, root=root, graph=graph), os.path.join(tree_dir, location)) + # correctly handle the empty tree + os.makedirs(tree_dir, exist_ok=True) return tree_dir def run_action(action_id, *, config, root, graph): |