Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[change] Updating OPAM modules to integrate the darcs backend

  • Loading branch information...
commit 7493ba7135bdffcd789da826aa7dac1264f98707 1 parent db84faa
venator authored
14 src/client/opamMain.ml
View
@@ -173,6 +173,7 @@ let repo_kind_flag =
"http" , `http;
"local", `local;
"git" , `git;
+ "darcs" , `darcs;
(* aliases *)
"wget" , `http;
@@ -181,7 +182,7 @@ let repo_kind_flag =
] in
mk_opt ["k";"kind"]
"KIND" "Specify the kind of the repository to be set (the main ones \
- are 'http', 'local' or 'git')."
+ are 'http', 'local', 'git' or 'darcs')."
Arg.(some (enum kinds)) None
let pattern_list =
@@ -663,7 +664,7 @@ let pin =
let pin_option =
let doc =
Arg.info ~docv:"PIN" ~doc:
- "Specific version, local path or git url to pin the package to,
+ "Specific version, local path, git or darcs url to pin the package to,
or 'none' to unpin the package." [] in
Arg.(value & pos 0 (some string) None & doc) in
let list = mk_flag ["l";"list"] "List the currently pinned packages." in
@@ -671,6 +672,7 @@ let pin =
let doc = Arg.info ~docv:"KIND" ~doc:"Force the kind of pinning." ["k";"kind"] in
let kinds = [
"git" , `git;
+ "darcs" , `darcs;
"version", `version;
"local" , `local;
"rsync" , `local;
@@ -725,10 +727,10 @@ let default =
`P "OPAM is a package manager for OCaml. It uses the powerful mancoosi
tools to handle dependencies, including support for version
constraints, optional dependencies, and conflicts management.";
- `P "It has support for different repository backends such as HTTP, rsync and
- git. It handles multiple OCaml versions concurrently, and is flexible
- enough to allow you to use your own repositories and packages in
- addition of the ones it provides.";
+ `P "It has support for different repository backends such as HTTP, rsync, git
+ and darcs. It handles multiple OCaml versions concurrently, and is
+ flexible enough to allow you to use your own repositories and packages
+ in addition of the ones it provides.";
] @ help_sections
in
Term.(ret (pure (fun _ -> `Help (`Pager, None)) $ global_options)),
6 src/client/opamState.ml
View
@@ -23,6 +23,7 @@ let log fmt =
let () =
OpamHTTP.register ();
OpamGit.register ();
+ OpamDarcs.register();
OpamLocal.register ()
let confirm fmt =
@@ -773,6 +774,11 @@ let update_pinned_package t nv pin =
let module B = (val OpamRepository.find_backend `git: OpamRepository.BACKEND) in
let build = OpamPath.Switch.build t.root t.switch nv in
B.download_dir nv ~dst:build path
+ | `darcs ->
+ let path = OpamFilename.raw_dir (path_of_pin_option pin) in
+ let module B = (val OpamRepository.find_backend `darcs: OpamRepository.BACKEND) in
+ let build = OpamPath.Switch.build t.root t.switch nv in
+ B.download_dir nv ~dst:build path
| _ ->
OpamGlobals.error_and_exit
"Cannot update the pinned package %s: wrong backend."
1  src/core/opamFile.ml
View
@@ -172,6 +172,7 @@ module URL = struct
let to_string filename t =
let url_name = match t.kind with
| Some `git -> "git"
+ | Some `darcs -> "darcs"
| None
| Some `http -> "archive"
| Some `local -> OpamGlobals.error_and_exit "Local packages are not (yet) supported." in
2  src/core/opamFile.mli
View
@@ -368,7 +368,7 @@ module URL: sig
(** URL address *)
val url: t -> string
- (** Backend kind (could be curl/rsync/git at the moment) *)
+ (** Backend kind (could be curl/rsync/git/darcs at the moment) *)
val kind: t -> repository_kind option
(** Archive checksum *)
16 src/core/opamTypes.ml
View
@@ -54,7 +54,7 @@ type repository_name = OpamRepositoryName.t
type 'a repository_name_map = 'a OpamRepositoryName.Map.t
-type repository_kind = [`http|`local|`git]
+type repository_kind = [`http|`local|`git|`darcs]
type repository = {
repo_name : repository_name;
@@ -67,6 +67,7 @@ let string_of_repository_kind = function
| `http -> "http"
| `local -> "local"
| `git -> "git"
+ | `darcs -> "darcs"
let repository_kind_of_string = function
| "wget"
@@ -75,6 +76,7 @@ let repository_kind_of_string = function
| "rsync"
| "local" -> `local
| "git" -> `git
+ | "darcs" -> `darcs
| s -> OpamGlobals.error_and_exit "%s is not a valid repository kind." s
type variable = OpamVariable.t
@@ -172,6 +174,7 @@ type pin_option =
| Version of version
| Path of dirname
| Git of dirname
+ | Darcs of dirname
| Unpin
let pin_option_of_string ?kind s =
@@ -182,6 +185,11 @@ let pin_option_of_string ?kind s =
Git (OpamFilename.Dir.of_string s)
else
Git (OpamFilename.raw_dir s)
+ | Some `darcs ->
+ if Sys.file_exists s then
+ Darcs (OpamFilename.Dir.of_string s)
+ else
+ Darcs (OpamFilename.raw_dir s)
| Some `local -> Path (OpamFilename.Dir.of_string s)
| Some `unpin -> Unpin
| None ->
@@ -194,17 +202,19 @@ let pin_option_of_string ?kind s =
else
Version (OpamPackage.Version.of_string s)
-type pin_kind = [`version|`git|`local|`unpin]
+type pin_kind = [`version|`git|`darcs|`local|`unpin]
let string_of_pin_kind = function
| `version -> "version"
| `git -> "git"
+ | `darcs -> "darcs"
| `local -> "local"
| `unpin -> "unpin"
let pin_kind_of_string = function
| "version" -> `version
| "git" -> `git
+ | "darcs" -> `darcs
| "local" -> `local
| "unpin" -> `unpin
| s -> OpamGlobals.error_and_exit "%s is not a valid kind of pinning." s
@@ -217,12 +227,14 @@ type pin = {
let path_of_pin_option = function
| Version v -> OpamPackage.Version.to_string v
| Git p
+ | Darcs p
| Path p -> OpamFilename.Dir.to_string p
| Unpin -> "none"
let kind_of_pin_option = function
| Version _ -> `version
| Git _ -> `git
+ | Darcs _ -> `darcs
| Path _ -> `local
| Unpin -> `unpin
9 src/core/opamTypes.mli
View
@@ -142,13 +142,13 @@ type repository_name = OpamRepositoryName.t
type 'a repository_name_map = 'a OpamRepositoryName.Map.t
(** Repository kind *)
-type repository_kind = [`http|`local|`git]
+type repository_kind = [`http|`local|`git|`darcs]
(** Pretty-print repository kinds. *)
-val string_of_repository_kind: [`http|`local|`git] -> string
+val string_of_repository_kind: [`http|`local|`git|`darcs] -> string
(** Parser of repository kinds. Raise an error if the kind is not valid. *)
-val repository_kind_of_string: string -> [`http|`local|`git]
+val repository_kind_of_string: string -> [`http|`local|`git|`darcs]
(** Repositories *)
type repository = {
@@ -289,6 +289,7 @@ type pin_option =
| Version of version
| Path of dirname
| Git of dirname
+ | Darcs of dirname
| Unpin
(** Pinned packages *)
@@ -301,7 +302,7 @@ type pin = {
val string_of_pin: pin -> string
(** Pin kind *)
-type pin_kind = [`version|`git|`local|`unpin]
+type pin_kind = [`version|`git|`darcs|`local|`unpin]
(** Pretty-printing of pin kinds. *)
val pin_kind_of_string: string -> pin_kind
2  src/repositories/opamLocal.ml
View
@@ -25,7 +25,7 @@ let rsync ?(delete=true) src dst =
OpamSystem.mkdir dst;
let delete = if delete then ["--delete"] else [] in
try
- let lines = OpamSystem.read_command_output (["rsync" ; "-arv"; "--exclude"; ".git/*"; src; dst] @ delete) in
+ let lines = OpamSystem.read_command_output (["rsync" ; "-arv"; "--exclude"; ".git/*"; "--exclude"; "_darcs/*"; src; dst] @ delete) in
match OpamMisc.rsync_trim lines with
| [] -> Up_to_date []
| lines -> Result lines
1  src/repositories/repositories.ocp
View
@@ -6,6 +6,7 @@ begin library "opam-repositories"
"opamHTTP.ml"
"opamLocal.ml"
"opamGit.ml"
+ "opamDarcs.ml"
]
requires = [
1  src/scripts/opam_mk_repo.ml
View
@@ -19,6 +19,7 @@ open OpamFilename.OP
let () =
OpamHTTP.register ();
OpamGit.register ();
+ OpamDarcs.register ();
OpamLocal.register ()
let log fmt = OpamGlobals.log "OPAM-MK-REPO" fmt
Please sign in to comment.
Something went wrong with that request. Please try again.