Skip to content

Commit

Permalink
Avoid an unnecessary copy with 'install --inplace'
Browse files Browse the repository at this point in the history
  • Loading branch information
AltGr committed Apr 12, 2018
1 parent 99b261e commit 9234554
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,13 @@ let parallel_apply t _action ~requested ?add_roots action_graph =
else
match action with
| `Build nv ->
let build_dir =
try OpamPackage.Map.find nv inplace
let is_inplace, build_dir =
try true, OpamPackage.Map.find nv inplace
with Not_found ->
let dir = OpamPath.Switch.build t.switch_global.root t.switch nv in
if not OpamClientConfig.(!r.reuse_build_dir) then
OpamFilename.rmdir dir;
dir
false, dir
in
let test =
OpamStateConfig.(!r.build_test) && OpamPackage.Set.mem nv requested
Expand All @@ -465,7 +465,8 @@ let parallel_apply t _action ~requested ?add_roots action_graph =
OpamStateConfig.(!r.build_doc) && OpamPackage.Set.mem nv requested
in
(if OpamFilename.exists_dir source_dir
then OpamFilename.copy_dir ~src:source_dir ~dst:build_dir
then (if not is_inplace then
OpamFilename.copy_dir ~src:source_dir ~dst:build_dir)
else OpamFilename.mkdir build_dir;
OpamAction.prepare_package_source t nv build_dir @@+ function
| Some exn -> store_time (); Done (`Exception exn)
Expand Down

0 comments on commit 9234554

Please sign in to comment.