From 5aa5cb7941301205b4285163652178b17888d098 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 4 May 2022 16:24:28 +0200 Subject: install: normalize dir paths --- src/buildtool/build_engine/target_map/built_in_rules.cpp | 8 ++++++-- src/buildtool/build_engine/target_map/utils.cpp | 7 ++----- src/buildtool/build_engine/target_map/utils.hpp | 2 ++ 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp index 8ff3a9c3..22e52c73 100644 --- a/src/buildtool/build_engine/target_map/built_in_rules.cpp +++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp @@ -329,10 +329,14 @@ void InstallRuleWithDeps( // within a target, artifacts and runfiles may overlap, but artifacts // take perference for (auto const& [path, artifact] : target->Artifacts()->Map()) { - subdir_stage.emplace((dir_path / path).string(), artifact); + subdir_stage.emplace( + BuildMaps::Target::Utils::normal(dir_path / path).string(), + artifact); } for (auto const& [path, artifact] : target->RunFiles()->Map()) { - subdir_stage.emplace((dir_path / path).string(), artifact); + subdir_stage.emplace( + BuildMaps::Target::Utils::normal(dir_path / path).string(), + artifact); } auto to_stage = ExpressionPtr{Expression::map_t{subdir_stage}}; auto dup = stage->Map().FindConflictingDuplicate(to_stage->Map()); diff --git a/src/buildtool/build_engine/target_map/utils.cpp b/src/buildtool/build_engine/target_map/utils.cpp index 5d80b4c7..bff5d1b8 100644 --- a/src/buildtool/build_engine/target_map/utils.cpp +++ b/src/buildtool/build_engine/target_map/utils.cpp @@ -73,9 +73,8 @@ auto BuildMaps::Target::Utils::keys_expr(const ExpressionPtr& map) return ExpressionPtr{result}; } -namespace { - -auto normal(std::filesystem::path const& p) -> std::filesystem::path { +auto BuildMaps::Target::Utils::normal(std::filesystem::path const& p) + -> std::filesystem::path { auto n = p.lexically_normal(); if (not n.has_filename()) { return n.parent_path(); @@ -83,8 +82,6 @@ auto normal(std::filesystem::path const& p) -> std::filesystem::path { return n; } -} // namespace - auto BuildMaps::Target::Utils::tree_conflict(const ExpressionPtr& map) -> std::optional { std::vector trees{}; diff --git a/src/buildtool/build_engine/target_map/utils.hpp b/src/buildtool/build_engine/target_map/utils.hpp index 96bfd1fa..f9d7d658 100644 --- a/src/buildtool/build_engine/target_map/utils.hpp +++ b/src/buildtool/build_engine/target_map/utils.hpp @@ -35,6 +35,8 @@ auto obtainTarget(const SubExprEvaluator&, auto keys_expr(const ExpressionPtr& map) -> ExpressionPtr; +auto normal(std::filesystem::path const& p) -> std::filesystem::path; + auto tree_conflict(const ExpressionPtr& /* map */) -> std::optional; -- cgit v1.2.3