Skip to content

Commit 25da224

Browse files
committed
Rename Windows.Cygwin.install_from_release to install_cygwin
Light internal refactoring.
1 parent 8fb8a88 commit 25da224

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src-opam/opam.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ let windows_opam2 ?win10_revision ?winget ?(labels = []) ?arch ~opam_hashes
433433
Windows.header ~alias:"opam-builder" ?win10_revision ~version ()
434434
@@ Windows.sanitize_reg_path ()
435435
@@ Windows.Cygwin.(
436-
install_from_release
436+
install_cygwin
437437
~extra:
438438
("git" :: "patch" :: "mingw64-x86_64-gcc-g++"
439439
:: "mingw64-i686-gcc-g++" :: mingw_packages)
@@ -456,7 +456,7 @@ let windows_opam2 ?win10_revision ?winget ?(labels = []) ?arch ~opam_hashes
456456
| _ -> invalid_arg "Invalid distribution"
457457
in
458458
let extra, pkgs = Windows.Cygwin.ocaml_for_windows_packages ~extra () in
459-
Windows.Cygwin.install_from_release ~msvs_tools:true ~extra ()
459+
Windows.Cygwin.install_cygwin ~msvs_tools:true ~extra ()
460460
@@ vs_build_tools @@ pkgs
461461
in
462462
winget_image @@ opams_image

src-opam/windows.ml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -216,26 +216,25 @@ module Cygwin = struct
216216
env [ ("CYGWIN", "nodosfilewarning winsymlinks:native") ]
217217
@@ prepend_path (List.map (( ^ ) cyg.root) [ {|\bin|} ])
218218

219-
let install_from_release ?(cyg = default) ?(msvs_tools = false) ?(extra = [])
220-
() =
219+
let install_cygwin ?(cyg = default) ?(msvs_tools = false) ?(extra = []) () =
221220
setup_env ~cyg
222221
@@ add
223222
~src:[ "https://www.cygwin.com/setup-x86_64.exe" ]
224223
~dst:(cyg.root ^ {|\setup-x86_64.exe|})
225224
()
226225
@@ install_cygsympathy_from_source cyg
227-
@@ install ~cyg extra
226+
@@ (if extra <> [] then install ~cyg extra else empty)
228227
@@ (if msvs_tools then install_msvs_tools_from_source cyg else empty)
229228
@@ run
230229
{|awk -i inplace "/(^#)|(^$)/{print;next}{$4=""noacl,""$4; print}" %s\etc\fstab|}
231230
cyg.root
232231

233232
let setup ?(cyg = default) ?from () =
234-
(match from with
235-
| Some from ->
233+
maybe
234+
(fun from ->
236235
copy ~from ~src:[ default.root ] ~dst:default.root () @@ setup_env ~cyg
237-
|> cleanup
238-
| None -> empty)
236+
|> cleanup)
237+
from
239238
@@ workdir {|%s\home\opam|} cyg.root
240239

241240
let cygwin_packages ?(flexdll_version = "0.39-1") () =
@@ -322,12 +321,12 @@ module Winget = struct
322321
323322
let setup ?from () =
324323
let escape s = String.(concat {|""""|} (split_on_char '"' s)) in
325-
(match from with
326-
| Some from ->
324+
maybe
325+
(fun from ->
327326
copy ~from
328327
~src:[ {|C:\Program Files\winget-cli|} ]
329-
~dst:{|C:\Program Files\winget-cli|} ()
330-
| None -> empty)
328+
~dst:{|C:\Program Files\winget-cli|} ())
329+
from
331330
@@ prepend_path [ {|C:\Program Files\winget-cli|} ]
332331
@@ run_powershell ~escape
333332
{|$path=(Join-Path $env:LOCALAPPDATA 'Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState'); New-Item $path -ItemType Directory -Force; '{ "$schema": "https://aka.ms/winget-settings.schema.json", "telemetry": { "disable": "true" } }' | Out-File -encoding ASCII (Join-Path $path 'settings.json')|}

src-opam/windows.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ module Cygwin : sig
9292
val default : cyg
9393
(** The default Cygwin root, mirror, and arguments. *)
9494

95-
val install_from_release :
95+
val install_cygwin :
9696
?cyg:cyg -> ?msvs_tools:bool -> ?extra:string list -> unit -> Dockerfile.t
9797
(** Install Cygwin with CygSymPathy and optionally msvs-tools,
9898
and [extra] Cygwin packages (first in a separate Docker image).
@@ -101,7 +101,7 @@ module Cygwin : sig
101101
@see <https://github.com/metastack/msvs-tools> *)
102102

103103
val setup : ?cyg:cyg -> ?from:string -> unit -> t
104-
(** Setup winget, optionally copied from the [from] Docker image. *)
104+
(** Setup Cygwin workdir, optionally copied from the [from] Docker image. *)
105105

106106
val install : ?cyg:cyg -> string list -> Dockerfile.t
107107
(** Install the supplied Cygwin package list. The packages should be
@@ -168,8 +168,8 @@ module Winget : sig
168168
image). The optional [winget_version] specifies a Git tag. *)
169169

170170
val setup : ?from:string -> unit -> t
171-
(** Setup winget, optionally copied from the [from] Docker
172-
image. Disable winget telemetry. *)
171+
(** Setup winget, optionally copied from the [from] Docker image. Disable
172+
winget telemetry. *)
173173

174174
val install : string list -> t
175175
(** [install packages] will install the supplied winget package list. *)

0 commit comments

Comments
 (0)