Browse files

remove spaces (cont)

  • Loading branch information...
1 parent ae99a2e commit c58504d3b2ab19095b10e6c1535272b70e9c9761 @samoht samoht committed Sep 18, 2012
Showing with 147 additions and 147 deletions.
  1. +2 −2 src/file_format.ml
  2. +2 −2 src/file_format.mli
  3. +8 −8 src/opam.ml
  4. +6 −6 src/parallel.ml
  5. +3 −3 src/path.ml
  6. +5 −5 src/path.mli
  7. +5 −5 src/process.ml
  8. +4 −4 src/repositories.ml
  9. +18 −18 src/run.ml
  10. +3 −3 src/run.mli
  11. +65 −65 src/solver.ml
  12. +3 −3 src/solver.mli
  13. +12 −12 src/types.ml
  14. +8 −8 src/types.mli
  15. +3 −3 src/utils.ml
View
4 src/file_format.ml
@@ -168,7 +168,7 @@ let parse_sequence fns v =
aux (fns, l)
| x -> bad_format "Expecting a list, got %s" (kind x)
-
+
let make_string str = String str
let make_ident str = Ident str
@@ -197,7 +197,7 @@ let is_list = function
let pretty_force_newline = ref false
-let force_newline f =
+let force_newline f =
let save = !pretty_force_newline in
let () = pretty_force_newline := true in
let res = f () in
View
4 src/file_format.mli
@@ -149,7 +149,7 @@ val make_string_pair: string * string -> value
(** {2 Printing functions} *)
-(** Apply the given printer function
+(** Apply the given printer function
by putting a newline between every element of every list *)
val force_newline : (unit -> 'a) -> 'a
@@ -179,7 +179,7 @@ val assoc_option : item list -> string -> (value -> 'a) -> 'a option
(** Get the value of a field. If the variable does not exist, return a
default value *)
-val assoc_default : 'a -> item list -> string -> (value -> 'a) -> 'a
+val assoc_default : 'a -> item list -> string -> (value -> 'a) -> 'a
(** Get the value associated to a variable. If the variable does not
exists, return [] *)
View
16 src/opam.ml
@@ -54,7 +54,7 @@ let global_args = [
"--quiet" , Arg.Clear quiet, " Not display the stdout/stderr of subprocesses";
"--version" , Arg.Unit version, " Display version information";
"--yes" , Arg.Set Globals.yes, " Answer yes to all questions";
- "--makecmd" , Arg.Set_string Globals.makecmd,
+ "--makecmd" , Arg.Set_string Globals.makecmd,
Printf.sprintf " Set the 'make' program used when compiling packages (default is %s)" !Globals.makecmd;
"--root" , Arg.Set_string Globals.root_path,
(Printf.sprintf " Change root path (default is %s)" Globals.default_opam_path);
@@ -77,7 +77,7 @@ let guess_repository_kind kind address =
| Some k -> k
(* opam init [-kind $kind] $repo $adress *)
-let init =
+let init =
let kind = ref None in
let comp = ref None in
let cores = ref Globals.default_cores in
@@ -110,7 +110,7 @@ let init =
}
(* opam list [PACKAGE_REGEXP]* *)
-let list =
+let list =
let short = ref false in
let installed = ref false in
{
@@ -123,7 +123,7 @@ let list =
("-installed", Arg.Set installed, " Display only the list of installed packages");
];
anon;
- main =
+ main =
parse_args (function args ->
let print_short = !short in
let installed_only = !installed in
@@ -147,7 +147,7 @@ let search =
];
anon;
- main =
+ main =
parse_args (function args ->
let print_short = !short in
let installed_only = !installed in
@@ -171,7 +171,7 @@ let info = {
}
(* opam config [-r [-I|-bytelink|-asmlink] PACKAGE+ *)
-let config =
+let config =
let has_cmd = ref false in
let is_rec = ref false in
let is_link = ref false in
@@ -286,7 +286,7 @@ let upgrade = {
}
(* opam upload PACKAGE *)
-let upload =
+let upload =
let opam = ref "" in
let descr = ref "" in
let archive = ref "" in
@@ -334,7 +334,7 @@ let remove = {
}
(* opam remote [-list|-add <url>|-rm <url>] *)
-let remote =
+let remote =
let kind = ref None in
let command : [`add|`list|`rm] option ref = ref None in
let set c () = command := Some c in
View
12 src/parallel.ml
@@ -72,10 +72,10 @@ module Make (G : G) = struct
log "ROOTS: %s" (string_of_set t.roots);
log "DEGREE: %s" (string_of_imap t.degree)
- let init graph =
+ let init graph =
let degree = ref M.empty in
let add_degree v d = degree := M.add v d !degree in
- let roots =
+ let roots =
G.fold_vertex
(fun v todo ->
let d = G.in_degree graph v in
@@ -87,7 +87,7 @@ module Make (G : G) = struct
)
) graph S.empty in
{ graph ; roots ; degree = !degree ; visited = S.empty }
-
+
let visit t x =
if S.mem x t.visited then
invalid_arg "This node has already been visited.";
@@ -101,7 +101,7 @@ module Make (G : G) = struct
let remove_degree x = degree := M.remove x !degree in
let replace_degree x d = degree := M.add x d (M.remove x !degree) in
(* Update the children of the node by decreasing by 1 their in-degree *)
- let roots =
+ let roots =
G.fold_succ
(fun x l ->
let d = M.find x t.degree in
@@ -125,14 +125,14 @@ module Make (G : G) = struct
(String.concat ","
(IntMap.fold (fun e _ l -> string_of_int e :: l) pids []))
- let string_of_status st =
+ let string_of_status st =
let st, n = match st with
| Unix.WEXITED n -> "exit", n
| Unix.WSIGNALED n -> "signal", n
| Unix.WSTOPPED n -> "stop", n in
Printf.sprintf "%s %d" st n
- let wait pids =
+ let wait pids =
let rec aux () =
let pid, status = Unix.wait () in
if IntMap.mem pid pids then (
View
6 src/path.ml
@@ -135,7 +135,7 @@ module G = struct
let available_versions t n =
versions (NV.Set.filter (fun nv -> NV.name nv = n) (available_packages t))
-
+
let descr_dir t = t / "descr"
let descr t nv = descr_dir t // NV.to_string nv
@@ -146,7 +146,7 @@ module G = struct
let repo_index t = t / "repo" // "index"
- let available_aliases t =
+ let available_aliases t =
let l = List.map fst (File.Aliases.safe_read (aliases t)) in
Alias.Set.of_list l
end
@@ -161,7 +161,7 @@ module R = struct
let of_dirname path = path
let cwd () = Dirname.cwd ()
-
+
let root t = t
let config t = t // "config"
View
10 src/path.mli
@@ -28,7 +28,7 @@ module C: sig
(** Root dir: {i $opam/$OVERSION} *)
val root: t -> dirname
-
+
(** Library path for a given package:
{i $opam/$OVERSION/lib/NAME} *)
val lib: t -> N.t -> dirname
@@ -59,12 +59,12 @@ module C: sig
{i $opam/$OVERSION/installed} *)
val installed: t -> filename
- (** Tempory folders used to decompress and compile
+ (** Tempory folders used to decompress and compile
the corresponding archives:
{i $opam/$OVERSION/build/$NAME-$VERSION} *)
val build: t -> NV.t -> dirname
- (** Tempory folders used to decompress and compile
+ (** Tempory folders used to decompress and compile
the OCaml compiler:
{i $opam/$OVERSION/build/_} *)
val build_ocaml: t -> dirname
@@ -76,7 +76,7 @@ module C: sig
processed: {i $opam/$OVERSION/build/$NAME.$VERSION/$NAME.env} *)
val build_env: t -> NV.t -> filename
- (** A file containing a copy of the current env variables, before
+ (** A file containing a copy of the current env variables, before
the env variables for the build are set:
{i $opam/$OVERSION/build/$NAME.$VERSION/$NAME.old.env} *)
val build_old_env: t -> NV.t -> filename
@@ -95,7 +95,7 @@ module C: sig
(** Installed files: {i $opam/$OVERSION/install/} *)
val install_dir: t -> dirname
-
+
(** Packages to reinstall on next upgrade:
{i $opam/$OVERSION/reinstall} *)
val reinstall: t -> filename
View
10 src/process.ml
@@ -137,13 +137,13 @@ let output_lines oc lines =
flush oc
let run ?env ~verbose ~name cmd args =
- try
+ try
let stdout = Printf.sprintf "%s.out" name in
let stderr = Printf.sprintf "%s.err" name in
let info = Printf.sprintf "%s.info" name in
-
+
let env = match env with Some e -> e | None -> Unix.environment () in
-
+
(* Write info file *)
let chan = open_out info in
output_lines chan
@@ -152,13 +152,13 @@ let run ?env ~verbose ~name cmd args =
String.concat "\n" (Array.to_list env)
];
close_out chan;
-
+
let p = create ~env ~info ~stdout ~stderr ~verbose cmd args in
wait p
with e ->
Globals.error "Exception %s in run" (Printexc.to_string e);
Globals.exit 2
-
+
let is_success r = r.r_code = 0
let is_failure r = r.r_code <> 0
View
8 src/repositories.ml
@@ -169,7 +169,7 @@ let make_archive nv =
if dir <> extract_dir then
Dirname.copy download_dir extract_dir
end;
-
+
(* Eventually add the files/<package>/* to the extracted dir *)
log "Adding the files to the archive";
let files = Path.R.available_files local_repo nv in
@@ -187,7 +187,7 @@ let make_archive nv =
[ "tar" ; "czf" ; Filename.to_string local_archive ; NV.to_string nv ]
]
)
-
+
(* Download the archive on the OPAM server.
If it is not there, then:
* download the original archive upstream
@@ -200,7 +200,7 @@ let download r nv =
(* If the archive is on the server, download it directly *)
match Dirname.in_dir local_dir (fun () -> download_archive r nv) with
| Up_to_date local_file ->
- Globals.msg "The archive for %s is in the local cache.\n" (NV.to_string nv);
+ Globals.msg "The archive for %s is in the local cache.\n" (NV.to_string nv);
log "The archive for %s is already downloaded and up-to-date"
(NV.to_string nv)
| Result local_file ->
@@ -217,7 +217,7 @@ let update r =
let module B = (val find_backend r: BACKEND) in
let files = Dirname.in_dir local_dir (fun () -> B.update (Repository.address r)) in
let packages = nv_set_of_files files in
-
+
let cached_packages = Path.R.available_tmp local_repo in
(* Clean-up outdated archives *)
View
36 src/run.ml
@@ -26,7 +26,7 @@ module Sys2 = struct
open Unix
(** behaves as [Sys.is_directory] except for symlinks, which returns always [false]. *)
- let is_directory file =
+ let is_directory file =
(lstat file).st_kind = S_DIR
end
@@ -58,22 +58,22 @@ let safe_mkdir dir =
end
let mkdir dir =
- let rec aux dir =
+ let rec aux dir =
if not (Sys.file_exists dir) then begin
aux (Filename.dirname dir);
safe_mkdir dir;
end in
aux dir
-
-let is_link filename =
+
+let is_link filename =
let open Unix in
(lstat filename).st_kind = S_LNK
let remove_file file =
log "remove_file %s" file;
try Unix.unlink file
with Unix.Unix_error _ -> ()
-
+
let copy src dst =
if src <> dst then begin
log "copying %s to %s" src dst;
@@ -83,7 +83,7 @@ let copy src dst =
let ic = open_in_bin src in
let oc =
if Sys.file_exists dst then
- (* WARNING here we [remove_file] because the copy will fail
+ (* WARNING here we [remove_file] because the copy will fail
- if [dst] is a link
- or if [dst] is a regular file with not enough permission (e.g. "u-w") *)
remove_file dst;
@@ -135,7 +135,7 @@ let in_dir dir fn =
with e ->
reset_cwd ();
raise e
-
+
let list kind dir =
if Sys.file_exists dir then
in_dir dir (fun () ->
@@ -226,7 +226,7 @@ let real_path p =
dir / base
)
-let replace_path bins =
+let replace_path bins =
let path = ref "<not set>" in
let env = Unix.environment () in
for i = 0 to Array.length env - 1 do
@@ -254,7 +254,7 @@ let run_process ?verbose ?(add_to_env=[]) ?(add_to_path=[]) = function
mkdir (Filename.dirname name);
let str = String.concat " " (cmd :: args) in
log "cwd=%s path=%s name=%s %s" (Unix.getcwd ()) path name str;
- if None <> try Some (String.index cmd ' ') with Not_found -> None then
+ if None <> try Some (String.index cmd ' ') with Not_found -> None then
Globals.warning "Command %S contains 1 space" cmd;
let verbose = match verbose with
| None -> !Globals.debug || !Globals.verbose
@@ -271,7 +271,7 @@ let command ?verbose ?(add_to_env=[]) ?(add_to_path=[]) cmd =
else
process_error r
-let commands ?verbose ?(add_to_env=[]) ?(add_to_path = []) commands =
+let commands ?verbose ?(add_to_env=[]) ?(add_to_path = []) commands =
List.iter (command ?verbose ~add_to_env ~add_to_path) commands
let read_command_output ?(add_to_env=[]) ?(add_to_path=[]) cmd =
@@ -283,14 +283,14 @@ let read_command_output ?(add_to_env=[]) ?(add_to_path=[]) cmd =
module Tar = struct
- let extensions =
+ let extensions =
[ [ "tar.gz" ; "tgz" ], 'z'
; [ "tar.bz2" ; "tbz" ], 'j' ]
- let match_ext file ext =
+ let match_ext file ext =
List.exists (Filename.check_suffix file) ext
- let assoc file =
+ let assoc file =
snd (List.find (function ext, _ -> match_ext file ext) extensions)
let is_archive f =
@@ -302,8 +302,8 @@ module Tar = struct
List.fold_left
(function
| Some s -> (fun _ -> Some s)
- | None ->
- (fun (ext, c) ->
+ | None ->
+ (fun (ext, c) ->
if match_ext file ext then
Some (fun dir -> command [ "tar" ; Printf.sprintf "xf%c" c ; file; "-C" ; dir ])
else
@@ -321,7 +321,7 @@ let extract file dst =
with_tmp_dir (fun tmp_dir ->
match Tar.extract_function file with
| None -> internal_error "%s is not a valid archive" file
- | Some f ->
+ | Some f ->
f tmp_dir;
if Sys.file_exists dst then internal_error "Cannot overwrite %s" dst;
match directories_strict tmp_dir with
@@ -373,7 +373,7 @@ let flock () =
Globals.log id "locking %s" file;
end in
loop ()
-
+
let funlock () =
let id = string_of_int (Unix.getpid ()) in
let file = lock_file () in
@@ -417,7 +417,7 @@ let ocamlc_where () =
let download_command =
try
command ~verbose:false ["which"; "curl"];
- (fun src -> [ "curl"; "--insecure" ; "-OL"; src ])
+ (fun src -> [ "curl"; "--insecure" ; "-OL"; src ])
with Process_error _ ->
try
command ~verbose:false ["which"; "wget"];
View
6 src/run.mli
@@ -70,7 +70,7 @@ val in_dir: string -> (unit -> 'a) -> 'a
Links simulating directory are ignored, others links are returned. *)
val files_with_links: string -> string list
-(** [rec_files dir] returns the list of all files in [dir],
+(** [rec_files dir] returns the list of all files in [dir],
recursively.
Links behaving like directory are crossed. *)
val rec_files: string -> string list
@@ -95,8 +95,8 @@ val command:
?add_to_env:(string*string) list ->
?add_to_path:string list -> command -> unit
-(** [commands ~add_to_path cmds] executes the commands [cmds]
- in a context where $PATH contains [add_to_path] at the beginning.
+(** [commands ~add_to_path cmds] executes the commands [cmds]
+ in a context where $PATH contains [add_to_path] at the beginning.
It stops whenever one command fails. *)
val commands:
?verbose:bool ->
View
130 src/solver.ml
@@ -132,7 +132,7 @@ let print_solution t =
(function { action ; _ } -> Globals.msg "%s\n" (string_of_action action))
t.to_add
-type 'a internal_action =
+type 'a internal_action =
| I_to_change of 'a option * 'a
| I_to_delete of 'a
| I_to_recompile of 'a
@@ -162,7 +162,7 @@ let string_of_internal_request f r =
(string_of_list f r.i_wish_remove)
(string_of_list f r.i_wish_upgrade)
-let request_map f r =
+let request_map f r =
let f = List.map f in
{ i_wish_install = f r.wish_install
; i_wish_remove = f r.wish_remove
@@ -214,7 +214,7 @@ let string_of_universe u =
(fun accu p -> string_of_cudf_package p :: accu)
[] u in
Printf.sprintf "{%s}" (String.concat ", " l)
-
+
module CudfDiff : sig
type answer = Cudf.package internal_action list
@@ -225,7 +225,7 @@ module CudfDiff : sig
answer option
end = struct
-
+
type answer = Cudf.package internal_action list
module Cudf_set = struct
@@ -244,16 +244,16 @@ end = struct
end
- let to_cudf_doc univ req =
- None,
- Cudf.fold_packages (fun l x -> x :: l) [] univ,
+ let to_cudf_doc univ req =
+ None,
+ Cudf.fold_packages (fun l x -> x :: l) [] univ,
{ Cudf.request_id = "";
install = req.i_wish_install;
remove = req.i_wish_remove;
upgrade = req.i_wish_upgrade;
req_extra = [] }
- let cudf_resolve univ req =
+ let cudf_resolve univ req =
log "INTERNAL(cudf_resolve) universe=%s request=<%s>"
(string_of_universe univ)
(string_of_internal_request string_of_cudf req);
@@ -273,25 +273,25 @@ end = struct
| None -> None
| Some l ->
log "INTERNAL(resolve) %s" (String.concat " " (List.map string_of_cudf_package l));
- try
+ try
let diff = Common.CudfDiff.diff univ_init (Cudf.load_universe l) in
Some (f_diff diff)
with
- Cudf.Constraint_violation _ ->
+ Cudf.Constraint_violation _ ->
log "INTERNAL(resolve) constraint violation";
None
- let resolve_with_optimization f_diff univ req =
+ let resolve_with_optimization f_diff univ req =
- let string_of_c l =
+ let string_of_c l =
String.concat ", " (List.map (string_of_internal_action string_of_cudf_package) l) in
match req, resolve f_diff univ req with
| { i_wish_remove = [] ; i_wish_upgrade = [] ; _ }, Some ans ->
(* determine if the user has put a constraint on the package associated to [p] in [req] *)
let has_constraint_in_req p =
- try
+ try
let _, version = List.find (fun (name, _) -> p.Cudf.package = name) req.i_wish_install in
version <> None
with Not_found ->
@@ -304,7 +304,7 @@ end = struct
| I_to_change (Some _, p)
| I_to_change (None, p) -> has_constraint_in_req p
| I_to_delete _
- | I_to_recompile _ -> true)
+ | I_to_recompile _ -> true)
ans in
begin match l_new_pkg with
@@ -313,37 +313,37 @@ end = struct
log "INTERNAL(optimization) fixed=%s, increasable=%s" (string_of_c l_p_ans) (string_of_c l_new_pkg);
(** we preserve versions of packages that were explicitely requested *)
- let l_p_ans =
+ let l_p_ans =
Utils.filter_map
- (function
+ (function
| I_to_change (_, p)
| I_to_recompile p -> Some (p.Cudf.package, Some (`Eq, p.Cudf.version))
| I_to_delete _ -> None)
l_p_ans in
(** we compute the last version of every new package (not requested) *)
- let to_continue, l_new_pkg =
+ let to_continue, l_new_pkg =
let univ_map = (** similar as [univ] but represented with map *)
- List.fold_left (fun map p ->
+ List.fold_left (fun map p ->
Utils.StringMap.add p.Cudf.package
- (Utils.IntMap.add
+ (Utils.IntMap.add
p.Cudf.version
p
(try Utils.StringMap.find p.Cudf.package map with Not_found -> Utils.IntMap.empty))
map) Utils.StringMap.empty (Cudf.get_packages univ) in
-
+
let find_max p univ =
snd (Utils.IntMap.max_binding (Utils.StringMap.find p.Cudf.package univ)) in
- List.fold_left
+ List.fold_left
(fun (to_continue, l_new_pkg) -> function
| I_to_change (Some _, p)
- | I_to_change (None, p) ->
+ | I_to_change (None, p) ->
let v_max = (find_max p univ_map).Cudf.version in
to_continue || p.Cudf.version <> v_max, (p.Cudf.package, Some (`Eq, v_max)) :: l_new_pkg
| I_to_delete _
| I_to_recompile _ -> assert false (* already filtered before *))
- (false, [])
+ (false, [])
l_new_pkg in
let consistent pkgs =
@@ -365,7 +365,7 @@ end = struct
| Some ans -> Some ans
| None -> Some ans
else
- Some ans
+ Some ans
end
| _, Some ans -> Some ans
| _, None -> None
@@ -391,15 +391,15 @@ end = struct
end
-module Graph =
+module Graph =
struct
open Algo
module PG = struct
module G = Defaultgraphs.PackageGraph.G
let union g1 g2 =
let g1 = G.copy g1 in
- let () =
+ let () =
begin
G.iter_vertex (G.add_vertex g1) g2;
G.iter_edges (G.add_edge g1) g2;
@@ -418,8 +418,8 @@ struct
end
module Make_fs (F : FS) = struct
- let fold f acc g =
- let rec aux acc iter =
+ let fold f acc g =
+ let rec aux acc iter =
match try Some (F.get iter, F.step iter) with Exit -> None with
| None -> acc
| Some (x, iter) -> aux (f acc x) iter in
@@ -461,29 +461,29 @@ struct
let cudfpkg_of_debpkg table = List.map (tocudf table)
- let get_table l_pkg_pb f =
+ let get_table l_pkg_pb f =
let table = Debian.Debcudf.init_tables l_pkg_pb in
let v = f table (cudfpkg_of_debpkg table l_pkg_pb) in
let () = Debian.Debcudf.clear table in
v
- let topo_fold g pkg_set =
+ let topo_fold g pkg_set =
let _, l =
PG_topo.fold
(fun p (set, l) ->
let add_succ_rem pkg set act =
(let set = PkgSet.remove pkg set in
try
- List.fold_left (fun set x ->
+ List.fold_left (fun set x ->
PkgSet.add x set) set (PG.succ g pkg)
- with _ -> set),
+ with _ -> set),
act :: l in
-
- if PkgSet.mem p set then
+
+ if PkgSet.mem p set then
add_succ_rem p set p
else
set, l)
- g
+ g
(pkg_set, []) in
l
@@ -508,14 +508,14 @@ struct
pkg
let filter_dependencies f_filter f_direction ?(depopts=false) (U l_pkg_pb) (P pkg_l) =
- let pkg_map =
+ let pkg_map =
List.fold_left
(fun map pkg -> NV.Map.add (NV.of_dpkg pkg) pkg map)
NV.Map.empty
l_pkg_pb in
get_table l_pkg_pb
(fun table pkglist ->
- let pkglist =
+ let pkglist =
if depopts then
List.map (extended_dependencies table) pkglist
else
@@ -534,7 +534,7 @@ struct
let filter_backward_dependencies = filter_dep (fun x -> x)
let filter_forward_dependencies = filter_dep PO.O.mirror
- let sort_by_backward_dependencies =
+ let sort_by_backward_dependencies =
filter_dependencies
(fun pkg_set -> List.filter (fun p -> PkgSet.mem p pkg_set))
(fun x -> x)
@@ -554,33 +554,33 @@ struct
log "universe=%s request=<%s>"
(string_of_packages (List.rev l_pkg_pb))
(string_of_request req);
- get_table l_pkg_pb
+ get_table l_pkg_pb
(fun table pkglist ->
let package_map pkg = NV.of_cudf table pkg in
- let i_req =
+ let i_req =
request_map
- (fun x ->
+ (fun x ->
match Debian.Debcudf.ltocudf table [x] with
| [n,c] -> Common.CudfAdd.encode n, c
| _ -> failwith "TODO"
) req in
- let resolve_diff universe =
+ let resolve_diff universe =
CudfDiff.resolve_diff universe i_req in
-
- let req_only_remove =
+
+ let req_only_remove =
(** determine if the request is a remove case *)
match req with
| { wish_remove = _ :: _; _ } -> true
| _ -> false in
- (** [graph_simple] contains the graph of packages
+ (** [graph_simple] contains the graph of packages
where the dependency relation is without optional dependencies *)
- let graph_simple, (universe, sol_o) =
+ let graph_simple, (universe, sol_o) =
let universe0 = Cudf.load_universe pkglist in
dep_reduction (Cudf.get_packages ~filter:(fun p -> p.Cudf.installed) universe0),
let universe = Cudf.load_universe (List.map (extended_dependencies table) pkglist) in
- universe,
+ universe,
resolve_diff
(if req_only_remove then
(* Universe with all the optional dependencies *)
@@ -599,9 +599,9 @@ struct
log "SOLUTION: %s" l_s;
(** compute all packages to remove *)
- let l_del_p, set_del =
+ let l_del_p, set_del =
Utils.filter_map (function
- | I_to_change (Some pkg, _)
+ | I_to_change (Some pkg, _)
| I_to_delete pkg -> Some pkg
| _ -> None) l,
PkgSet.of_list
@@ -610,25 +610,25 @@ struct
| _ -> None) l) in
(** compute initial packages to add *)
- let map_add =
+ let map_add =
PkgMap.of_list (Utils.filter_map (function
| I_to_change (None, _) when req_only_remove -> None
| I_to_change (_, pkg) as act -> Some (pkg, act)
| I_to_delete _ -> None
| I_to_recompile _ -> assert false) l) in
- (** [graph_toinstall] is similar to [graph_simple] except that
+ (** [graph_toinstall] is similar to [graph_simple] except that
the dependency relation is complete *)
- let graph_toinstall =
- PO.O.mirror
+ let graph_toinstall =
+ PO.O.mirror
(create_graph (fun p -> p.Cudf.installed || PkgMap.mem p map_add)) in
let graph_toinstall =
let graph_toinstall = PG.copy graph_toinstall in
List.iter (PG.remove_vertex graph_toinstall) l_del_p;
graph_toinstall in
(** compute packages to recompile (and perform the merge with packages to add) *)
- let _, map_act =
+ let _, map_act =
PG_topo.fold
(fun pkg (set_recompile, l_act) ->
let add_succ_rem pkg set act =
@@ -637,7 +637,7 @@ struct
List.fold_left
(fun set x -> PkgSet.add x set)
set (PG.succ graph_toinstall pkg)
- with _ -> set),
+ with _ -> set),
Utils.IntMap.add
(PG.V.hash pkg)
{ cudf = pkg ; action = action_map package_map act } l_act in
@@ -654,22 +654,22 @@ struct
(PkgSet.empty, Utils.IntMap.empty) in
(** compute packages to recompile and remove *)
- let map_act, to_remove =
+ let map_act, to_remove =
let l_remove = topo_fold (create_graph (fun p -> PkgSet.mem p set_del)) set_del in
- let () =
+ let () =
match l_remove, req_only_remove with
- | _ :: _, false ->
+ | _ :: _, false ->
Globals.warning "the removing optimization will be applied but the solver has only taken a universe with partial dependencies"
(* check below if there are some packages, that depend optionally on packages to be removed, and that will not be recompiled *)
| _ -> () in
(** partition the [l_remove] to decide for each element if we recompile them or delete. *)
List.fold_left
- (fun (map_act, l_folded) pkg ->
- if
+ (fun (map_act, l_folded) pkg ->
+ if
(** check if the user has set some packages that will explicitely be removed *)
List.exists
- (fun (p, _) -> p = pkg.Cudf.package)
+ (fun (p, _) -> p = pkg.Cudf.package)
i_req.i_wish_remove
||
(** check if [pkg] contains an optional package which has already been visited in [l_folded] *)
@@ -686,12 +686,12 @@ struct
{ cudf = pkg ; action = action_map package_map (I_to_recompile pkg) }
map_act,
l_folded
- )
+ )
(map_act, [])
l_remove in
- (** construct the answer [graph] to add.
- Then, it suffices to fold it topologically
+ (** construct the answer [graph] to add.
+ Then, it suffices to fold it topologically
by following the action given at each node (install or recompile). *)
let graph = PA_graph.create () in
Utils.IntMap.iter (fun _ -> PA_graph.add_vertex graph) map_act;
@@ -721,7 +721,7 @@ let sort_by_backward_dependencies = Graph.sort_by_backward_dependencies
let resolve = Graph.resolve
let delete_or_update t =
- t.to_remove <> [] ||
+ t.to_remove <> [] ||
PA_graph.fold_vertex
(fun v acc ->
acc || match v.action with To_change (Some _, _) -> true | _ -> false)
View
6 src/solver.mli
@@ -20,7 +20,7 @@ open Types
(** {2 Package actions} *)
(** Build action *)
-type action =
+type action =
(** The package must be installed. The package could have been
present or not, but if present, it is another version than the
@@ -98,7 +98,7 @@ val resolve : universe -> request -> NV.Set.t -> solution option
(** Return the recursive dependencies of a package Note : the given
package exists in the list in input because this list describes
the entire universe. By convention, it also appears in output.
- If [depopts] (= [false] by default) is set to [true],
+ If [depopts] (= [false] by default) is set to [true],
optional dependencies are merged with usual dependencies. *)
val filter_backward_dependencies : ?depopts:bool -> universe -> packages -> package list
@@ -107,6 +107,6 @@ val filter_backward_dependencies : ?depopts:bool -> universe -> packages -> pack
val filter_forward_dependencies : ?depopts:bool -> universe -> packages -> package list
(** Return a permutation of the given set of packages :
- if package B depends of package A then
+ if package B depends of package A then
B appears before A in the resulting list *)
val sort_by_backward_dependencies : ?depopts:bool -> universe -> packages -> package list
View
24 src/types.ml
@@ -22,7 +22,7 @@ module type SET = sig
val of_list: elt list -> t
val to_string: t -> string
val find: (elt -> bool) -> t -> elt
-end
+end
module type MAP = sig
include Map.S
val to_string: ('a -> string) -> 'a t -> string
@@ -51,7 +51,7 @@ module Set = struct
include S
- let choose_one s =
+ let choose_one s =
match elements s with
| [x] -> x
| [] -> raise Not_found
@@ -84,9 +84,9 @@ module Map = struct
let values map = List.map snd (bindings map)
- let merge_max f =
+ let merge_max f =
merge
- (fun k -> function
+ (fun k -> function
| None -> fun x -> x
| Some o1 -> function
| None -> Some o1
@@ -188,8 +188,8 @@ end = struct
Globals.error_and_exit "%s does not exists!" dirname
let exec dirname ?(add_to_env=[]) ?(add_to_path=[]) cmds =
- Run.in_dir (to_string dirname)
- (fun () ->
+ Run.in_dir (to_string dirname)
+ (fun () ->
Run.commands
~add_to_env
~add_to_path:(List.map of_string add_to_path)
@@ -222,13 +222,13 @@ end = struct
Utils.starts_with ~prefix (to_string dirname)
let remove_prefix ~prefix dirname =
- let prefix =
+ let prefix =
let str = to_string prefix in
if str = "" then "" else Filename.concat str "" in
let dirname = to_string dirname in
Utils.remove_prefix ~prefix dirname
end
-
+
type dirname = Dirname.t
let (/) d1 s2 =
@@ -466,7 +466,7 @@ end = struct
type t = string
let to_string x = x
let of_string x = x
- let compare n1 n2 =
+ let compare n1 n2 =
match compare (String.lowercase n1) (String.lowercase n2) with
| 0 -> compare n1 n2
| i -> i
@@ -558,14 +558,14 @@ end = struct
(pkg.Cudf.package, pkg.Cudf.version) in
{ name = N.of_string (Common.CudfAdd.decode pkg.Cudf.package);
version = V.of_string real_version; }
-
+
let to_string t =
Printf.sprintf "%s%c%s" (N.to_string t.name) sep (V.to_string t.version)
module O = struct
type tmp = t
type t = tmp
- let compare nv1 nv2 =
+ let compare nv1 nv2 =
match N.compare nv1.name nv2.name with
| 0 -> V.compare nv1.version nv2.version
| i -> i
@@ -894,7 +894,7 @@ let pin_option_of_string s =
Path (Dirname.of_string s)
else
Version (V.of_string s)
-
+
type pin = {
pin_package: name;
pin_arg: pin_option;
View
16 src/types.mli
@@ -37,11 +37,11 @@ module type SET = sig
(** Find an element in the list *)
val find: (elt -> bool) -> t -> elt
-end
+end
(** Dictionaries of abstract values *)
module type MAP = sig
-
+
include Map.S
(** Pretty-printing *)
@@ -52,7 +52,7 @@ module type MAP = sig
(** Same as [merge] but only keys that appear in both maps
are given in the merging function *)
- (** WARNING : Besides [key], the function could receive
+ (** WARNING : Besides [key], the function could receive
some [v1] and some [v2] such that [v1 = v2] holds. *)
val merge_max: (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
@@ -374,10 +374,10 @@ module Repository: sig
(** Default repository *)
val default: t
-
+
(** Get the repository name *)
val name: t -> string
-
+
(** Get the repository kind *)
val kind: t -> string
@@ -409,7 +409,7 @@ end
type variable = Variable.t
(** Section names *)
-module Section: sig
+module Section: sig
include ABSTRACT
@@ -449,7 +449,7 @@ type full_section = Full_section.t
module Full_variable: sig
include ABSTRACT
-
+
(** Create a variable local for a given library/syntax extension *)
val create_local: name -> section -> variable -> t
@@ -561,7 +561,7 @@ module Remote_file: sig
(** Get remote filename *)
val base: t -> basename
-
+
(** MD5 digest or the remote file *)
val md5: t -> string
View
6 src/utils.ml
@@ -27,7 +27,7 @@ module OInt = struct
let compare = compare
end
-module IntMap = Map.Make(OInt)
+module IntMap = Map.Make(OInt)
module IntSet = Set.Make(OInt)
module OString = struct
@@ -37,14 +37,14 @@ end
module StringMap = Map.Make(OString)
-let (|>) f g x = g (f x)
+let (|>) f g x = g (f x)
let string_strip str =
let p = ref 0 in
let l = String.length str in
let fn = function
| ' ' | '\t' | '\r' | '\n' -> true
- | _ -> false in
+ | _ -> false in
while !p < l && fn (String.unsafe_get str !p) do
incr p;
done;

0 comments on commit c58504d

Please sign in to comment.