Permalink
Browse files

Merge branch 'master' of git://github.com/OCamlPro/opam

  • Loading branch information...
2 parents 863f15f + a4a52f8 commit effe4aaeea9e17b73dd0af2be2260ee7645beec8 @avsm avsm committed Oct 13, 2012
Showing with 348 additions and 282 deletions.
  1. +1 −1 shell/opam_completion.sh
  2. +1 −1 shell/opam_completion_zsh.sh
  3. +314 −255 src/opamClient.ml
  4. +10 −12 src/opamFile.ml
  5. +1 −1 src/opamFile.mli
  6. +2 −2 src/opamLexer.mll
  7. +2 −2 src/opamMain.ml
  8. +2 −2 src/opamPath.ml
  9. +5 −2 src/opamRepository.ml
  10. +6 −3 src/opamTypes.ml
  11. +4 −1 src/opamTypes.mli
View
@@ -13,7 +13,7 @@ _opam_global_options()
_opam_commands()
{
local res
- res="$( opam --help 2>/dev/null | grep '^ ' | sed 's/ *//;s/ .*//' | grep -v '^-' )"
+ res="$( opam --help 2>/dev/null | grep '^ [^ ]' | sed 's/ *//;s/ .*//' | grep -v '^-' )"
_opam_add "$res"
}
@@ -13,7 +13,7 @@ _opam_global_options()
_opam_commands()
{
local res
- res="$( opam --help 2>/dev/null | grep '^ ' | sed 's/ *//;s/ .*//' | grep -v '^-' )"
+ res="$( opam --help 2>/dev/null | grep '^ [^ ]' | sed 's/ *//;s/ .*//' | grep -v '^-' )"
_opam_add "$res"
}
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -396,26 +396,24 @@ module Aliases = struct
let internal = "aliases"
- type t = (alias * compiler) list
+ type t = compiler alias_map
- let empty = []
+ let empty = OpamAlias.Map.empty
let to_string filename t =
let l =
- List.map
- (fun (alias,oversion) -> [OpamAlias.to_string alias;
- OpamCompiler.to_string oversion])
- t in
+ OpamAlias.Map.fold (fun alias compiler lines ->
+ [OpamAlias.to_string alias; OpamCompiler.to_string compiler] :: lines
+ ) t [] in
Lines.to_string filename l
let of_string filename s =
let l = Lines.of_string filename s in
- List.fold_left (fun accu -> function
- | [] -> accu
- | [alias; oversion] -> (OpamAlias.of_string alias,
- OpamCompiler.of_string oversion) :: accu
- | _ -> failwith "switches"
- ) [] l
+ List.fold_left (fun map -> function
+ | [] -> map
+ | [alias; comp] -> OpamAlias.Map.add (OpamAlias.of_string alias) (OpamCompiler.of_string comp) map
+ | _ -> failwith "switches"
+ ) OpamAlias.Map.empty l
end
View
@@ -176,7 +176,7 @@ module Descr: sig
end
(** Compiler aliases: [$opam/aliases] *)
-module Aliases: IO_FILE with type t = (alias * compiler) list
+module Aliases: IO_FILE with type t = compiler alias_map
(** List of installed packages: [$opam/$oversion/installed] *)
module Installed: IO_FILE with type t = package_set
View
@@ -25,7 +25,7 @@ let digit = ['0'-'9']
let char = ['-']
let ident = alpha (alpha | digit | char)*
let symbol = ['=' '<' '>' '!' '+' '|' '&']+
-let number = '-'? ('.'['0'-'9']+ | ['0'-'9']+('.'['0'-'9']*)? )
+let int = '-'? ['0'-'9']+
rule token = parse
| space { token lexbuf }
@@ -42,7 +42,7 @@ rule token = parse
| "(*" { comment 1 lexbuf; token lexbuf }
| "true" { BOOL true }
| "false"{ BOOL false }
-| digit+ { INT (int_of_string (Lexing.lexeme lexbuf)) }
+| int { INT (int_of_string (Lexing.lexeme lexbuf)) }
| ident { IDENT (Lexing.lexeme lexbuf) }
| symbol { SYMBOL (Lexing.lexeme lexbuf) }
| eof { EOF }
View
@@ -357,9 +357,9 @@ let remote =
OpamClient.remote (RPriority (OpamRepositoryName.of_string name, int_of_string p))
| Some `list, [] -> OpamClient.remote RList
| Some `rm, [ name ] -> OpamClient.remote (RRm (OpamRepositoryName.of_string name))
- | Some `add , [ name; address ] -> add name address 0
+ | Some `add , [ name; address ] -> add name address None
| Some `add ,
- [ name; address; priority ] -> add name address (int_of_string priority)
+ [ name; address; priority ] -> add name address (Some (int_of_string priority))
| None, _ -> bad_argument "remote" "Command missing [-list|-add|-rm]"
| _ -> bad_argument "remote" "Wrong arguments")
}
View
@@ -62,8 +62,8 @@ module Alias = struct
let doc_dir t a = root t a / "doc"
- let man_dir ?num t a =
- match num with
+ let man_dir ?num t a =
+ match num with
| None -> root t a / "man"
| Some n -> root t a / "man" / ("man" ^ n)
View
@@ -203,8 +203,11 @@ let copy_files local_repo nv =
"Skipping %s as it already exists in %s"
(OpamFilename.to_string f)
(OpamFilename.Dir.to_string local_dir)
- else
- OpamFilename.copy_in f local_dir) files;
+ else (
+ OpamGlobals.msg "Copying %s\n" (OpamFilename.Base.to_string (OpamFilename.basename f));
+ OpamFilename.copy_in f local_dir
+ )
+ ) files;
);
OpamFilename.Set.of_list files
View
@@ -75,6 +75,8 @@ type alias = OpamAlias.t
type alias_set = OpamAlias.Set.t
+type 'a alias_map = 'a OpamAlias.Map.t
+
type file_attribute = OpamFilename.Attribute.t
type file_attribute_set = OpamFilename.Attribute.Set.t
@@ -122,17 +124,18 @@ let string_of_upload u =
(* Remote arguments *)
type remote =
| RList
- | RAdd of repository_name * string * dirname * int
+ | RAdd of repository_name * string * dirname * int option
| RRm of repository_name
| RPriority of repository_name * int
let string_of_remote = function
| RList -> "list"
| RAdd (r, k, d, p) ->
- Printf.sprintf "add %s %s %s %d"
+ Printf.sprintf "add %s %s %s %s"
(OpamRepositoryName.to_string r)
(OpamFilename.Dir.to_string d)
- k p
+ k
+ (match p with None -> "-" | Some p -> string_of_int p)
| RRm r ->
Printf.sprintf "rm %s"
(OpamRepositoryName.to_string r)
View
@@ -193,7 +193,7 @@ val string_of_upload: upload -> string
(** Remote arguments *)
type remote =
| RList
- | RAdd of repository_name * string * dirname * int
+ | RAdd of repository_name * string * dirname * int option
| RRm of repository_name
| RPriority of repository_name * int
@@ -299,6 +299,9 @@ type alias = OpamAlias.t
(** Set of compiler aliases *)
type alias_set = OpamAlias.Set.t
+(** Map of compile aliases *)
+type 'a alias_map = 'a OpamAlias.Map.t
+
(** {2 Misc} *)
(** A line in {i urls.tx} *)

0 comments on commit effe4aa

Please sign in to comment.