summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/opam-repository/download-tool.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/opam-repository/download-tool.patch')
-rw-r--r--pkgs/development/ocaml-modules/opam-repository/download-tool.patch20
1 files changed, 14 insertions, 6 deletions
diff --git a/pkgs/development/ocaml-modules/opam-repository/download-tool.patch b/pkgs/development/ocaml-modules/opam-repository/download-tool.patch
index 5af720adca9..9cc5f43f34f 100644
--- a/pkgs/development/ocaml-modules/opam-repository/download-tool.patch
+++ b/pkgs/development/ocaml-modules/opam-repository/download-tool.patch
@@ -2,16 +2,20 @@ diff --git a/src/repository/opamRepositoryConfig.ml b/src/repository/opamReposit
 index c2954c1d..528fc621 100644
 --- a/src/repository/opamRepositoryConfig.ml
 +++ b/src/repository/opamRepositoryConfig.ml
-@@ -27,23 +27,7 @@ type 'a options_fun =
+@@ -27,31 +27,7 @@ type 'a options_fun =
    'a
  
  let default = {
 -  download_tool = lazy (
+-    let os = OpamStd.Sys.os () in
 -    try
+-      let curl = "curl", `Curl in
 -      let tools =
--        if OpamStd.Sys.(os () = Darwin)
--        then ["wget", `Default; "curl", `Curl]
--        else ["curl", `Curl; "wget", `Default]
+-        match os with
+-        | Darwin  -> ["wget", `Default; curl]
+-        | FreeBSD -> ["fetch", `Default ; curl]
+-        | OpenBSD -> ["ftp", `Default; curl]
+-        | _ -> [curl; "wget", `Default]
 -      in
 -      let cmd, kind =
 -        List.find (fun (c,_) -> OpamSystem.resolve_command c <> None) tools
@@ -20,8 +24,12 @@ index c2954c1d..528fc621 100644
 -    with Not_found ->
 -      OpamConsole.error_and_exit `Configuration_error
 -        "Could not find a suitable download command. Please make sure you \
--         have either \"curl\" or \"wget\" installed, or specify a custom \
--         command through variable OPAMFETCH."
+-         have %s installed, or specify a custom command through variable \
+-         OPAMFETCH."
+-        (match os with
+-         | FreeBSD -> "fetch"
+-         | OpenBSD -> "ftp"
+-         | _ -> "either \"curl\" or \"wget\"")
 -  );
 +  download_tool = lazy ([ CIdent SUBSTITUTE_NIXOS_CURL_PATH, None ], `Curl);
    validation_hook = None;