diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-05-04 16:24:28 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-05-04 16:24:28 +0200 |
commit | 5aa5cb7941301205b4285163652178b17888d098 (patch) | |
tree | 44de5c4da8463577828df797682250d68c9ed43c /src | |
parent | f2537a593998ae466d2317e5a70210d3d51b2729 (diff) | |
download | justbuild-5aa5cb7941301205b4285163652178b17888d098.tar.gz |
install: normalize dir paths
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/build_engine/target_map/built_in_rules.cpp | 8 | ||||
-rw-r--r-- | src/buildtool/build_engine/target_map/utils.cpp | 7 | ||||
-rw-r--r-- | src/buildtool/build_engine/target_map/utils.hpp | 2 |
3 files changed, 10 insertions, 7 deletions
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::string> { std::vector<std::filesystem::path> 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<std::string>; |