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

cabal: fix upload to hackage #1532

Merged
merged 2 commits into from
May 19, 2020

Conversation

steve-chavez
Copy link
Member

When doing:

cabal upload dist-newstyle/sdist/postgrest-7.0.1.tar.gz

The following error is shown:

Error: Invalid package

'ghc-options: -Wall -Werror' makes the package very easy to break with
future GHC versions because new GHC versions often add new warnings.
Use just 'ghc-options: -Wall' instead. Alternatively, if you want to
use this, make it conditional based on a Cabal configuration flag
(with 'manual: True' and 'default: False') and enable that flag
during development.

Put -Werror in a cabal flag to work around this restriction.

When doing:

```
cabal upload dist-newstyle/sdist/postgrest-7.0.1.tar.gz
```

The following error is shown:

```
Error: Invalid package

'ghc-options: -Wall -Werror' makes the package very easy to break with
future GHC versions because new GHC versions often add new warnings.
Use just 'ghc-options: -Wall' instead. Alternatively, if you want to
use this, make it conditional based on a Cabal configuration flag
(with 'manual: True' and 'default: False') and enable that flag
during development.
```

Put -Werror in a cabal flag to work around this restriction.
@steve-chavez
Copy link
Member Author

@monacoremo How can I pass an arg to callCaball2nix?

With plain cabal it would be like:

cabal v2-build -f werror 

I'm guessing the last set here should be used, but not sure how.

For reference, see https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/make-package-set.nix#L216.

@monacoremo
Copy link
Member

@steve-chavez There is a callCabal2nixWithOptions, but I think in this case it would be best to use something like lib.appendConfigureFlag to pass a ghc flag.

So a quick fix would be something like:

drv =
  lib.appendConfigureFlag (pkgs.haskellPackages.callCabal2nix name src {}) "-ghc-option=-Werror";

Looking at this, I just found failOnAllWarnings. So the best solution probably is:

drv =
  lib.failOnAllWarnings (pkgs.haskellPackages.callCabal2nix name src {});

@steve-chavez
Copy link
Member Author

@monacoremo Thanks!

I ended up using enableCabalFlag. I wanted to keep the cabal file as the source of truth. That way stack and nix would use the same ghc-options. Could be helpful in case we change something in the future.

@steve-chavez steve-chavez merged commit 67344c8 into PostgREST:master May 19, 2020
monacoremo pushed a commit to monacoremo/postgrest that referenced this pull request Jul 17, 2021
When doing:

```
cabal upload dist-newstyle/sdist/postgrest-7.0.1.tar.gz
```

The following error is shown:

```
Error: Invalid package

'ghc-options: -Wall -Werror' makes the package very easy to break with
future GHC versions because new GHC versions often add new warnings.
Use just 'ghc-options: -Wall' instead. Alternatively, if you want to
use this, make it conditional based on a Cabal configuration flag
(with 'manual: True' and 'default: False') and enable that flag
during development.
```

Put -Werror in a cabal flag to work around this restriction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants