diff --git a/.gitlab/ci/jobs/packaging/opam_package.yml b/.gitlab/ci/jobs/packaging/opam_package.yml index d693fe6d900d4153c68825614a5c4e08c748015a..a18fc181b166bace0584de943190320eb9dda766 100644 --- a/.gitlab/ci/jobs/packaging/opam_package.yml +++ b/.gitlab/ci/jobs/packaging/opam_package.yml @@ -1,5 +1,5 @@ # This file was automatically generated, do not edit. -# Edit file manifest/manifest.ml instead. +# Edit file manifest/main.ml instead. # Ignoring package internal-devtools, it only contains tests or private targets diff --git a/dune-project b/dune-project index c7f9d4508e02995a4d7c427efecb5904473df86f..82090ba1658d8d77391b4df1b8ec317a794928b6 100644 --- a/dune-project +++ b/dune-project @@ -220,4 +220,4 @@ (package (name tezt-self-tests)) (package (name tezt-tezos)) ; This file was automatically generated, do not edit. -; Edit file manifest/manifest.ml instead. +; Edit file manifest/main.ml instead. diff --git a/dune-workspace b/dune-workspace index 5fc118bee8cea24b62fb967799369ebc2d59295a..160f6a6537e6b7e422fa36abfc54237a9ca09e48 100644 --- a/dune-workspace +++ b/dune-workspace @@ -15,4 +15,4 @@ (context (default (paths (ORIGINAL_PATH :standard)))) ; This file was automatically generated, do not edit. -; Edit file manifest/manifest.ml instead. +; Edit file manifest/main.ml instead. diff --git a/manifest/main.ml b/manifest/main.ml index ad7a8b6d6c6cda6a5cbaec88cce10ce0a447daba..c45c3e8dcf334abb4ed7b655eead1081b3a09b83 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -366,6 +366,20 @@ let zarith_stubs_js = external_lib ~js_compatible:true "zarith_stubs_js" V.True let ledgerwallet_tezos = external_lib "ledgerwallet-tezos" V.(at_least "0.2.1") +(* DEVELOPMENT-ONLY DEPENDENCIES *) + +let () = + List.iter + (add_dep_to_profile "octez-dev-deps") + [ + external_lib "merlin" V.True; + external_lib "odoc" V.True; + external_lib "ocp-indent" V.True; + external_lib "ocaml-lsp-server" V.(at_least "1.6.1"); + external_lib "js_of_ocaml-compiler" V.True; + external_lib "merge-fmt" V.True; + ] + (* INTERNAL LIBS *) let octez_test_helpers = @@ -5717,6 +5731,7 @@ let _tztop = ~modes:[Byte] ~bisect_ppx:false ~static:false + ~profile:"octez-dev-deps" ~deps: [ (* The following deps come from the original dune file. *) @@ -5923,7 +5938,7 @@ let () = in test "main" ~alias:"" ~path:"tezt/tests" ~opam:"" ~deps:(deps @ test_libs) in - generate ~make_tezt_exe + generate ~make_tezt_exe ~default_profile:"octez-deps" (* Generate a dunw-workspace file at the root of the repo *) let () = diff --git a/manifest/manifest.ml b/manifest/manifest.ml index 61a753eb2a4315df4ddcc612b44a92d79e3fe3ff..9df3e203af080f64c650e8fb7bcecd8313665a5c 100644 --- a/manifest/manifest.ml +++ b/manifest/manifest.ml @@ -26,6 +26,8 @@ module String_map = Map.Make (String) module String_set = Set.Make (String) +let list_iter l f = List.iter f l + let ( // ) = Filename.concat let has_error = ref false @@ -39,6 +41,14 @@ let error fmt = Format.eprintf "Error: %s" s) fmt +let pp_do_not_edit ~comment_start fmt () = + Format.fprintf + fmt + "%s This file was automatically generated, do not edit.@.%s Edit file \ + manifest/main.ml instead.@." + comment_start + comment_start + (*****************************************************************************) (* DUNE *) (*****************************************************************************) @@ -988,6 +998,7 @@ module Target = struct preprocess : preprocessor list; preprocessor_deps : preprocessor_dep list; private_modules : string list; + profile : string option; opam_only_deps : t list; release : bool; static : bool; @@ -1147,6 +1158,7 @@ module Target = struct ?preprocess:preprocessor list -> ?preprocessor_deps:preprocessor_dep list -> ?private_modules:string list -> + ?profile:string -> ?opam_only_deps:t option list -> ?release:bool -> ?static:bool -> @@ -1218,8 +1230,8 @@ module Target = struct ?modules ?(modules_without_implementation = []) ?(npm_deps = []) ?ocaml ?opam ?opam_bug_reports ?opam_doc ?opam_homepage ?(opam_with_test = Always) ?(optional = false) ?(preprocess = []) - ?(preprocessor_deps = []) ?(private_modules = []) ?(opam_only_deps = []) - ?(release = false) ?static ?synopsis ?description + ?(preprocessor_deps = []) ?(private_modules = []) ?profile + ?(opam_only_deps = []) ?(release = false) ?static ?synopsis ?description ?(time_measurement_ppx = false) ?(virtual_modules = []) ?default_implementation ?(cram = false) ?license ?(extra_authors = []) ~path names = @@ -1519,6 +1531,7 @@ module Target = struct preprocess; preprocessor_deps; private_modules; + profile; opam_only_deps; release; static; @@ -1823,6 +1836,16 @@ let register_tezt_targets ~make_tezt_exe = String_map.iter register_path !tezt_targets_by_path ; make_tezt_exe !tezt_test_libs +let profile_deps : Target.t list String_map.t ref = ref String_map.empty + +let add_dep_to_profile profile = function + | None -> () + | Some dep -> + let old = + String_map.find_opt profile !profile_deps |> Option.value ~default:[] + in + profile_deps := String_map.add profile (dep :: old) !profile_deps + (*****************************************************************************) (* GENERATOR *) (*****************************************************************************) @@ -2128,10 +2151,7 @@ let generate_dune_files () = in let dunes = List.map generate_dune internals in write (path // "dune") @@ fun fmt -> - Format.fprintf - fmt - "; This file was automatically generated, do not edit.@.; Edit file \ - manifest/main.ml instead.@.@." ; + Format.fprintf fmt "%a@." (pp_do_not_edit ~comment_start:";") () ; let env = Env.empty in let env = match node_preload with @@ -2434,12 +2454,8 @@ let generate_opam_files () = Target.iter_internal_by_opam @@ fun package internals -> let opam = generate_opam package internals in write ("opam/" ^ package ^ ".opam") @@ fun fmt -> - Format.fprintf - fmt - "# This file was automatically generated, do not edit.@.# Edit file \ - manifest/main.ml instead.@.%a" - Opam.pp - opam + pp_do_not_edit ~comment_start:"#" fmt () ; + Opam.pp fmt opam let generate_opam_files_for_release packages_dir release = Target.iter_internal_by_opam @@ fun package internal_pkgs -> @@ -2474,8 +2490,7 @@ let generate_dune_project_files () = in let allow_empty = if not has_public_target then "(allow_empty)" else "" in Format.fprintf fmt "(package (name %s)%s)@." package allow_empty ) ; - Format.fprintf fmt "; This file was automatically generated, do not edit.@." ; - Format.fprintf fmt "; Edit file manifest/manifest.ml instead.@." + pp_do_not_edit ~comment_start:";" fmt () let generate_package_json_file () = let l = ref [] in @@ -2597,8 +2612,7 @@ let generate_workspace env dune = pp_dune fmt Dune.[Env.to_s_expr env] ; pp_dune fmt dune ; Format.fprintf fmt "@." ; - Format.fprintf fmt "; This file was automatically generated, do not edit.@." ; - Format.fprintf fmt "; Edit file manifest/manifest.ml instead.@." + pp_do_not_edit ~comment_start:";" fmt () let find_opam_and_dune_files = let root = "." in @@ -2730,7 +2744,6 @@ let check_js_of_ocaml () = [B0 .. Bn] do not belong to Package A. If such paths exist, we report one path with the minimum length. *) let check_circular_opam_deps () = - let list_iter l f = List.iter f l in let name i = Target.name_for_errors (Internal i) in let deps_of (t : Target.internal) = List.filter_map Target.get_internal (Target.all_internal_deps t) @@ -2936,8 +2949,7 @@ let generate_opam_ci () = let (_ : int) = compute_rank package_name in ()) ; write ".gitlab/ci/jobs/packaging/opam_package.yml" @@ fun fmt -> - Format.fprintf fmt "# This file was automatically generated, do not edit.@." ; - Format.fprintf fmt "# Edit file manifest/manifest.ml instead.@." ; + pp_do_not_edit ~comment_start:"#" fmt () ; (* Decide whether an opam package should be tested in the CI or not. If not, remove it from [rank] so that we do not consider it in the later stage. *) @@ -3030,7 +3042,108 @@ let generate_opam_ci () = delayed_by package_name) -let generate ~make_tezt_exe = +let generate_profiles ~default_profile = + let deps : Version.constraints String_map.t String_map.t ref = + (* [!deps |> String_map.find profile |> String_map.find pkg] + are the version constraints for package [pkg] in profile [profile]. *) + ref String_map.empty + in + let conflicts : Version.constraints String_map.t String_map.t ref = + ref String_map.empty + in + let rec add_target_to deps profile = function + | Target.Internal _ -> + (* No need to recurse on dependencies because we'll iterate on all internal + dependencies anyway. *) + () + | Vendored _ -> + (* It is the developer's duty to integrate the dependencies of + vendored libraries, manually, into the generated .opam / lock file. *) + () + | External {opam = Some name; version; _} | Opam_only {name; version; _} -> + let profile_deps = + String_map.find_opt profile !deps + |> Option.value ~default:String_map.empty + in + let version = + match String_map.find_opt name profile_deps with + | None -> version + | Some old_version -> + if old_version <> version then Version.(version && old_version) + else version + in + let profile_deps = String_map.add name version profile_deps in + deps := String_map.add profile profile_deps !deps + | External {opam = None; _} -> + (* This corresponds to libs from the stdlib, like dynlink, compiler-libs etc. + There is no opam package to add to the lock file. *) + () + | Optional target | Select {package = target; _} | Open (target, _) -> + add_target_to deps profile target + in + String_map.iter + (fun profile deps_to_add -> + List.iter (add_target_to deps profile) deps_to_add) + !profile_deps ; + ( Target.iter_internal_by_path @@ fun _ internals -> + list_iter internals @@ fun internal -> + let profile = internal.profile |> Option.value ~default:default_profile in + list_iter (Target.all_internal_deps internal) (add_target_to deps profile) ; + list_iter internal.conflicts (add_target_to conflicts profile) ) ; + let generate_profile profile (profile_deps, profile_conflicts) = + let depends = + String_map.bindings profile_deps + |> List.map @@ fun (package, version) -> + {Opam.package; version; with_test = Never; optional = false} + in + let conflicts = + String_map.bindings profile_conflicts + |> List.map @@ fun (package, version) -> + {Opam.package; version; with_test = Never; optional = false} + in + let opam : Opam.t = + { + maintainer = "contact@tezos.com"; + authors = ["Tezos devteam"]; + homepage = "https://www.tezos.com/"; + doc = ""; + bug_reports = "https://gitlab.com/tezos/tezos/issues"; + dev_repo = "git+https://gitlab.com/tezos/tezos.git"; + licenses = ["MIT"]; + depends; + conflicts; + build = []; + synopsis = + Printf.sprintf + "Virtual package depending on Octez dependencies (profile: %s)" + profile; + url = None; + description = + Some + (Printf.sprintf + "Install this package to install all dependencies needed to \ + build the subset of Octez denoted by profile %s." + profile); + x_opam_monorepo_opam_provided = []; + } + in + write ("opam/virtual/" ^ profile ^ ".opam") @@ fun fmt -> + pp_do_not_edit ~comment_start:"#" fmt () ; + Opam.pp fmt opam + in + let merged = + let merge _profile m1 m2 = + match (m1, m2) with + | None, None -> None + | None, Some m -> Some (String_map.empty, m) + | Some m, None -> Some (m, String_map.empty) + | Some m1, Some m2 -> Some (m1, m2) + in + String_map.merge merge !deps !conflicts + in + String_map.iter generate_profile merged + +let generate ~make_tezt_exe ~default_profile = Printexc.record_backtrace true ; try register_tezt_targets ~make_tezt_exe ; @@ -3041,6 +3154,7 @@ let generate ~make_tezt_exe = generate_static_packages () ; generate_opam_ci () ; generate_binaries_for_release () ; + generate_profiles ~default_profile ; Option.iter (generate_opam_files_for_release packages_dir) release with exn -> Printexc.print_backtrace stderr ; diff --git a/manifest/manifest.mli b/manifest/manifest.mli index e03651424b165d5595d4c69a04d6bec2a0c3c69b..f24885ac56d9cdfff7fc515343a5d8d93e134585 100644 --- a/manifest/manifest.mli +++ b/manifest/manifest.mli @@ -641,6 +641,20 @@ type with_test = Always | Never | Only_on_64_arch - [private_modules]: similar to [modules], but those modules are not part of the library interface. They are not part of the toplevel module of the library. + - [profile]: the name of the profile to which the target belongs. + For each profile, a file [opam/virtual/.opam] is generated. + This file depends on all external dependencies on which targets that belong + to this profile depend on, and contains no build instructions. + It is thus a good basis for [opam lock] to generate a [.opam.locked] file. + Running [opam install .opam.locked] will then install all dependencies + needed to build targets belonging to this profile. + + Targets for which no profile is specified will belong to the default profile + given to {!generate}. Most of the time you do not need to specify a profile: + the default profile is fine. But if your target depends on packages that users + would most likely not want to install, it may be a good idea to separate it + into its own profile. + - [opam_only_deps]: dependencies to add to the [.opam] file but not to the [dune] file. Typical use cases are runtime dependencies and build dependencies for users of the target (but not the target itself). @@ -710,6 +724,7 @@ type 'a maker = ?preprocess:preprocessor list -> ?preprocessor_deps:preprocessor_dep list -> ?private_modules:string list -> + ?profile:string -> ?opam_only_deps:target list -> ?release:bool -> ?static:bool -> @@ -1030,6 +1045,16 @@ val open_ : ?m:string -> target -> target Example: [tezos_base |> open_if protocol_is_recent_enough] *) val open_if : ?m:string -> bool -> target -> target +(** Add a dependency to a profile. + + See the documentation of the [?profile] argument of target makers for + more information about profiles. + + Use [add_dep_to_profile profile dep] to add [dep] as a dependency to the + [opam/virtual/profile.opam] file without having to add it as a dependency of an + actual package. *) +val add_dep_to_profile : string -> target -> unit + (** Get a name for a given target, to display in errors. If a target has multiple names, one is chosen arbitrarily. @@ -1042,8 +1067,13 @@ val name_for_errors : target -> string [public_lib], [test], etc. [make_tezt_exe] is given the list of libraries that register Tezt tests - and shall create a test executable that links all of them. *) -val generate : make_tezt_exe:(target list -> target) -> unit + and shall create a test executable that links all of them. + + [default_profile] is the name of the profile to use for targets that + were declared without [?profile]. See the documentation of the [?profile] + argument of type ['a maker]. *) +val generate : + make_tezt_exe:(target list -> target) -> default_profile:string -> unit (** Run various checks. diff --git a/opam/virtual/octez-deps.opam b/opam/virtual/octez-deps.opam new file mode 100644 index 0000000000000000000000000000000000000000..1217c558c49f69cc6965700cad2f4e40e425b621 --- /dev/null +++ b/opam/virtual/octez-deps.opam @@ -0,0 +1,109 @@ +# This file was automatically generated, do not edit. +# Edit file manifest/main.ml instead. +opam-version: "2.0" +maintainer: "contact@tezos.com" +authors: ["Tezos devteam"] +homepage: "https://www.tezos.com/" +bug-reports: "https://gitlab.com/tezos/tezos/issues" +dev-repo: "git+https://gitlab.com/tezos/tezos.git" +license: "MIT" +depends: [ + "alcotest" { >= "1.5.0" } + "alcotest-lwt" { >= "1.5.0" } + "astring" + "base-unix" + "bigstring" + "bigstringaf" { >= "0.2.0" } + "bisect_ppx" { >= "2.7.0" } + "bls12-381" { >= "5.0.0" & < "5.1.0" } + "bls12-381-signature" { = "1.0.0" } + "camlzip" { >= "1.11" & < "1.12" } + "caqti" + "caqti-dynload" + "caqti-lwt" + "class_group_vdf" { >= "0.0.4" } + "cmdliner" { >= "1.1.0" } + "cohttp-lwt-unix" { >= "2.2.0" } + "conf-libev" + "conf-rust" + "ctypes" { >= "0.18.0" } + "ctypes-foreign" { >= "0.18.0" } + "ctypes_stubs_js" + "data-encoding" { >= "0.6" & < "0.7" } + "digestif" { >= "0.7.3" } + "dune-configurator" + "ezjsonm" { >= "1.1.0" } + "fmt" { >= "0.8.7" } + "hacl-star" { >= "0.4.2" & < "0.5" } + "hacl-star-raw" + "hashcons" + "hex" { >= "1.3.0" } + "index" { >= "1.6.0" & < "1.7.0" } + "integers" + "integers_stubs_js" + "ipaddr" { >= "5.0.0" & < "6.0.0" } + "irmin" { >= "3.4.0" & < "3.5.0" } + "irmin-pack" { >= "3.4.0" & < "3.5.0" } + "js_of_ocaml" { >= "4.0.0" & < "5.0.0" } + "js_of_ocaml-lwt" { >= "4.0.0" & < "5.0.0" } + "json-data-encoding" { >= "0.11" & < "0.13" } + "ledgerwallet-tezos" { >= "0.2.1" } + "logs" + "lwt" { >= "5.6.0" } + "lwt-canceler" { >= "0.3" & < "0.4" } + "lwt-exit" + "lwt-watcher" { = "0.2" } + "lwt_log" + "mtime" { >= "1.0.0" } + "num" + "ocaml-migrate-parsetree" + "ocamlformat" { = "0.21.0" } + "ocamlgraph" + "ocp-ocamlres" { >= "0.4" } + "ocplib-endian" + "ometrics" { >= "0.2.1" } + "ppx_deriving" + "ppx_expect" + "ppx_import" + "prbnmcn-cgrph" { = "0.0.2" } + "prbnmcn-dagger" { = "0.0.2" } + "prbnmcn-dagger-stats" { = "0.0.2" } + "prbnmcn-stats" { = "0.0.4" } + "pringo" { >= "1.3" & < "1.4" } + "prometheus" { >= "1.2" } + "prometheus-app" { >= "1.2" } + "ptime" { >= "1.0.0" } + "pure-splitmix" { = "0.3" } + "pyml" + "qcheck-alcotest" { >= "0.18" } + "qcheck-core" + "re" { >= "1.7.2" } + "resto" { >= "1.0" } + "resto-acl" { >= "1.0" } + "resto-cohttp" { >= "1.0" } + "resto-cohttp-client" { >= "1.0" } + "resto-cohttp-self-serving-client" { >= "1.0" } + "resto-cohttp-server" { >= "1.0" } + "resto-directory" { >= "1.0" } + "ringo" { >= "0.9" } + "ringo-lwt" { >= "0.9" } + "secp256k1-internal" { >= "0.3.0" } + "tar" + "tar-unix" { = "2.0.0" } + "tezos-bls12-381-polynomial" { >= "0.1.0" } + "tezos-plompiler" { >= "0.1.2" } + "tezos-plonk" { >= "0.1.2" } + "tezos-rust-libs" { = "1.2" } + "tls" { >= "0.10" } + "uri" { >= "2.2.0" } + "uutf" + "zarith" { >= "1.12" & < "1.13" } + "zarith_stubs_js" +] +conflicts: [ + "hacl_x25519" + "result" { < "1.5" } +] +build: [] +synopsis: "Virtual package depending on Octez dependencies (profile: octez-deps)" +description: "Install this package to install all dependencies needed to build the subset of Octez denoted by profile octez-deps." diff --git a/opam/virtual/octez-dev-deps.opam b/opam/virtual/octez-dev-deps.opam new file mode 100644 index 0000000000000000000000000000000000000000..fcbbe13410373e18e8e45a9c8f4b46ebe9b6ea20 --- /dev/null +++ b/opam/virtual/octez-dev-deps.opam @@ -0,0 +1,21 @@ +# This file was automatically generated, do not edit. +# Edit file manifest/main.ml instead. +opam-version: "2.0" +maintainer: "contact@tezos.com" +authors: ["Tezos devteam"] +homepage: "https://www.tezos.com/" +bug-reports: "https://gitlab.com/tezos/tezos/issues" +dev-repo: "git+https://gitlab.com/tezos/tezos.git" +license: "MIT" +depends: [ + "js_of_ocaml-compiler" + "merge-fmt" + "merlin" + "ocaml-lsp-server" { >= "1.6.1" } + "ocp-indent" + "odoc" + "utop" { >= "2.8" } +] +build: [] +synopsis: "Virtual package depending on Octez dependencies (profile: octez-dev-deps)" +description: "Install this package to install all dependencies needed to build the subset of Octez denoted by profile octez-dev-deps." diff --git a/scripts/install_build_deps.raw.sh b/scripts/install_build_deps.raw.sh index 7bf944990ba84153afee604994c32710a10b5862..95e935835879c9f43fc6415ea3e9e95e6515f399 100755 --- a/scripts/install_build_deps.raw.sh +++ b/scripts/install_build_deps.raw.sh @@ -3,14 +3,10 @@ set -e script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")" -src_dir="$(dirname "$script_dir")" #shellcheck source=scripts/version.sh . "$script_dir"/version.sh -opams=$(find "$src_dir/vendors" "$src_dir/src" "$src_dir/tezt" "$src_dir/opam" -name \*.opam -print) - - export OPAMYES="${OPAMYES:=true}" ## In another ideal world, this list should be extracted from the pinned @@ -45,7 +41,7 @@ OPAMASSUMEDEPEXTS=true opam install conf-rust # will be intepreted as a string and not as a list of strings leading to # an error. # shellcheck disable=SC2086 -opam install $opams --deps-only --with-test --criteria="-notuptodate,-changed,-removed" +opam install opam/virtual/octez-deps.opam --deps-only --criteria="-notuptodate,-changed,-removed" if [ "$1" = "--tps" ]; then opam install caqti-driver-postgresql diff --git a/scripts/install_build_deps.sh b/scripts/install_build_deps.sh index 157806bef64fc5f6a9049f960f8a2a0ee0365e9e..9de6275ffc25e975eb166910309e85570ab75026 100755 --- a/scripts/install_build_deps.sh +++ b/scripts/install_build_deps.sh @@ -102,7 +102,8 @@ if [ -n "$dev" ]; then # enough (for [ppx_yojson_conv_lib] in particular), so we add a # minimal bound to ensure it won’t be picked by opam. # utop is constrained to avoid reinstalling in all the times. - opam install --yes merlin ometrics.0.2.1 utop.2.9.0 odoc ocp-indent "ocaml-lsp-server>=1.6.1" js_of_ocaml-compiler merge-fmt --criteria="-changed,-removed" + opam install --yes opam/virtual/octez-deps.opam opam/virtual/octez-dev-deps.opam --deps-only --criteria="-changed,-removed" fi "$script_dir"/install_sapling_parameters.sh + diff --git a/scripts/opam-check.sh b/scripts/opam-check.sh index 681a43cb8160773ae00845895d42f9bb42fe089b..e4b7a0652bd6065896bedc6747b772ed96dc293f 100755 --- a/scripts/opam-check.sh +++ b/scripts/opam-check.sh @@ -1,20 +1,17 @@ #!/bin/sh script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")" -src_dir="$(dirname "$script_dir")" . "$script_dir"/version.sh -opams=$(find "$src_dir/vendors" "$src_dir/src" "$src_dir/tezt" "$src_dir/opam" -name \*.opam -print) - echo "## Checking installed dependencies..." echo -if ! opam install $opams --deps-only --with-test --show-actions | grep "Nothing to do." > /dev/null 2>&1 ; then +if ! opam install opam/virtual/octez-deps.opam --deps-only --with-test --show-actions | grep "Nothing to do." > /dev/null 2>&1 ; then echo echo 'Failure! Missing actions:' echo - opam install $opams --deps-only --with-test --show-actions + opam install opam/virtual/octez-deps.opam --deps-only --with-test --show-actions echo echo 'Failed! Please read the doc in `./scripts/update_opam_repo.sh` and act accordingly.' echo diff --git a/scripts/update_opam_repo.sh b/scripts/update_opam_repo.sh index 7c7c4376eb1ff98e1459f99ecd955d76694e434e..80949c9617533bbdb2bda2e5383cba7489fd4900 100755 --- a/scripts/update_opam_repo.sh +++ b/scripts/update_opam_repo.sh @@ -49,8 +49,6 @@ src_dir="$(dirname "$script_dir")" . "$script_dir"/version.sh -opams=$(find "$src_dir/vendors" "$src_dir/src" "$src_dir/tezt" "$src_dir/opam" -name \*.opam -print | LC_COLLATE=C sort -u) - ## Shallow clone of opam repository (requires git protocol version 2) export GIT_WORK_TREE="$tmp_dir" export GIT_DIR="$GIT_WORK_TREE/.git" @@ -60,30 +58,9 @@ git remote add origin https://github.com/ocaml/opam-repository git fetch --depth 1 origin "$full_opam_repository_tag" ## Adding the various tezos packages -packages= -for opam in $opams; do - - file=$(basename $opam) - package=${file%.opam} - packages=$packages,$package.dev - mkdir -p "$tmp_dir"/packages/$package/$package.dev - - ## HACK: For some reason, `opam admin list/filter` do not follow - ## `--with-test/doc` for 'toplevel' package, only for their - ## 'dependencies. We want the exact opposite (like for `opam - ## install`), so we manually remove the tag in the most - ## ugliest-possible way... - - sed -e "s/{ *with-test *}//" \ - -e "s/with-test \& //" \ - -e "s/\& with-test//" \ - -e "s/{ *with-doc *}//" \ - -e "s/with-doc \& //" \ - -e "s/\& with-doc//" \ - $opam > "$tmp_dir"/packages/$package/$package.dev/opam - -done +mkdir -p "$tmp_dir"/packages/octez-deps/octez-deps.dev +cp opam/virtual/octez-deps.opam "$tmp_dir"/packages/octez-deps/octez-deps.dev/opam ## Filtering unrequired packages cd $tmp_dir @@ -123,7 +100,7 @@ case $(opam --version) in esac #shellcheck disable=SC2086 OPAMSOLVERTIMEOUT=600 opam admin filter --yes --resolve \ - $packages,ocaml,ocaml-base-compiler,odoc,${opam_depext_dep}ledgerwallet-tezos,caqti-driver-postgresql,js_of_ocaml-lwt,$dummy_pkg + octez-deps,ocaml,ocaml-base-compiler,odoc,${opam_depext_dep}ledgerwallet-tezos,caqti-driver-postgresql,js_of_ocaml-lwt,$dummy_pkg ## - ocaml-base-compiler has to be explicitely listed for the solver ## to not prefer the "variant" `system` of the compiler ## - odoc is used by the CI to generate the doc @@ -139,12 +116,8 @@ for variant in afl flambda fp ; do git checkout packages/ocaml-option-$variant/ocaml-option-$variant.1 done -## Removing the various tezos packages -for opam in $opams; do - file=$(basename $opam) - package=${file%.opam} - rm -r "$tmp_dir"/packages/$package -done +## Removing temporary hacks +rm -r "$tmp_dir"/packages/octez-deps rm -r "$tmp_dir"/packages/$dummy_pkg ## Generating the diff!