jwiegley / gitlib

180 stars 56 forks source link

Gitlib still marked as broken in nixpkgs #87

Closed NorfairKing closed 5 years ago

NorfairKing commented 5 years ago

It seems that it was once marked as broken: https://github.com/NixOS/nixpkgs/search?q=gitlib&type=Commits Is it still broken? Is there currently a way to use gitlib and gitlib-libgit2 using nix?

jwiegley commented 5 years ago

Given that I've been using both with Nix for years, I hope so.:) Have you tried marking it unbroken and building, say, git-monitor?

NorfairKing commented 5 years ago

I haven't tried marking it unbroken but I've tried using config.allowBroken = true; and then I get this:

Preprocessing library for gitlib-test-3.1.1..
Building library for gitlib-test-3.1.1..
[1 of 1] Compiling Git.Smoke        ( Git/Smoke.hs, dist/build/Git/Smoke.o )

Git/Smoke.hs:225:7: error:
    • Could not deduce (Control.Monad.Fail.MonadFail m)
        arising from a do statement
        with the failable pattern ‘Just c3’
      from the context: (MonadGit r m, MonadUnliftIO m, MonadGit s n,
                         MonadUnliftIO n)
        bound by the type signature for:
                   smokeTestSpec :: forall r (m :: * -> *) s (n :: * -> *).
                                    (MonadGit r m, MonadUnliftIO m, MonadThrow m, MonadGit s n,
                                     MonadUnliftIO n, MonadThrow n) =>
                                    RepositoryFactory m IO r -> RepositoryFactory n m s -> Spec
        at Git/Smoke.hs:(37,1)-(41,21)
      Possible fix:
        add (Control.Monad.Fail.MonadFail m) to the context of
          the type signature for:
            smokeTestSpec :: forall r (m :: * -> *) s (n :: * -> *).
                             (MonadGit r m, MonadUnliftIO m, MonadThrow m, MonadGit s n,
                              MonadUnliftIO n, MonadThrow n) =>
                             RepositoryFactory m IO r -> RepositoryFactory n m s -> Spec
    • In a stmt of a 'do' block:
        Just c3 <- resolveReference "refs/heads/master"
      In the second argument of ‘($)’, namely
        ‘do hello <- createBlobUtf8 "Hello, world!\n"
            tr <- createTree $ putBlob "hello/world.txt" hello
            goodbye <- createBlobUtf8 "Goodbye, world!\n"
            tr <- mutateTreeOid tr $ putBlob "goodbye/files/world.txt" goodbye
            ....’
      In the second argument of ‘($)’, namely
        ‘withNewRepository pr "createTwoCommits.git"
           $ do hello <- createBlobUtf8 "Hello, world!\n"
                tr <- createTree $ putBlob "hello/world.txt" hello
                goodbye <- createBlobUtf8 "Goodbye, world!\n"
                tr <- mutateTreeOid tr $ putBlob "goodbye/files/world.txt" goodbye
                ....’
    |
225 |       Just c3 <- resolveReference "refs/heads/master"
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
builder for '/nix/store/y4k4k0nrph9kk51m6hgnvk1xmfbzc8vr-gitlib-test-3.1.1.drv' failed with exit code 1

This happens with the following nixpkgs version

{
  rev    = "be5594b412e9ba5e52838783e7cac7320625d4ae";
  sha256 = "05vdhjq1cnpjdfd0wb38csdx437wm7fl8jqdvknjv7f2a0mrwd9p";
}
NorfairKing commented 5 years ago

And it's a bit strange, because using stack with the same LTS as that commit of nixpkgs uses, it does work.

jwiegley commented 5 years ago

I see this when I attempt to build that version:

Building library for gitlib-test-3.1.1..
[1 of 1] Compiling Git.Smoke        ( Git/Smoke.hs, /Users/johnw/Products/gitlib/gitlib-test/dist/build/Git/Smoke.o )

Git/Smoke.hs:19:1: warning: [-Wunused-imports]
    The import of ‘Control.Monad.IO.Unlift’ is redundant
      except perhaps to import instances from ‘Control.Monad.IO.Unlift’
    To import instances alone, use: import Control.Monad.IO.Unlift()
   |
19 | import           Control.Monad.IO.Unlift
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Git/Smoke.hs:31:1: warning: [-Wunused-imports]
    The import of ‘Example’ from module ‘Test.Hspec’ is redundant
   |
31 | import           Test.Hspec (Spec, Example, describe, it)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Git/Smoke.hs:463:1: warning: [-Wmissing-signatures]
    Top-level binding with no type signature:
      treeit :: (Example (m ()), MonadGit r n, MonadUnliftIO m,
                 MonadUnliftIO n) =>
                String
                -> RepositoryFactory n m r
                -> [Kind]
                -> TreeT r n a
                -> hspec-core-2.6.1:Test.Hspec.Core.Spec.Monad.SpecWith
                     (hspec-core-2.6.1:Test.Hspec.Core.Example.Arg (m ()))
    |
463 | treeit label pr kinds action = it label $ doTreeit label pr kinds action
    | ^^^^^^
NorfairKing commented 5 years ago

@jwiegley Is it possible that you're compiling a different version of gitlib-test?, see this:

[1 of 1] Compiling Git.Smoke        ( Git/Smoke.hs, /Users/johnw/Products/gitlib/gitlib-test/dist/build/Git/Smoke.o )

versus

[1 of 1] Compiling Git.Smoke        ( Git/Smoke.hs, dist/build/Git/Smoke.o )
jwiegley commented 5 years ago

I'm building from the Git repository; perhaps it's newer than what's in Hackage.

jwiegley commented 5 years ago

I've updated Hackage with what I was building, at version 3.1.2.

NorfairKing commented 5 years ago

Wonderful, now I can do this as soon as gitlib-test-3.1.2 is in stackage and in nixpkgs.

                gitlib = final.haskell.lib.dontCheck (final.haskellPackages.callHackage "gitlib" "3.1.2" {});
                gitlib-libgit2 = final.haskellPackages.callHackage "gitlib-libgit2" "3.1.2.1" {};
                gitlib-test = final.haskellPackages.callHackage "gitlib-test" "3.1.2" {};

In the meantime I can use this:

                gitlib = final.haskell.lib.dontCheck (final.haskellPackages.callHackage "gitlib" "3.1.2" {});
                gitlib-libgit2 = final.haskell.lib.dontCheck (final.haskellPackages.callHackage "gitlib-libgit2" "3.1.2.1" {});

and I'll just have to trust that your tests build and pass.