From 936c71d70c4acf69c5f08c934cdab72c5dfb7f94 Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Tue, 21 Sep 2021 13:44:59 -0400 Subject: [PATCH 1/5] Build: allow opam 2.1.x --- scripts/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/version.sh b/scripts/version.sh index 40c7316af7f6..df6a495a6ed0 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -14,7 +14,7 @@ ## with both the make and sh syntax export ocaml_version=4.12.1 -export opam_version=2.0 +export opam_version=2 export recommended_rust_version=1.52.1 ## full_opam_repository is a commit hash of the public OPAM repository, i.e. -- GitLab From e29884a8993dd21e50130a33d8edfe4c6ecaef73 Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Tue, 21 Sep 2021 19:22:47 -0400 Subject: [PATCH 2/5] Build: make `make build-deps` succeed with opam 2.1.* --- scripts/install_build_deps.raw.sh | 10 +++++++++- scripts/install_build_deps.sh | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/install_build_deps.raw.sh b/scripts/install_build_deps.raw.sh index 38034285e6a5..df3143ae8e15 100755 --- a/scripts/install_build_deps.raw.sh +++ b/scripts/install_build_deps.raw.sh @@ -18,7 +18,15 @@ export OPAMYES=${OPAMYES:=true} # Note that install_build_deps.sh calls install_build_deps.rust.sh # which checks whether Rust is installed with the right version and explains how # to install it if needed, so using opam depext is redundant anyway. -opam depext conf-gmp conf-libev conf-pkg-config conf-hidapi ctypes-foreign conf-autoconf conf-libffi conf-zlib #conf-rust +conf_packages="conf-gmp conf-libev conf-pkg-config conf-hidapi ctypes-foreign conf-autoconf conf-libffi conf-zlib" #conf-rust + +case $(opam --version) in + 2.0.* ) opam_depext_command="opam depext $conf_packages" ;; + * ) opam_depext_command="opam install --depext-only $conf_packages" ;; +esac +## ShellCheck does not fail when non-quoted variables are at the beginning +## of a command: +$opam_depext_command ## In an ideal world, `--with-test` should be present only when using ## `--dev`. But this would probably break the CI, so we postponed this diff --git a/scripts/install_build_deps.sh b/scripts/install_build_deps.sh index e378b4d9c98f..70a5fc604047 100755 --- a/scripts/install_build_deps.sh +++ b/scripts/install_build_deps.sh @@ -80,7 +80,10 @@ fi # opam packages that depend on Rust. "$script_dir"/install_build_deps.rust.sh -opam install --yes opam-depext +case $(opam --version) in + 2.0.* ) + opam install --yes opam-depext ;; +esac "$script_dir"/install_build_deps.raw.sh -- GitLab From 83b4714b5d88dd87f41276d7ce5b3295d8583090 Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Thu, 21 Oct 2021 13:41:36 -0400 Subject: [PATCH 3/5] Packaging: make `update_opam_repo.sh` work with Opam 2.1 --- scripts/update_opam_repo.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/update_opam_repo.sh b/scripts/update_opam_repo.sh index bc3959da77bd..68908b2cc914 100755 --- a/scripts/update_opam_repo.sh +++ b/scripts/update_opam_repo.sh @@ -88,8 +88,13 @@ done ## Filtering unrequired packages cd $tmp_dir git reset --hard "$full_opam_repository_tag" +case $(opam --version) in + 2.0.* ) opam_depext_dep="opam-depext," ;; + * ) opam_depext_dep="" ;; +esac +#shellcheck disable=SC2086 OPAMSOLVERTIMEOUT=600 opam admin filter --yes --resolve \ - $packages,ocaml,ocaml-base-compiler,odoc,opam-depext,js_of_ocaml-ppx,opam-ed + $packages,ocaml,ocaml-base-compiler,odoc,$opam_depext_dep,js_of_ocaml-ppx,opam-ed ## Adding useful compiler variants for variant in afl flambda fp spacetime ; do -- GitLab From 49be21c6a78cdd50c117cf518585b4d9019bb0be Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Thu, 28 Oct 2021 09:31:48 -0400 Subject: [PATCH 4/5] Build,Packaging: document opam 2,1 Vs 2.0 branching cases --- scripts/install_build_deps.raw.sh | 2 ++ scripts/install_build_deps.sh | 2 ++ scripts/update_opam_repo.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/scripts/install_build_deps.raw.sh b/scripts/install_build_deps.raw.sh index df3143ae8e15..e050691e8284 100755 --- a/scripts/install_build_deps.raw.sh +++ b/scripts/install_build_deps.raw.sh @@ -20,6 +20,8 @@ export OPAMYES=${OPAMYES:=true} # to install it if needed, so using opam depext is redundant anyway. conf_packages="conf-gmp conf-libev conf-pkg-config conf-hidapi ctypes-foreign conf-autoconf conf-libffi conf-zlib" #conf-rust +# Opam < 2.1 uses opam-depext as a plugin, later versions provide the option +# `--depext-only`: case $(opam --version) in 2.0.* ) opam_depext_command="opam depext $conf_packages" ;; * ) opam_depext_command="opam install --depext-only $conf_packages" ;; diff --git a/scripts/install_build_deps.sh b/scripts/install_build_deps.sh index 70a5fc604047..5461d84e7460 100755 --- a/scripts/install_build_deps.sh +++ b/scripts/install_build_deps.sh @@ -80,6 +80,8 @@ fi # opam packages that depend on Rust. "$script_dir"/install_build_deps.rust.sh +# Opam < 2.1 requires opam-depext as a plugin, later versions include it +# natively: case $(opam --version) in 2.0.* ) opam install --yes opam-depext ;; diff --git a/scripts/update_opam_repo.sh b/scripts/update_opam_repo.sh index 68908b2cc914..c95c2974bb14 100755 --- a/scripts/update_opam_repo.sh +++ b/scripts/update_opam_repo.sh @@ -88,6 +88,8 @@ done ## Filtering unrequired packages cd $tmp_dir git reset --hard "$full_opam_repository_tag" +# Opam < 2.1 requires opam-depext as a plugin, later versions include it +# natively: case $(opam --version) in 2.0.* ) opam_depext_dep="opam-depext," ;; * ) opam_depext_dep="" ;; -- GitLab From d713dc995bfa1c1821be7e7ec9b9c30d67bcd16d Mon Sep 17 00:00:00 2001 From: Sebastien Mondet Date: Wed, 3 Nov 2021 15:08:51 -0400 Subject: [PATCH 5/5] Opam: add warning to `update_opam_repo.sh` --- scripts/update_opam_repo.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/update_opam_repo.sh b/scripts/update_opam_repo.sh index c95c2974bb14..15d91312977b 100755 --- a/scripts/update_opam_repo.sh +++ b/scripts/update_opam_repo.sh @@ -90,13 +90,21 @@ cd $tmp_dir git reset --hard "$full_opam_repository_tag" # Opam < 2.1 requires opam-depext as a plugin, later versions include it # natively: +extra_warning="" case $(opam --version) in 2.0.* ) opam_depext_dep="opam-depext," ;; - * ) opam_depext_dep="" ;; + * ) + opam_depext_dep="" + extra_warning=" +WARNING you are using opam $(opam --version), your patch +is potentially removing the opam 2.0.x dependency 'opam-depext', please +make sure you are not removing it (for instance by editing the patch, +fixing the resulting merge-request, or re-running with opam 2.0.x)." + ;; esac #shellcheck disable=SC2086 OPAMSOLVERTIMEOUT=600 opam admin filter --yes --resolve \ - $packages,ocaml,ocaml-base-compiler,odoc,$opam_depext_dep,js_of_ocaml-ppx,opam-ed + $packages,ocaml,ocaml-base-compiler,odoc,${opam_depext_dep}js_of_ocaml-ppx,opam-ed ## Adding useful compiler variants for variant in afl flambda fp spacetime ; do @@ -124,4 +132,5 @@ echo echo "Wrote proposed update in: $target." echo 'Please add this patch to: `https://gitlab.com/tezos/opam-repository`' echo 'And update accordingly the commit hash in: `.gitlab/ci/templates.yml` and `scripts/version.sh`' +echo "$extra_warning" echo -- GitLab