Skip to content

Commit

Permalink
Merge branch 'develop-version-bounds' into develop. Close #119.
Browse files Browse the repository at this point in the history
**Description**

The cabal packages do not currently specify version bounds. This makes
hackage complain when we upload packages, and can create stability /
installation issues for users.

**Type**

- Bug: Cabal files are missing useful information.

**Additional context**

None.

**Requester**

- Ivan Perez.

**Method to check presence of bug**

It's not possible to check automatically. The check is done by opening
the cabal files and checking whether all dependencies of all components
specify version bounds.

To ensure that the bounds set are acceptable, the following two
dockerfiles compile Ogma with the oldest version of GHC supported (based
on the version bound on base), and the newest (based on other
constraints, as well as imports in the code that are only available in
modern versions of dependencies of GHC):

```Dockerfile
--- Dockerfile-ghc-8.4
FROM ubuntu:trusty

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update

RUN apt-get install --yes software-properties-common
RUN add-apt-repository ppa:hvr/ghc
RUN apt-get update

RUN apt-get install --yes ghc-8.4.4 cabal-install-2.4
RUN apt-get install --yes libz-dev

ENV PATH=/opt/ghc/8.4.4/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH

RUN cabal update
RUN cabal v1-sandbox init
RUN cabal v1-install alex happy
RUN apt-get install --yes git

CMD git clone $REPO \
    && cd $NAME \
    && git checkout $COMMIT \
    && cd .. \
    && cabal v1-sandbox init \
    && cabal v1-install $NAME/$PAT**/ --constraint="aeson>=2.0.3.0" --enable-tests \
    && echo "Success"

--- Dockerfile-ghc-9.4
FROM ubuntu:focal

RUN apt-get update

RUN apt-get install --yes libz-dev
RUN apt-get install --yes git

RUN apt-get install --yes wget
RUN mkdir -p $HOME/.ghcup/bin
RUN wget https://downloads.haskell.org/~ghcup/0.1.17.7/x86_64-linux-ghcup-0.1.17.7 -O $HOME/.ghcup/bin/ghcup

RUN chmod a+x $HOME/.ghcup/bin/ghcup
ENV PATH=$PATH:/root/.ghcup/bin/
ENV PATH=$PATH:/root/.cabal/bin/
RUN apt-get install --yes curl
RUN apt-get install --yes gcc g++ make libgmp3-dev
RUN ghcup install ghc 9.4
RUN ghcup install cabal 3.2
RUN ghcup set ghc 9.4.8
RUN cabal update

SHELL ["/bin/bash", "-c"]
CMD git clone $REPO \
    && cd $NAME \
    && git checkout $COMMIT \
    && export PATH=$PATH:$PWD/.cabal-sandbox/bin/ \
    && cabal v1-sandbox init \
    && cabal v1-install alex happy --constraint="happy<2.0" \
    && cabal v1-install BNFC ogma-**/ --constraint="aeson>=2.0.3.0" \
    && cabal v1-install ogma-**/ --constraint="aeson>=2.0.3.0" --enable-tests \
    && echo "Success"
```

Command (substitute variables based on new path after merge):
```sh
$ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=<HASH>" -it ogma-verify-119-ghc-8.4
$ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "PAT=ogma"  -e "COMMIT=<HASH>" -it ogma-verify-119-ghc-9.4
```

Notice that we use two commands, one for each of the above dockerfiles.

**Expected result**

All dependencies of all components specify version bounds. Installing
Ogma with the dockerfiles above prints sucess, indicating that it can be
installed with GHC 8.4 and GHC 9.4.

**Solution implemented**

Add version bounds to all dependencies of all components of all packages.

**Further notes**

We pick the latest versions of all dependencies available, and the
earliest versions that are compatible with base 4.11 (the earliest
currently supported by Ogma) that provide the definitions needed, with
the same signature.

Ogma currently fails to be installed with GHC 9.6 and above (in part due
to imports from mtl:Control.Monad.Except that are no longer exported by
that module). We determine GHC 9.4 to be the latest version that Ogma
can be compiled with, and pick other versions of other libraries
accordingly.
  • Loading branch information
