Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify tool dependencies using build-tool-depends. Refs #149. #228

Merged

Conversation

ivanperez-keera
Copy link
Member

Specify dependencies on tools like alex, happy and BNFC using build-tool-depends, and update installation instructions accordingly, as prescribed in the solution proposed for #149.

…asa#149.

The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on `BNFC` as part of a custom-setup
section. However, this is sub-ideal because `alex` and `happy` are also needed,
and Cabal fails to detect that requirement, and also fails to install `BNFC`
and make it available before it tries to compile Ogma. This makes the
installation instructions overly complicated (all three of those packages need
to be installed by hand first), and makes Hackage report that Ogma as a whole
cannot be built.

This commit updates the Cabal package to specify the tools it needs using
`build-tool-depends`. The notation is used by versions of Cabal from 3.0 to
modern versions when using the standard `install` command, which ensures that
the programs needed are installed before. When using `v1-install`, which is
accepted by versions of Cabal as far as 2.4, the programs `alex`, `happy` and
`bnfc` need to be installed prior to installing Ogma (like before).
…. Refs nasa#149.

The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on `BNFC` as part of a custom-setup
section. However, this is sub-ideal because `alex` and `happy` are also needed,
and Cabal fails to detect that requirement, and also fails to install `BNFC`
and make it available before it tries to compile Ogma. This makes the
installation instructions overly complicated (all three of those packages need
to be installed by hand first), and makes Hackage report that Ogma as a whole
cannot be built.

This commit updates the Cabal package to specify the tools it needs using
`build-tool-depends`. The notation is used by versions of Cabal from 3.0 to
modern versions when using the standard `install` command, which ensures that
the programs needed are installed before. When using `v1-install`, which is
accepted by versions of Cabal as far as 2.4, the programs `alex`, `happy` and
`bnfc` need to be installed prior to installing Ogma (like before).
…nasa#149.

The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on `BNFC` as part of a custom-setup
section. However, this is sub-ideal because `alex` and `happy` are also needed,
and Cabal fails to detect that requirement, and also fails to install `BNFC`
and make it available before it tries to compile Ogma. This makes the
installation instructions overly complicated (all three of those packages need
to be installed by hand first), and makes Hackage report that Ogma as a whole
cannot be built.

This commit updates the Cabal package to specify the tools it needs using
`build-tool-depends`. The notation is used by versions of Cabal from 3.0 to
modern versions when using the standard `install` command, which ensures that
the programs needed are installed before. When using `v1-install`, which is
accepted by versions of Cabal as far as 2.4, the programs `alex`, `happy` and
`bnfc` need to be installed prior to installing Ogma (like before).
The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on BNFC as part of a custom-setup
section. However, this is sub-ideal because alex and happy are also needed, and
Cabal fails to detect that requirement, and also fails to install BNFC and make
it available before it tries to compile Ogma. This makes the installation
instructions overly complicated (all three of those packages need to be
installed by hand first), and makes Hackage report that Ogma as a whole cannot
be built.

Prior commits have updated the Cabal files to use build-tool-depends to
indicate which tools need to be available before compiling some packages.

This commit adds a cabal.project file at the top-level so that newer versions
of Cabal find all Ogma packages in the current directory, which is needed to be
able to exploit that functionality.
The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on BNFC as part of a custom-setup
section. However, this is sub-ideal because alex and happy are also needed, and
Cabal fails to detect that requirement, and also fails to install BNFC and make
it available before it tries to compile Ogma. This makes the installation
instructions overly complicated (all three of those packages need to be
installed by hand first), and makes Hackage report that Ogma as a whole cannot
be built.

Prior commits have updated the Cabal files to use build-tool-depends to
indicate which tools need to be available before compiling some packages. With
this change, in older versions of Cabal, it is now necessary to manually
install bnfc before installing Ogma.
The Cabal packages in Ogma were written for an older version of Cabal.
Currently, they only state a dependency on BNFC as part of a custom-setup
section. However, this is sub-ideal because alex and happy are also needed, and
Cabal fails to detect that requirement, and also fails to install BNFC and make
it available before it tries to compile Ogma. This makes the installation
instructions overly complicated (all three of those packages need to be
installed by hand first), and makes Hackage report that Ogma as a whole cannot
be built.

Prior commits have updated the Cabal files to use build-tool-depends to
indicate which tools need to be available before compiling some packages.

This commit updates the README with the new installation instructions.
@ivanperez-keera ivanperez-keera force-pushed the develop-build-tool-depends branch from 888a9b8 to ede7dda Compare February 2, 2025 04:55
@ivanperez-keera
Copy link
Member Author

Change Manager: Verified that:

  • Solution is implemented:
    • The code proposed compiles and passes all tests. Details:
    • The solution proposed produces the expected result. Details:
      The following dockerfile checks that it is possible to install Ogma using a simple cabal install command without having to first install alex, happy or bnfc, after which it prints the message "Success":
      FROM ubuntu:focal
      
      ENV DEBIAN_FRONTEND=noninteractive
      RUN apt-get update
      
      RUN apt-get install --yes \
            curl g++ gcc git libgmp3-dev libz-dev make pkg-config
      
      RUN mkdir -p $HOME/.local/bin
      ENV PATH=$PATH:/root/.local/bin/
      
      RUN curl https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -o $HOME/.local/bin/ghcup
      RUN chmod a+x $HOME/.local/bin/ghcup
      
      ENV PATH=$PATH:/root/.ghcup/bin/
      RUN ghcup install ghc 9.10
      RUN ghcup install cabal 3.12
      RUN ghcup set ghc 9.10.1
      RUN cabal update
      
      SHELL ["/bin/bash", "-c"]
      CMD git clone $REPO \
          && cd $NAME \
          && git checkout $COMMIT \
          && cabal install ogma-cli:ogma \
          && echo "Success"
      Command (substitute variables based on new path after merge):
      $ docker run -e "REPO=https://github.com/ivanperez-keera/ogma" -e "NAME=ogma" -e "COMMIT=ede7dda442a413c111be10d4427cf7a4c4a050ea" -it ogma-verify-149
      
  • Implementation is documented. Details:
    The README has been updated with new installation instructions based on the changes in this PR.
  • Change history is clear.
  • Commit messages are clear.
  • Changelogs are updated.
  • Examples are updated. Details:
    No updates needed; change is to the Cabal packages and README.
  • Author is internal or has provided signed CLA.
  • Required version bumps are evaluated. Details:
    Bump not needed; although installation instructions have changed, the API remains the same and Ogma remains compatible with Cabal 2.4 as before.

@ivanperez-keera ivanperez-keera merged commit 1b5f86e into nasa:develop Feb 2, 2025
2 checks passed
@ivanperez-keera ivanperez-keera deleted the develop-build-tool-depends branch February 2, 2025 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant