From a734171cf78fcb6da74b8e8e2d56037b0568371c Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 30 Jan 2022 16:56:21 +0000 Subject: [PATCH] Remove opam-repository from the dockerfiles created by dockerfile-opam --- src-opam/dockerfile_opam.ml | 16 ++++++---------- src-opam/dockerfile_opam.mli | 3 --- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src-opam/dockerfile_opam.ml b/src-opam/dockerfile_opam.ml index be1dee90..15710675 100644 --- a/src-opam/dockerfile_opam.ml +++ b/src-opam/dockerfile_opam.ml @@ -324,7 +324,7 @@ let windows_opam2 ?win10_revision ?winget ?(labels=[]) ?arch distro () = @@ Windows.Cygwin.Git.init () @@ Windows.cleanup () -let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo=true) ?arch ?labels ~opam_hashes d = +let gen_opam2_distro ?win10_revision ?winget ?arch ?labels ~opam_hashes d = let fn = match D.package_manager d with | `Apk -> apk_opam2 ?labels ?arch ~opam_hashes d () | `Apt -> apt_opam2 ?labels ?arch ~opam_hashes d () @@ -337,13 +337,9 @@ let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo=true) ?arch ?labe | `Cygwin -> cygwin_opam2 ?win10_revision ?labels ?arch ~opam_hashes d () | `Windows -> windows_opam2 ?win10_revision ?winget ?labels ?arch d () in - let clone = if clone_opam_repo then - let url = Dockerfile_distro.(os_family_of_distro d |> opam_repository) in - run "git clone %S /home/opam/opam-repository" url - else empty in let pers = match personality ?arch d with | None -> empty | Some pers -> entrypoint_exec [pers] in - (D.tag_of_distro d, fn @@ clone @@ pers) + (D.tag_of_distro d, fn @@ pers) let create_switch ~arch distro t = let create_switch switch pkg = run "opam switch create %s %s" (OV.to_string switch) pkg in @@ -375,9 +371,9 @@ let all_ocaml_compilers hub_id arch distro = | `Windows | `Cygwin -> empty in header ~arch ~tag:(Printf.sprintf "%s-opam" distro_tag) ~img:hub_id distro - @@ workdir "/home/opam/opam-repository" @@ run "git pull origin master" @@ sandbox - @@ run "opam init -k git -a /home/opam/opam-repository --bare%s" + @@ run "opam init -k git -a %s --bare%s" + (Dockerfile_distro.opam_repository (Dockerfile_distro.os_family_of_distro distro)) (if os_family = `Windows then " --disable-sandboxing" else "") @@ compilers @@ run "opam switch %s" (OV.(to_string (with_patch OV.Releases.latest None))) @@ -416,9 +412,9 @@ let separate_ocaml_compilers hub_id arch distro = | `Linux -> run "opam-sandbox-disable" | `Windows | `Cygwin -> empty in header ~arch ~tag:(Printf.sprintf "%s-opam" distro_tag) ~img:hub_id distro - @@ workdir "/home/opam/opam-repository" @@ sandbox - @@ run "opam init -k git -a /home/opam/opam-repository --bare%s" + @@ run "opam init -k git -a %s --bare%s" + (Dockerfile_distro.opam_repository (Dockerfile_distro.os_family_of_distro distro)) (if os_family = `Windows then "--disable-sandboxing" else "") @@ add_remote @@ variants diff --git a/src-opam/dockerfile_opam.mli b/src-opam/dockerfile_opam.mli index 50903d49..cfb58d91 100644 --- a/src-opam/dockerfile_opam.mli +++ b/src-opam/dockerfile_opam.mli @@ -48,7 +48,6 @@ type opam_hashes = { val gen_opam2_distro : ?win10_revision:Dockerfile_distro.win10_lcu -> ?winget:string -> - ?clone_opam_repo:bool -> ?arch:Ocaml_version.arch -> ?labels:(string * string) list -> opam_hashes:opam_hashes -> @@ -58,8 +57,6 @@ val gen_opam2_distro : for Linux distribution [d] with opam 2.0, opam 2.1, opam 2.2 and opam master, per hash given in parameter. @return a tuple of the Docker tag and the Dockerfile. - If [clone_opam_repo] is true (the default) then the Dockerfile will also git - clone the official opam-repository into [/home/opam/opam-repository]. If [arch] is not specified, it defaults to the base image that is assumed to be multiarch (the main exception to this is i386, which requires different base images from amd64).