biscuit-haskell icon indicating copy to clipboard operation
biscuit-haskell copied to clipboard

Package is marked as broken in nixpkgs.haskellPackages

Open ptitfred opened this issue 3 years ago • 5 comments

When trying to build it, it does indeed fail on tests:

$ NIXPKGS_ALLOW_BROKEN=1 nix-build '<nixpkgs>' -A haskellPackages.biscuit-haskell
... truncated ...
Running 1 test suites...
Test suite biscuit-haskell-test: RUNNING...
biscuit-haskell-test: test/samples/v2/samples.json: openBinaryFile: does not exist (No such file or directory)

Test suite biscuit-haskell-test: FAIL

And it is consistent with the content of the source archive built by cabal2nix from the cabal file:

$ tree biscuit-haskell-0.2.1.0/
biscuit-haskell-0.2.1.0/
├── benchmarks
│   └── Bench.hs
├── biscuit-haskell.cabal
├── ChangeLog.md
├── LICENSE
├── README.md
├── Setup.hs
├── src
│   └── Auth
│       ├── Biscuit
│       │   ├── Crypto.hs
│       │   ├── Datalog
│       │   │   ├── AST.hs
│       │   │   ├── Executor.hs
│       │   │   ├── Parser.hs
│       │   │   └── ScopedExecutor.hs
│       │   ├── Example.hs
│       │   ├── ProtoBufAdapter.hs
│       │   ├── Proto.hs
│       │   ├── Symbols.hs
│       │   ├── Timer.hs
│       │   ├── Token.hs
│       │   └── Utils.hs
│       └── Biscuit.hs
└── test
    ├── Spec
    │   ├── Executor.hs
    │   ├── NewCrypto.hs
    │   ├── Parser.hs
    │   ├── Quasiquoter.hs
    │   ├── Roundtrip.hs
    │   ├── SampleReader.hs
    │   ├── ScopedExecutor.hs
    │   └── Verification.hs
    └── Spec.hs

7 directories, 28 files

I'm not yet sure how to properly fix that. I guess we could simply add the test/samples/v2/*.(bc|json) files either to extra-source-files or data-files. I don't have the proper setup to test this hypothesis yet.

ptitfred avatar Sep 09 '22 23:09 ptitfred

I'm volunteering to fixing this issue. Can I be assigned to it?

ptitfred avatar Sep 09 '22 23:09 ptitfred

Note that the archive from hackage itself has the issue (missing test files).

Maybe should we fix that first?

ptitfred avatar Sep 10 '22 00:09 ptitfred

Sure, thanks!

divarvel avatar Sep 10 '22 00:09 divarvel

Ok I can confirm that the cabal upload itself is missing the files, but I can't guarantee it will fix nixpkgs. It can't hurt though.

ptitfred avatar Sep 10 '22 00:09 ptitfred

I've tested with the both original archive from cabal and the one that would be built following merge of #49 and looks like it's working 🎉

My test process:

git checkout fca1c26c4468f1977ea39b3afea0b45942c736ef # before merge of #49 
cabal sdist biscuit-haskell
# upload the tar.gz somewhere accessible via https for cabal2nix
cabal2nix https://.../biscuit-haskell-fca1c26c4.tar.gz > biscuit-haskell-original.nix
git checkout 7baeabd5bf2cb413a0fc2ebf4694055238a8d122 # merge of #49 
cabal sdist biscuit-haskell
# upload the tar.gz somewhere accessible via https for cabal2nix
cabal2nix https://.../biscuit-haskell-7baeabd5bf.tar.gz > biscuit-haskell-candidate.nix

Add an overlay to include both biscuit-haskell versions in an explicit manner:

self: super:
  {
    haskell = super.haskell // {
      packages = super.haskell.packages // {
        ghc902 = super.haskell.packages.ghc902.override {
          overrides = self: super: {
            biscuit-haskell-candidate = self.callPackage ../biscuit-haskell-candidate.nix {};
            biscuit-haskell-original  = self.callPackage ../biscuit-haskell-original.nix  {};
          };
        };
      };
    };
  }

Build each of them, and see the original has the failing test while the candidate is passing it:

$ nix-build '<nixpkgs>' -A haskellPackages.biscuit-haskell-original
... build, truncated ...
buildPhase completed in 1 minutes 40 seconds
running tests
Running 1 test suites...
Test suite biscuit-haskell-test: RUNNING...
generating new
biscuit-haskell-test: test/samples/v2/samples.json: openBinaryFile: does not exist (No such file or directory)

Test suite biscuit-haskell-test: FAIL
Test suite logged to:
dist/test/biscuit-haskell-0.2.1.0-biscuit-haskell-test.log
0 of 1 test suites (0 of 1 test cases) passed.
error: builder for '/nix/store/clxw6ppdsplg4y1hpp9id1m1i1l8k66q-biscuit-haskell-0.2.1.0.drv' failed with exit code 1;
       last 10 log lines:
       > running tests
       > Running 1 test suites...
       > Test suite biscuit-haskell-test: RUNNING...
       > generating new
       > biscuit-haskell-test: test/samples/v2/samples.json: openBinaryFile: does not exist (No such file or directory)
       >
       > Test suite biscuit-haskell-test: FAIL
       > Test suite logged to:
       > dist/test/biscuit-haskell-0.2.1.0-biscuit-haskell-test.log
       > 0 of 1 test suites (0 of 1 test cases) passed.
       For full logs, run 'nix log /nix/store/clxw6ppdsplg4y1hpp9id1m1i1l8k66q-biscuit-haskell-0.2.1.0.drv'.
$ nix-build '<nixpkgs>' -A haskellPackages.biscuit-haskell-candidate
... build, truncated ...
buildPhase completed in 1 minutes 37 seconds
@nix { "action": "setPhase", "phase": "checkPhase" }
running tests
Running 1 test suites...
Test suite biscuit-haskell-test: RUNNING...
Test suite biscuit-haskell-test: PASS
Test suite logged to:
dist/test/biscuit-haskell-0.2.1.0-biscuit-haskell-test.log
1 of 1 test suites (1 of 1 test cases) passed.
@nix { "action": "setPhase", "phase": "haddockPhase" }
haddockPhase
... pursuing with the haddock generation ...

I'm quite confident the next release would fix the build on hydra too.

ptitfred avatar Sep 10 '22 10:09 ptitfred