From c3c1b16b5b0f086187ddad49d250b55d09d78ac0 Mon Sep 17 00:00:00 2001 From: Louis Gesbert Date: Tue, 15 Apr 2014 10:41:29 +0200 Subject: [PATCH] Allow installing absent package on "opam reinstall" (after a confirmation) Closes #1082 --- src/client/opamClient.ml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index ce375d0c58f..1beca30bd09 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -1102,10 +1102,14 @@ module API = struct let reinstall, not_installed = get_installed_atoms t atoms in if not_installed <> [] then - OpamGlobals.error_and_exit "%s %s not installed.\n" - (OpamMisc.pretty_list - (List.map OpamFormula.short_string_of_atom not_installed)) - (match not_installed with [_] -> "is" | _ -> "are"); + (OpamGlobals.warning "%s %s not installed." + (OpamMisc.pretty_list + (List.map OpamFormula.short_string_of_atom not_installed)) + (match not_installed with [_] -> "is" | _ -> "are"); + if OpamState.confirm "Install ?" then + install_t atoms None false t) + else + let reinstall = OpamPackage.Set.of_list reinstall in let universe = OpamState.universe t Depends in let depends = (* Do not cast to a set, we need to keep the order *)