Skip to content

Commit

Permalink
Merge pull request #6305 from kit-ty-kate/fetch-curl-bsd
Browse files Browse the repository at this point in the history
Prefer curl over any other download tools on every systems, if available
  • Loading branch information
rjbou authored Nov 22, 2024
2 parents 88318b9 + 494d2fd commit 1a347b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ users)

## Internal
* Make `curl` the default download tool instead of `wget` on macOS [#6304 @kit-ty-kate]
* download tool: Use fetch on DragonFlyBSD and ftp on NetBSD [#6305 @kit-ty-kate]
* Prefer curl over any other download tools on every systems, if available [#6305 @kit-ty-kate]

## Internal: Windows

Expand Down
11 changes: 6 additions & 5 deletions src/client/opamInitDefaults.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ let openbsd_filter = os_filter "openbsd"
let freebsd_filter = os_filter "freebsd"
let netbsd_filter = os_filter "netbsd"
let dragonflybsd_filter = os_filter "dragonfly"
let not_open_free_bsd_filter =
FNot (FOr (openbsd_filter, freebsd_filter))
let not_bsd_filter =
FNot (FOr (FOr (openbsd_filter, netbsd_filter),
FOr (freebsd_filter, dragonflybsd_filter)))
let win32_filter = os_filter "win32"
let not_win32_filter =
FOp (FIdent ([], OpamVariable.of_string "os", None), `Neq, FString "win32")
Expand Down Expand Up @@ -99,9 +100,9 @@ let req_dl_tools () =
(* Keep synchronised with [OpamRepositoryConfig.default] *)
let default =
[
["curl"; "wget"], msg, Some not_open_free_bsd_filter;
["fetch"], msg, Some freebsd_filter;
["ftp"], msg, Some openbsd_filter
(* BSDs have download tools (fetch or ftp) that are part of the
base system so there is no need to check for those tools. *)
["curl"; "wget"], msg, Some not_bsd_filter;
]
in
let open OpamStd.Option.Op in
Expand Down
7 changes: 4 additions & 3 deletions src/repository/opamRepositoryConfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ let default = {
let curl = "curl", `Curl in
let tools =
match os with
| FreeBSD -> ["fetch", `Default; curl]
| OpenBSD -> ["ftp", `Default; curl]
| _ -> [curl; "wget", `Default]
| FreeBSD | DragonFly -> [curl; "fetch", `Default]
| OpenBSD | NetBSD -> [curl; "ftp", `Default]
| Linux | Darwin | Cygwin | Win32
| Unix | Other _ -> [curl; "wget", `Default]
in
let cmd, kind =
List.find (fun (c,_) -> OpamSystem.resolve_command c <> None) tools
Expand Down

0 comments on commit 1a347b4

Please sign in to comment.