Permalink
Browse files

Use ocp-indent to re-indent everything

No semantic changes
  • Loading branch information...
1 parent ef3d765 commit 977e56a60e447d3cb4d9190277bf6e7350f344db @samoht committed Mar 29, 2013
View
@@ -12,8 +12,8 @@ let () =
if md5 <> md5_of_file then (
Printf.eprintf
"MD5 for %s differ:\n\
- \ expected: %s\n\
- \ actual: %s\n"
+ \ expected: %s\n\
+ \ actual: %s\n"
file md5 md5_of_file;
Sys.remove file
) else
View
@@ -240,25 +240,25 @@ let extract_package t nv =
let build_dir = OpamPath.Switch.build t.root t.switch nv in
OpamFilename.rmdir build_dir;
begin match OpamState.pinned_path t (OpamPackage.name nv) with
- | Some p ->
- let pinned_dir = OpamPath.Switch.pinned_dir t.root t.switch (OpamPackage.name nv) in
- if not (OpamFilename.exists_dir pinned_dir) then (
- match OpamState.update_pinned_package t (OpamPackage.name nv) with
- | Not_available -> OpamGlobals.error "%s is not available" (OpamFilename.Dir.to_string p)
- | Result _
- | Up_to_date _ -> ()
- ) else
- OpamGlobals.msg "Synchronization: nothing to do as the pinned package has already been initialized.\n";
- let _files = OpamState.with_repository t nv (fun repo _ ->
- OpamFilename.in_dir pinned_dir (fun () -> OpamRepository.copy_files repo nv)
- ) in
- OpamFilename.copy_dir ~src:pinned_dir ~dst:build_dir
- | _ ->
- match get_archive t nv with
- | None -> ()
- | Some archive ->
- OpamGlobals.msg "Extracting %s.\n" (OpamFilename.to_string archive);
- OpamFilename.extract archive build_dir
+ | Some p ->
+ let pinned_dir = OpamPath.Switch.pinned_dir t.root t.switch (OpamPackage.name nv) in
+ if not (OpamFilename.exists_dir pinned_dir) then (
+ match OpamState.update_pinned_package t (OpamPackage.name nv) with
+ | Not_available -> OpamGlobals.error "%s is not available" (OpamFilename.Dir.to_string p)
+ | Result _
+ | Up_to_date _ -> ()
+ ) else
+ OpamGlobals.msg "Synchronization: nothing to do as the pinned package has already been initialized.\n";
+ let _files = OpamState.with_repository t nv (fun repo _ ->
+ OpamFilename.in_dir pinned_dir (fun () -> OpamRepository.copy_files repo nv)
+ ) in
+ OpamFilename.copy_dir ~src:pinned_dir ~dst:build_dir
+ | _ ->
+ match get_archive t nv with
+ | None -> ()
+ | Some archive ->
+ OpamGlobals.msg "Extracting %s.\n" (OpamFilename.to_string archive);
+ OpamFilename.extract archive build_dir
end;
prepare_package_build t nv;
build_dir
@@ -267,9 +267,9 @@ let string_of_commands commands =
let commands_s = List.map (fun cmd -> String.concat " " cmd) commands in
" "
^ if commands_s <> [] then
- String.concat "\n " commands_s
- else
- "Nothing to do."
+ String.concat "\n " commands_s
+ else
+ "Nothing to do."
let compilation_env t opam =
let env0 = OpamState.get_full_env t in
@@ -386,11 +386,11 @@ let remove_package_aux t ~metadata ~rm_build nv =
future installation. TODO: is it the expected semantics ? *)
let share = OpamPath.Switch.share t.root t.switch name in
(match OpamFilename.rec_files share, OpamFilename.rec_dirs share with
- | [], [] -> OpamFilename.rmdir share
- | _ ->
- OpamGlobals.msg
- "WARNING: %s is not empty. We keep its contents for future installations.\n"
- (OpamFilename.Dir.to_string share));
+ | [], [] -> OpamFilename.rmdir share
+ | _ ->
+ OpamGlobals.msg
+ "WARNING: %s is not empty. We keep its contents for future installations.\n"
+ (OpamFilename.Dir.to_string share));
(* Remove .config and .install *)
log "Removing config and install files";
@@ -445,8 +445,8 @@ let remove_all_packages t ~metadata sol =
explore. Do not try to recover yet. *)
let build_and_install_package_aux t ~metadata nv =
let left, right = match !OpamGlobals.utf8_msgs with
- | true -> "\xF0\x9F\x90\xAB " (* UTF-8 <U+1F42B, U+0020> *), ""
- | false -> "=-=-=", "=-=-="
+ | true -> "\xF0\x9F\x90\xAB " (* UTF-8 <U+1F42B, U+0020> *), ""
+ | false -> "=-=-=", "=-=-="
in
OpamGlobals.msg "\n%s Installing %s %s\n" left (OpamPackage.to_string nv) right;
@@ -25,8 +25,8 @@ val build_and_install_package: t -> metadata:bool -> package -> unit
val remove_package: t -> metadata:bool -> rm_build:bool -> package -> unit
(** Remove all the packages from a solution. This includes the package
- to delete, to upgrade and to recompile. Return the set of all deleted
- packages. *)
+ to delete, to upgrade and to recompile. Return the set of all deleted
+ packages. *)
val remove_all_packages: t -> metadata:bool -> solution -> package_set
(** Update package metadata *)
View
@@ -310,11 +310,11 @@ let names_of_regexp t ~installed_only ~name_only ~case_sensitive ~all regexps =
|| partial_match descr))
) names in
- if not (OpamPackage.Set.is_empty t.packages)
- && OpamPackage.Name.Map.is_empty names then
- OpamGlobals.error_and_exit "No packages found."
- else
- names
+ if not (OpamPackage.Set.is_empty t.packages)
+ && OpamPackage.Name.Map.is_empty names then
+ OpamGlobals.error_and_exit "No packages found."
+ else
+ names
module API = struct
@@ -743,75 +743,75 @@ module API = struct
if OpamFilename.exists config_f then
OpamGlobals.error_and_exit "OPAM has already been initialized."
else try
- let repo_p = OpamPath.Repository.create root repo.repo_name in
- (* Create (possibly empty) configuration files *)
- let switch =
- if compiler = OpamCompiler.system then
- OpamSwitch.default
- else
- OpamSwitch.of_string (OpamCompiler.to_string compiler) in
-
- (* Create ~/.opam/compilers/system.comp *)
- let system_version = OpamCompiler.Version.current () in
- OpamState.create_system_compiler_description root system_version;
-
- (* Create ~/.opam/config *)
- let config = OpamFile.Config.create OpamVersion.current switch [repo.repo_name] jobs in
- OpamFile.Config.write config_f config;
-
- (* Create ~/.opam/aliases *)
- OpamFile.Aliases.write (OpamPath.aliases root) (OpamSwitch.Map.add switch compiler OpamSwitch.Map.empty);
-
- (* Init repository *)
- OpamFile.Repo_index.write (OpamPath.repo_index root) OpamPackage.Name.Map.empty;
- OpamFile.Repo_config.write (OpamPath.Repository.config repo_p) repo;
- OpamRepository.init repo;
-
- (* Init global dirs *)
- OpamFilename.mkdir (OpamPath.opam_dir root);
- OpamFilename.mkdir (OpamPath.descr_dir root);
- OpamFilename.mkdir (OpamPath.archives_dir root);
- OpamFilename.mkdir (OpamPath.compilers_dir root);
-
- (* Load the partial state, and update the repository state *)
- log "updating repository state";
- let t = OpamState.load_repository_state "init" in
- update_repositories t ~show_compilers:false t.repositories;
-
- (* Load the partial state, and update the packages state *)
- log "updating package state";
- let t = OpamState.load_state ~save_cache:false "init-1" in
- let switch = OpamSwitch.of_string (OpamCompiler.to_string compiler) in
- let quiet = (compiler = OpamCompiler.system) in
- OpamState.install_compiler t ~quiet switch compiler;
- OpamState.update_switch_config t switch;
- update_packages t ~show_packages:false t.repositories OpamPackage.Name.Set.empty;
-
- (* Finally, load the complete state and install the compiler packages *)
- log "installing compiler packages";
- let t = OpamState.load_state "init-2" in
- let compiler_packages = OpamState.get_compiler_packages t compiler in
- let compiler_names = OpamPackage.Name.Set.of_list (List.rev_map fst compiler_packages) in
- let _solution = OpamSolution.resolve_and_apply ~force:true t (Init compiler_names)
- { wish_install = [];
- wish_remove = [];
- wish_upgrade = compiler_packages } in
-
- let dot_profile_o = Some dot_profile in
- let user = Some { shell; ocamlinit = true; dot_profile = dot_profile_o } in
- begin match update_config with
- | `ask -> OpamState.update_setup_interactive t shell dot_profile
- | `no -> ()
- | `yes ->
- let global = Some { complete = true; switch_eval = true } in
- OpamState.update_setup t user global
- end;
- OpamState.print_env_warning t user
-
- with e ->
- if not !OpamGlobals.debug then
- OpamFilename.rmdir (OpamPath.root root);
- raise e
+ let repo_p = OpamPath.Repository.create root repo.repo_name in
+ (* Create (possibly empty) configuration files *)
+ let switch =
+ if compiler = OpamCompiler.system then
+ OpamSwitch.default
+ else
+ OpamSwitch.of_string (OpamCompiler.to_string compiler) in
+
+ (* Create ~/.opam/compilers/system.comp *)
+ let system_version = OpamCompiler.Version.current () in
+ OpamState.create_system_compiler_description root system_version;
+
+ (* Create ~/.opam/config *)
+ let config = OpamFile.Config.create OpamVersion.current switch [repo.repo_name] jobs in
+ OpamFile.Config.write config_f config;
+
+ (* Create ~/.opam/aliases *)
+ OpamFile.Aliases.write (OpamPath.aliases root) (OpamSwitch.Map.add switch compiler OpamSwitch.Map.empty);
+
+ (* Init repository *)
+ OpamFile.Repo_index.write (OpamPath.repo_index root) OpamPackage.Name.Map.empty;
+ OpamFile.Repo_config.write (OpamPath.Repository.config repo_p) repo;
+ OpamRepository.init repo;
+
+ (* Init global dirs *)
+ OpamFilename.mkdir (OpamPath.opam_dir root);
+ OpamFilename.mkdir (OpamPath.descr_dir root);
+ OpamFilename.mkdir (OpamPath.archives_dir root);
+ OpamFilename.mkdir (OpamPath.compilers_dir root);
+
+ (* Load the partial state, and update the repository state *)
+ log "updating repository state";
+ let t = OpamState.load_repository_state "init" in
+ update_repositories t ~show_compilers:false t.repositories;
+
+ (* Load the partial state, and update the packages state *)
+ log "updating package state";
+ let t = OpamState.load_state ~save_cache:false "init-1" in
+ let switch = OpamSwitch.of_string (OpamCompiler.to_string compiler) in
+ let quiet = (compiler = OpamCompiler.system) in
+ OpamState.install_compiler t ~quiet switch compiler;
+ OpamState.update_switch_config t switch;
+ update_packages t ~show_packages:false t.repositories OpamPackage.Name.Set.empty;
+
+ (* Finally, load the complete state and install the compiler packages *)
+ log "installing compiler packages";
+ let t = OpamState.load_state "init-2" in
+ let compiler_packages = OpamState.get_compiler_packages t compiler in
+ let compiler_names = OpamPackage.Name.Set.of_list (List.rev_map fst compiler_packages) in
+ let _solution = OpamSolution.resolve_and_apply ~force:true t (Init compiler_names)
+ { wish_install = [];
+ wish_remove = [];
+ wish_upgrade = compiler_packages } in
+
+ let dot_profile_o = Some dot_profile in
+ let user = Some { shell; ocamlinit = true; dot_profile = dot_profile_o } in
+ begin match update_config with
+ | `ask -> OpamState.update_setup_interactive t shell dot_profile
+ | `no -> ()
+ | `yes ->
+ let global = Some { complete = true; switch_eval = true } in
+ OpamState.update_setup t user global
+ end;
+ OpamState.print_env_warning t user
+
+ with e ->
+ if not !OpamGlobals.debug then
+ OpamFilename.rmdir (OpamPath.root root);
+ raise e
let install names =
log "INSTALL %s" (OpamPackage.Name.Set.to_string names);
@@ -27,7 +27,7 @@ module API: sig
unit
(** Display all available packages that matches any of the
- regexps. *)
+ regexps. *)
val list:
print_short:bool ->
installed_only:bool ->
Oops, something went wrong.

0 comments on commit 977e56a

Please sign in to comment.