From 3e176cea4202ee280020ac5d90cbce151a9076b9 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 09:34:08 -0500 Subject: [PATCH 1/6] Switch from haskell/actions/setup to haskell-actions/setup Fixes #1598. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d8f6bc6b..15da5124a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,7 +100,7 @@ jobs: with: poetry-version: 1.4.2 - - uses: haskell/actions/setup@v2 + - uses: haskell-actions/setup@v2 id: setup-haskell with: ghc-version: ${{ matrix.ghc-version }} From 4d394714dd7cf4e0ace5e2504599bf629bd6cbb1 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 09:46:36 -0500 Subject: [PATCH 2/6] Pin alex to 3.4.0.1 in cryptol-remote-api Dockerfile Fixes #1599. --- cryptol-remote-api/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index 612c0d7c6..235129b06 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -27,7 +27,11 @@ RUN if ${PORTABILITY}; then \ ghcup install ghc ${GHCVER_BOOTSTRAP} && \ ghcup set ghc ${GHCVER_BOOTSTRAP} && \ cabal v2-update && \ - cabal v2-install alex happy-1.20.1.1 && \ + # We pin specific versions of alex and happy that are necessary to build + # GHC. In general, we don't want to build the latest versions of each + # tool, as GHC may not support them (see, for example, + # https://gitlab.haskell.org/ghc/ghc/-/issues/24302). + cabal v2-install alex-3.4.0.1 happy-1.20.1.1 && \ git clone --recurse-submodules --depth 1 --branch ghc-${GHCVER}-release https://gitlab.haskell.org/ghc/ghc.git && \ cd ./ghc && \ git apply ../ghc-portability.patch && \ From 2d781a2088f52b8553f8e18f380d68f4a1df6df2 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 10:44:14 -0500 Subject: [PATCH 3/6] Dockerfiles: Sync cabal-install version with CI --- Dockerfile | 2 +- cryptol-remote-api/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 95b037bd2..f9fcb69d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,7 +30,7 @@ RUN mkdir -p /home/cryptol/.local/bin && \ chmod +x /home/cryptol/.local/bin/ghcup RUN mkdir -p /home/cryptol/.ghcup && \ ghcup --version && \ - ghcup install cabal 3.6.2.0 && \ + ghcup install cabal 3.10.1.0 && \ ghcup install ghc 9.2.8 && \ ghcup set ghc 9.2.8 RUN cabal v2-update && \ diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index 235129b06..f405b6340 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -18,7 +18,7 @@ ENV GHCUP_INSTALL_BASE_PREFIX=/opt \ PATH=/opt/.ghcup/bin:$PATH RUN curl -o /usr/local/bin/ghcup "https://downloads.haskell.org/~ghcup/0.1.19.4/x86_64-linux-ghcup-0.1.19.4" && \ chmod +x /usr/local/bin/ghcup -RUN ghcup install cabal --set +RUN ghcup install cabal 3.10.1.0 --set ENV PATH=/root/.cabal/bin:$PATH ADD ./cryptol-remote-api/ghc-portability.patch . ARG GHCVER From 88cc7520a9e6b687e3272ee202493b4a21212c2f Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 10:45:53 -0500 Subject: [PATCH 4/6] cryptol-remote-api Dockerfile: Add /root/.local/bin to PATH This is necessary to ensure that `alex` and `happy` are located on the `PATH` when building GHC. --- cryptol-remote-api/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index f405b6340..9bb414d42 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -15,7 +15,7 @@ RUN apt-get update && \ ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 ENV GHCUP_INSTALL_BASE_PREFIX=/opt \ - PATH=/opt/.ghcup/bin:$PATH + PATH=/opt/.ghcup/bin:/root/.local/bin:$PATH RUN curl -o /usr/local/bin/ghcup "https://downloads.haskell.org/~ghcup/0.1.19.4/x86_64-linux-ghcup-0.1.19.4" && \ chmod +x /usr/local/bin/ghcup RUN ghcup install cabal 3.10.1.0 --set From e72ca1f3bd5330980c286e901120a8ce6856aad3 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 13:03:45 -0500 Subject: [PATCH 5/6] Dockerfiles: Consistently factor out GHCVER, CABALVER --- Dockerfile | 10 ++++++---- cryptol-remote-api/Dockerfile | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index f9fcb69d3..d47d09d6b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM ubuntu:22.04 AS build +ARG GHCVER="9.2.8" +ARG CABALVER="3.10.1.0" RUN apt-get update && \ apt-get install -y \ # ghcup requirements @@ -24,15 +26,15 @@ RUN z3 --version ARG CRYPTOLPATH="/cryptol/.cryptol" ENV LANG=C.UTF-8 \ LC_ALL=C.UTF-8 -COPY cabal.GHC-9.2.8.config cabal.project.freeze +COPY cabal.GHC-${GHCVER}.config cabal.project.freeze RUN mkdir -p /home/cryptol/.local/bin && \ curl -L https://downloads.haskell.org/~ghcup/0.1.19.4/x86_64-linux-ghcup-0.1.19.4 -o /home/cryptol/.local/bin/ghcup && \ chmod +x /home/cryptol/.local/bin/ghcup RUN mkdir -p /home/cryptol/.ghcup && \ ghcup --version && \ - ghcup install cabal 3.10.1.0 && \ - ghcup install ghc 9.2.8 && \ - ghcup set ghc 9.2.8 + ghcup install cabal ${CABALVER} && \ + ghcup install ghc ${GHCVER} && \ + ghcup set ghc ${GHCVER} RUN cabal v2-update && \ cabal v2-build -j cryptol:exe:cryptol && \ cp $(cabal v2-exec which cryptol) rootfs/usr/local/bin && \ diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index 9bb414d42..758fdb6f6 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -1,4 +1,5 @@ ARG GHCVER="9.2.8" +ARG CABALVER="3.10.1.0" ARG GHCVER_BOOTSTRAP="8.10.2" FROM ubuntu:22.04 AS toolchain ARG PORTABILITY=false @@ -18,7 +19,7 @@ ENV GHCUP_INSTALL_BASE_PREFIX=/opt \ PATH=/opt/.ghcup/bin:/root/.local/bin:$PATH RUN curl -o /usr/local/bin/ghcup "https://downloads.haskell.org/~ghcup/0.1.19.4/x86_64-linux-ghcup-0.1.19.4" && \ chmod +x /usr/local/bin/ghcup -RUN ghcup install cabal 3.10.1.0 --set +RUN ghcup install cabal ${CABALVER} --set ENV PATH=/root/.cabal/bin:$PATH ADD ./cryptol-remote-api/ghc-portability.patch . ARG GHCVER From 5e0ea61ecbc62d2f62b5e05152236c6fab50f48b Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Thu, 4 Jan 2024 13:08:05 -0500 Subject: [PATCH 6/6] cryptol-remote-api Dockerfile: Factor out {ALEX,HAPPY}VER, documentation We put these near the top of the Dockerfile alongside `GHCVER` to make it easier to remember to update them when `GHCVER` is updated. --- cryptol-remote-api/Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/cryptol-remote-api/Dockerfile b/cryptol-remote-api/Dockerfile index 758fdb6f6..0e66e29a3 100644 --- a/cryptol-remote-api/Dockerfile +++ b/cryptol-remote-api/Dockerfile @@ -1,6 +1,16 @@ ARG GHCVER="9.2.8" ARG CABALVER="3.10.1.0" +# This is the version of GHC that we use as part of the process of building a +# separate copy of GHC from source. The version of GHC that we build from source +# is determined by the value of GHCVER. ARG GHCVER_BOOTSTRAP="8.10.2" +# We pin specific versions of alex and happy that are necessary to build +# GHC. In general, we don't want to build the latest versions of each +# tool, as GHC may not support them (see, for example, +# https://github.com/GaloisInc/cryptol/issues/1599). If you update GHCVER, you +# may need to update ALEXVER and HAPPYVER as well. +ARG ALEXVER="3.4.0.1" +ARG HAPPYVER="1.20.1.1" FROM ubuntu:22.04 AS toolchain ARG PORTABILITY=false RUN apt-get update && \ @@ -28,11 +38,7 @@ RUN if ${PORTABILITY}; then \ ghcup install ghc ${GHCVER_BOOTSTRAP} && \ ghcup set ghc ${GHCVER_BOOTSTRAP} && \ cabal v2-update && \ - # We pin specific versions of alex and happy that are necessary to build - # GHC. In general, we don't want to build the latest versions of each - # tool, as GHC may not support them (see, for example, - # https://gitlab.haskell.org/ghc/ghc/-/issues/24302). - cabal v2-install alex-3.4.0.1 happy-1.20.1.1 && \ + cabal v2-install alex-${ALEXVER} happy-${HAPPYVER} && \ git clone --recurse-submodules --depth 1 --branch ghc-${GHCVER}-release https://gitlab.haskell.org/ghc/ghc.git && \ cd ./ghc && \ git apply ../ghc-portability.patch && \