Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/OCamlPro/opam into doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Bernardoff committed Sep 14, 2012
2 parents 2595269 + b6bacea commit d47bb90
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 30 deletions.
3 changes: 2 additions & 1 deletion src/client.ml
Expand Up @@ -955,6 +955,7 @@ let proceed_toinstall t nv =
(* bin *)
List.iter (fun (src, dst) ->
let dst = Path.C.bin t.compiler // (Basename.to_string dst) in
(* WARNING [dst] could be a symbolic link (in this case, it will be removed). *)
Filename.copy src dst
) (File.Dot_install.bin install);

Expand Down Expand Up @@ -1152,7 +1153,7 @@ let print_env_warning () =
(* In case of error, simply return the error traces, and let the
repo in a state that the user can explore.
Do not try to recover yet. *)
let rec proceed_tochange t nv_old nv =
let proceed_tochange t nv_old nv =
Globals.msg "\n=-=-= %s =-=-=\n" (NV.to_string nv);

(* First, uninstall any previous version *)
Expand Down
2 changes: 1 addition & 1 deletion src/file_format.ml
Expand Up @@ -356,7 +356,7 @@ let make_cnf_formula l =
match orl with
| [] -> cnf
| [c] -> c :: cnf
| _ -> (Group orl) :: cnf
| _ -> (Group (List.rev orl)) :: cnf
) [] l in
List (List.rev cnf)

Expand Down
2 changes: 1 addition & 1 deletion src/lexer.mll
Expand Up @@ -24,7 +24,7 @@ let alpha = ['a'-'z' 'A'-'Z' '_']
let digit = ['0'-'9']
let char = ['-']
let ident = alpha (alpha | digit | char)*
let symbol = ['=' '<' '>' '!' '+' ]+
let symbol = ['=' '<' '>' '!' '+' '|']+
let number = '-'? ('.'['0'-'9']+ | ['0'-'9']+('.'['0'-'9']*)? )

rule token = parse
Expand Down
1 change: 1 addition & 0 deletions src/repo/curl.ml
Expand Up @@ -75,6 +75,7 @@ module B = struct
let state = make_state ~download_index:true address in
(* Download index.tar.gz *)
try
Filename.remove state.remote_index_archive;
let file = Filename.download state.remote_index_archive state.local_path in
Filename.extract_in file state.local_path
with _ ->
Expand Down
20 changes: 13 additions & 7 deletions src/run.ml
Expand Up @@ -65,6 +65,15 @@ let mkdir dir =
end in
aux dir

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;
Expand All @@ -74,8 +83,10 @@ let copy src dst =
let ic = open_in_bin src in
let oc =
if Sys.file_exists dst then
open_out_bin dst
else
(* 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;
let perm = (Unix.stat src).Unix.st_perm in
mkdir (Filename.dirname dst);
open_out_gen [Open_wronly; Open_creat; Open_trunc; Open_binary] perm dst
Expand Down Expand Up @@ -154,11 +165,6 @@ let rec_files dir =
List.fold_left aux (f @ accu) d in
aux [] dir

let remove_file file =
log "remove_file %s" file;
try Unix.unlink file
with Unix.Unix_error _ -> ()

let rec remove_dir dir = (** WARNING it fails if [dir] is not a [S_DIR] or simlinks to a directory *)
if Sys.file_exists dir then begin
List.iter remove_file (files_all_not_dir dir);
Expand Down
4 changes: 2 additions & 2 deletions src/run.mli
Expand Up @@ -32,10 +32,10 @@ val internal_error: ('a, unit, string, 'b) format4 -> 'a
(** [with_tmp_dir fn] executes [fn] in a tempory directory *)
val with_tmp_dir: (string -> 'a) -> 'a

(** [copy src dst] copies [src] to [dst] *)
(** [copy src dst] copies [src] to [dst]. Remove [dst] before the copy if it is a link. *)
val copy: string -> string -> unit

(** [link src dst] links [src] to [dst] *)
(** [link src dst] links [src] to [dst]. Remove [dst] if it is a file, not a directory. *)
val link: string -> string -> unit

(** [real_path p] returns the real path associated to [p]: [..] are
Expand Down
11 changes: 5 additions & 6 deletions src_ext/Makefile
Expand Up @@ -10,8 +10,8 @@ clone: cudf.stamp extlib.stamp ocaml-re.stamp ocamlgraph.stamp dose.stamp ocaml-
cudf.tar.gz:
$(FETCH) http://www.ocamlpro.com/pub/cudf.tar.gz

extlib-1.5.2.tar.gz:
$(FETCH) http://ocaml-extlib.googlecode.com/files/extlib-1.5.2.tar.gz
extlib-1.5.3.tar.gz:
$(FETCH) http://ocaml-extlib.googlecode.com/files/extlib-1.5.3.tar.gz
@touch $@

cudf.stamp: cudf.tar.gz
Expand All @@ -30,10 +30,9 @@ ocamlgraph-1.8.1.tar.gz:
ocaml-re.1.1.tar.gz:
$(FETCH) http://www.ocamlpro.com/pub/ocaml-re.1.1.tar.gz

extlib.stamp: extlib-1.5.2.tar.gz
tar xfz extlib-1.5.2.tar.gz
mv extlib-1.5.2 extlib
cd extlib && patch -i ../extlib.patch -p1
extlib.stamp: extlib-1.5.3.tar.gz
tar xfz extlib-1.5.3.tar.gz
mv extlib-1.5.3 extlib
@touch $@

dose.stamp: dose.tar.gz
Expand Down
1 change: 1 addition & 0 deletions src_ext/depends.ocp.boot
Expand Up @@ -18,6 +18,7 @@ begin library "extlib"
"extlib/IO.ml"
"extlib/global.ml"
"extlib/extString.ml"
"extlib/extHashtbl.ml"
"extlib/extList.ml"
"extlib/extLib.ml"
"extlib/extArray.ml"
Expand Down
12 changes: 0 additions & 12 deletions src_ext/extlib.patch

This file was deleted.

0 comments on commit d47bb90

Please sign in to comment.