Skip to content

Commit

Permalink
Add a hook to not delete the build dir.
Browse files Browse the repository at this point in the history
Either using the command line: --keep-build-dir
Or by setting an environment variable: OPAMKEEPBUILDDIR

This should fix ocaml#313
  • Loading branch information
samoht committed Dec 3, 2012
1 parent b241f0d commit 5a1e391
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/client/opamMain.ml
Expand Up @@ -49,6 +49,7 @@ let global_args = [
"--root" , Arg.String set_root_dir, "--root" , Arg.String set_root_dir,
(Printf.sprintf " Change root path (default is %s)" OpamGlobals.default_opam_dir); (Printf.sprintf " Change root path (default is %s)" OpamGlobals.default_opam_dir);
"--no-checksums", Arg.Clear OpamGlobals.verify_checksums, " Do not verify checksums on download"; "--no-checksums", Arg.Clear OpamGlobals.verify_checksums, " Do not verify checksums on download";
"--keep-build-dir", Arg.Set OpamGlobals.keep_build_dir, " Keep the build directory";
] ]


let parse_args fn () = let parse_args fn () =
Expand Down
2 changes: 1 addition & 1 deletion src/client/opamSolution.ml
Expand Up @@ -148,7 +148,7 @@ let proceed_to_install t nv =
OpamGlobals.exit 2; OpamGlobals.exit 2;
) )
); );
if not !OpamGlobals.debug then if not (!OpamGlobals.keep_build_dir || !OpamGlobals.debug) then
OpamFilename.rmdir build_dir OpamFilename.rmdir build_dir


let pinned_path t nv = let pinned_path t nv =
Expand Down
5 changes: 5 additions & 0 deletions src/core/opamGlobals.ml
Expand Up @@ -23,6 +23,11 @@ let verbose = ref (
with _ -> false with _ -> false
) )


let keep_build_dir = ref (
try Sys.getenv "OPAMKEEPBUILDDIR" <> ""
with _ -> false
)

let base_packages = ref true let base_packages = ref true
let verify_checksums = ref true let verify_checksums = ref true
let yes = ref false let yes = ref false
Expand Down

0 comments on commit 5a1e391

Please sign in to comment.