From b1b3f5bc981724a984ee4183ccb1fc456423411d Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Wed, 11 May 2022 17:50:58 +0200 Subject: 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. --- bin/bootstrap-traverser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'bin/bootstrap-traverser.py') 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): -- cgit v1.2.3