Permalink
Browse files

Add a hook to not delete the build dir.

Either using the command line: --keep-build-dir
Or by setting an environment variable: OPAMKEEPBUILDDIR

This should fix #313
  • Loading branch information...
1 parent b241f0d commit 5a1e391f19bda3dd039ed6e340b73fdb169123e9 @samoht samoht committed Dec 3, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −0 src/client/opamMain.ml
  2. +1 −1 src/client/opamSolution.ml
  3. +5 −0 src/core/opamGlobals.ml
@@ -49,6 +49,7 @@ let global_args = [
"--root" , Arg.String set_root_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";
+ "--keep-build-dir", Arg.Set OpamGlobals.keep_build_dir, " Keep the build directory";
]
let parse_args fn () =
@@ -148,7 +148,7 @@ let proceed_to_install t nv =
OpamGlobals.exit 2;
)
);
- if not !OpamGlobals.debug then
+ if not (!OpamGlobals.keep_build_dir || !OpamGlobals.debug) then
OpamFilename.rmdir build_dir
let pinned_path t nv =
@@ -23,6 +23,11 @@ let verbose = ref (
with _ -> false
)
+let keep_build_dir = ref (
+ try Sys.getenv "OPAMKEEPBUILDDIR" <> ""
+ with _ -> false
+)
+
let base_packages = ref true
let verify_checksums = ref true
let yes = ref false

0 comments on commit 5a1e391

Please sign in to comment.