Skip to content

Commit

Permalink
More checks for external commands at init time
Browse files Browse the repository at this point in the history
Closes #1562
  • Loading branch information
AltGr committed Aug 5, 2014
1 parent 7345220 commit abbae00
Showing 1 changed file with 30 additions and 13 deletions.
43 changes: 30 additions & 13 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1003,14 +1003,6 @@ module API = struct
let check_external_dep name =
OpamSystem.command_exists name
in
if not (check_external_dep
(OpamMisc.Option.default "curl" OpamGlobals.curl_command)
|| check_external_dep "wget") then
OpamGlobals.error_and_exit
"Missing dependency: %s or %s are required for OPAM to operate, \
please install either of them."
(OpamGlobals.colorise `bold "curl")
(OpamGlobals.colorise `bold "wget");
OpamGlobals.msg "Checking for available remotes: ";
let repo_types =
["rsync", "rsync and local";
Expand All @@ -1024,13 +1016,38 @@ module API = struct
| r -> String.concat ", " (List.map snd r));
List.iter (fun (cmd,msg) ->
OpamGlobals.note
"%s not found, you won't be able to use %s repositories."
cmd msg)
"%s not found, you won't be able to use %s repositories \
unless you install it."
(OpamGlobals.colorise `bold cmd) msg)
unavailable_repos;
if not (check_external_dep "aspcud") then
if not (check_external_dep (OpamGlobals.get_external_solver())) then
OpamGlobals.warning
"External solver 'aspcud' not found, OPAM will provide better \
solutions if you install it.\n";
"Recommendend external solver %s not found."
(OpamGlobals.colorise `bold (OpamGlobals.get_external_solver ()));
let advised_deps = [!OpamGlobals.makecmd(); "m4"; "cc"] in
(match List.filter (not @* check_external_dep) advised_deps with
| [] -> ()
| missing ->
OpamGlobals.warning
"Recommended dependencies -- \
most packages rely on those:\n - %s"
(String.concat "\n - "
(List.map (OpamGlobals.colorise `bold) missing)));
let required_deps =
["curl or wget",
check_external_dep
(OpamMisc.Option.default "curl" OpamGlobals.curl_command)
|| check_external_dep "wget";
"patch", check_external_dep "patch"]
in
(match List.filter (not @* snd) required_deps with
| [] -> ()
| missing ->
OpamGlobals.error_and_exit
"Missing dependencies -- \
the following commands are required for OPAM to operate:\n - %s"
(String.concat "\n - "
(List.map (OpamGlobals.colorise `bold @* fst) missing)));

(* Create (possibly empty) configuration files *)
let switch =
Expand Down

0 comments on commit abbae00

Please sign in to comment.