Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src-opam/dockerfile_opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ let cygwin_opam2 ?(labels=[]) ?arch ~hash_opam_2_0 ~hash_opam_2_1 distro () =
let windows_opam2 ?winget ?(labels=[]) ?arch distro () =
let version = match distro with `Windows (_, v) -> v | _ -> assert false in
(match winget with
| None -> Windows.Winget.install_from_release ~version ()
| Some _ -> empty)
| None when Windows.Winget.is_supported version -> Windows.Winget.install_from_release ~version ()
| _ -> empty)
@@ header ?arch distro @@ label (("distro_style", "windows") :: labels)
@@ user "ContainerAdministrator"
@@ begin
Expand All @@ -270,8 +270,10 @@ let windows_opam2 ?winget ?(labels=[]) ?arch distro () =
Windows.install_vc_redist () @@ t
@@ Windows.Cygwin.setup ~extra () @@ t'
end
@@ Windows.Winget.setup ?from:winget ()
@@ Windows.Winget.dev_packages ~version ()
@@ begin if Windows.Winget.is_supported version then
Windows.Winget.setup ?from:winget ()
@@ Windows.Winget.dev_packages ~version ()
else empty end
@@ Windows.Cygwin.Git.init ()
@@ Windows.cleanup ()

Expand Down
9 changes: 6 additions & 3 deletions src-opam/dockerfile_windows.ml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ module Cygwin = struct
end

module Winget = struct
let is_supported version =
not (List.mem version [`V1507; `Ltsc2015; `V1511; `V1607; `Ltsc2016; `V1703; `V1709; `V1803])

let winget = "winget-builder"

let header ?(version=Dockerfile_distro.win10_latest_image) () =
Expand Down Expand Up @@ -189,14 +192,14 @@ module Winget = struct
let src =
let src = "https://github.com/microsoft/winget-cli/releases/" in
match winget_version with
| None -> src ^ "latest/download/" ^ file ^ "appxbundle"
| Some ver -> src ^ "download/" ^ ver ^ "/" ^ file ^ "appxbundle"
| None -> src ^ "latest/download/" ^ file ^ "msixbundle"
| Some ver -> src ^ "download/" ^ ver ^ "/" ^ file ^ "msixbundle"
in
let dst = {|C:\TEMP\|} ^ file ^ "zip" in
header ?version ()
@@ add ~src:[src] ~dst ()
@@ run_powershell {|Expand-Archive -LiteralPath %s -DestinationPath C:\TEMP\winget-cli -Force|} dst
@@ run {|ren C:\TEMP\winget-cli\AppInstaller_x64.appx AppInstaller_x64.zip|}
@@ run {|ren C:\TEMP\winget-cli\AppInstaller_x64.msix AppInstaller_x64.zip|}
@@ run_powershell {|Expand-Archive -LiteralPath C:\TEMP\winget-cli\AppInstaller_x64.zip -DestinationPath C:\TEMP\winget-cli\ -Force|}
@@ footer ""

Expand Down
5 changes: 5 additions & 0 deletions src-opam/dockerfile_windows.mli
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ end
(** Rules for winget installation.
@see <https://docs.microsoft.com/en-us/windows/package-manager/winget>/ *)
module Winget : sig
val is_supported : Dockerfile_distro.win10_release -> bool
(** Winget 1.0.11692 discontinued support for versions older than
Windows 10 1809. Older versions of Winget have bugs, don't use
them. *)

val build_from_source :
?arch:Ocaml_version.arch -> ?version:Dockerfile_distro.win10_release ->
?winget_version:string -> ?vs_version:string -> unit -> t
Expand Down