ivanperez-keera committed Dec 26, 2024
2 parents ad70d59 + cc38a22 commit 089ed5a
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 45 deletions.
1 change: 1 addition & 0 deletions ogma-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Provide ability to customize template in fprime command (#185).
* Provide ability to customize template in standalone command (#189).
* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
12 changes: 6 additions & 6 deletions ogma-cli/ogma-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ executable ogma

build-depends:
base >= 4.11.0.0 && < 5
, optparse-applicative
, optparse-applicative >= 0.14 && < 0.19
, ogma-core >= 1.5.0 && < 1.6

hs-source-dirs:
Expand All @@ -160,11 +160,11 @@ test-suite test-ogma

build-depends:
base >= 4.11.0.0 && < 5
, HUnit
, process
, test-framework
, test-framework-hunit
, unix
, HUnit >= 1.2.0.0 && < 1.7
, process >= 1.6 && < 1.7
, test-framework >= 0.8.2 && < 0.9
, test-framework-hunit >= 0.2.0 && < 0.4
, unix >= 2.7.2.2 && < 2.9

hs-source-dirs:
tests
Expand Down
1 change: 1 addition & 0 deletions ogma-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Use template expansion system to generate F' monitoring component (#185).
* Use template expansion system to generate standalone Copilot monitor (#189).
* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
20 changes: 10 additions & 10 deletions ogma-core/ogma-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ library
build-depends:
base >= 4.11.0.0 && < 5
, aeson >= 2.0.0.0 && < 2.2
, bytestring
, filepath
, mtl
, bytestring >= 0.10.8.2 && < 0.13
, filepath >= 1.4.2 && < 1.6
, mtl >= 2.2.2 && < 2.4
, text >= 1.2.3.1 && < 2.1

, ogma-extra >= 1.5.0 && < 1.6
Expand Down Expand Up @@ -149,13 +149,13 @@ test-suite unit-tests
Main.hs

build-depends:
base
, directory
, HUnit
, QuickCheck
, test-framework
, test-framework-hunit
, test-framework-quickcheck2
base >= 4.11.0.0 && < 5
, directory >= 1.3.1.5 && < 1.4
, HUnit >= 1.2.0.0 && < 1.7
, QuickCheck >= 2.8.2 && < 2.16
, test-framework >= 0.8.2 && < 0.9
, test-framework-hunit >= 0.2.0 && < 0.4
, test-framework-quickcheck2 >= 0.3.0.4 && < 0.4

, ogma-core

Expand Down
1 change: 1 addition & 0 deletions ogma-extra/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Deprecate unnecessary functions (#185).
* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
16 changes: 8 additions & 8 deletions ogma-extra/ogma-extra.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ library
build-depends:
base >= 4.11.0.0 && < 5
, aeson >= 2.0.0.0 && < 2.2
, bytestring
, Cabal
, directory
, filepath
, bytestring >= 0.10.8.2 && < 0.13
, Cabal >= 2.2.0.0 && < 3.9
, directory >= 1.3.1.5 && < 1.4
, filepath >= 1.4.2 && < 1.6
, microstache >= 1.0 && < 1.1
, text >= 1.2.3.1 && < 2.1

Expand All @@ -100,10 +100,10 @@ test-suite unit-tests
Main.hs

build-depends:
base
, QuickCheck
, test-framework
, test-framework-quickcheck2
base >= 4.11.0.0 && < 5
, QuickCheck >= 2.8.2 && < 2.16
, test-framework >= 0.8.2 && < 0.9
, test-framework-quickcheck2 >= 0.3.0.4 && < 0.4

, ogma-extra

Expand Down
1 change: 1 addition & 0 deletions ogma-language-c/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [1.X.Y] - 2024-12-24

* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
12 changes: 6 additions & 6 deletions ogma-language-c/ogma-language-c.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ custom-setup
setup-depends:
base >= 4.11.0.0 && < 5
, Cabal >= 2.0 && < 3.9
, process
, BNFC >= 2.9.1
, process >= 1.6 && < 1.7
, BNFC >= 2.9.1 && < 2.10

library

Expand All @@ -91,7 +91,7 @@ library

build-depends:
base >= 4.11.0.0 && < 5
, array >= 0.5.2.0
, array >= 0.5.2.0 && < 0.6

hs-source-dirs:
src
Expand All @@ -108,9 +108,9 @@ test-suite unit-tests

build-depends:
base >= 4.11.0.0 && < 5
, QuickCheck
, test-framework
, test-framework-quickcheck2
, QuickCheck >= 2.8.2 && < 2.16
, test-framework >= 0.8.2 && < 0.9
, test-framework-quickcheck2 >= 0.3.0.4 && < 0.4

, ogma-language-c

Expand Down
1 change: 1 addition & 0 deletions ogma-language-cocospec/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [1.X.Y] - 2024-12-24

* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
12 changes: 6 additions & 6 deletions ogma-language-cocospec/ogma-language-cocospec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ custom-setup
setup-depends:
base >= 4.11.0.0 && < 5
, Cabal >= 2.0 && < 3.9
, process
, BNFC >= 2.9.1
, process >= 1.6 && < 1.7
, BNFC >= 2.9.1 && < 2.10

library

Expand All @@ -92,7 +92,7 @@ library

build-depends:
base >= 4.11.0.0 && < 5
, array >= 0.5.2.0
, array >= 0.5.2.0 && < 0.6

hs-source-dirs:
src
Expand All @@ -109,9 +109,9 @@ test-suite unit-tests

build-depends:
base >= 4.11.0.0 && < 5
, QuickCheck
, test-framework
, test-framework-quickcheck2
, QuickCheck >= 2.8.2 && < 2.16
, test-framework >= 0.8.2 && < 0.9
, test-framework-quickcheck2 >= 0.3.0.4 && < 0.4

, ogma-language-cocospec

Expand Down
1 change: 1 addition & 0 deletions ogma-language-jsonspec/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [1.X.Y] - 2024-12-24

* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
6 changes: 3 additions & 3 deletions ogma-language-jsonspec/ogma-language-jsonspec.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ library
base >= 4.11.0.0 && < 5
, aeson >= 2.0.0.0 && < 2.2
, jsonpath >= 0.3 && < 0.4
, text
, megaparsec
, bytestring
, text >= 1.2.3.1 && < 2.1
, megaparsec >= 8.0.0 && < 9.10
, bytestring >= 0.10.8.2 && < 0.13

, ogma-spec >= 1.5.0 && < 1.6

Expand Down
1 change: 1 addition & 0 deletions ogma-language-smv/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [1.X.Y] - 2024-12-24

* Add repository information to cabal package (#148).
* Add version bounds to all dependencies (#119).

## [1.5.0] - 2024-11-21

Expand Down
12 changes: 6 additions & 6 deletions ogma-language-smv/ogma-language-smv.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ custom-setup
setup-depends:
base >= 4.11.0.0 && < 5
, Cabal >= 2.0 && < 3.9
, process
, BNFC >= 2.9.1
, process >= 1.6 && < 1.7
, BNFC >= 2.9.1 && < 2.10

library

Expand All @@ -93,7 +93,7 @@ library

build-depends:
base >= 4.11.0.0 && < 5
, array >= 0.5.2.0
, array >= 0.5.2.0 && < 0.6

hs-source-dirs:
src
Expand All @@ -110,9 +110,9 @@ test-suite unit-tests

build-depends:
base >= 4.11.0.0 && < 5
, QuickCheck
, test-framework
, test-framework-quickcheck2
, QuickCheck >= 2.8.2 && < 2.16
, test-framework >= 0.8.2 && < 0.9
, test-framework-quickcheck2 >= 0.3.0.4 && < 0.4

, ogma-language-smv

Expand Down

0 comments on commit 089ed5a

Please sign in to comment.