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

Dependencies for cryptonite are not being generated #116

Open
hololeap opened this issue Sep 4, 2022 · 6 comments
Open

Dependencies for cryptonite are not being generated #116

hololeap opened this issue Sep 4, 2022 · 6 comments
Labels

Comments

@hololeap
Copy link
Member

hololeap commented Sep 4, 2022

# hackport merge cryptonite

generated cryptonite-0.30.0.ebuild:

# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# ebuild generated by hackport 0.7.2.2.9999
#hackport: flags: -check_alignment,-old_toolchain_inliner,+support_deepseq,support_aesni:cpu_flags_x86_aes,support_pclmuldq:cpu_flags_x86_sse4_1,support_sse:cpu_flags_x86_sse,support_rdrand:cpu_flags_x86_rdrand

CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal

DESCRIPTION="Cryptography Primitives sink"
HOMEPAGE="https://github.com/haskell-crypto/cryptonite"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE="+cpu_flags_x86_aes +cpu_flags_x86_rdrand cpu_flags_x86_sse cpu_flags_x86_sse4_1 +integer-gmp +target-attributes"

RDEPEND=">=dev-lang/ghc-8.4.3:=
        virtual/libc
"
DEPEND="${RDEPEND}
        >=dev-haskell/cabal-2.2.0.1
        test? ( dev-haskell/memory
                dev-haskell/tasty
                dev-haskell/tasty-hunit
                dev-haskell/tasty-kat
                dev-haskell/tasty-quickcheck )
"

src_configure() {
        haskell-cabal_src_configure \
                --flag=-check_alignment \
                $(cabal_flag integer-gmp integer-gmp) \
                --flag=-old_toolchain_inliner \
                $(cabal_flag cpu_flags_x86_aes support_aesni) \
                --flag=support_deepseq \
                $(cabal_flag cpu_flags_x86_sse4_1 support_pclmuldq) \
                $(cabal_flag cpu_flags_x86_rdrand support_rdrand) \
                $(cabal_flag cpu_flags_x86_sse support_sse) \
                $(cabal_flag target-attributes use_target_attributes)
}

This should be adding memory and basement to RDEPEND as you can see in the .cabal file:

  Build-depends:     bytestring
                   , memory >= 0.14.18
                   , basement >= 0.0.6
                   , ghc-prim

Could it have something to do with this conditional Buildable: False in the library stanza?

  if impl(ghc < 8.8)
    Buildable: False
  else
    Build-depends:   base

Related: gentoo-haskell/gentoo-haskell#1324

@hololeap
Copy link
Member Author

hololeap commented Sep 4, 2022

Yep, it works fine if you take that stuff out:

diff -urN cryptonite-0.30/cryptonite.cabal cryptonite-0.30-r1/cryptonite.cabal
--- cryptonite-0.30/cryptonite.cabal    2022-09-04 15:57:21.239133464 -0600
+++ cryptonite-0.30-r1/cryptonite.cabal 2022-09-04 15:56:28.329133438 -0600
@@ -245,12 +245,9 @@
                      Crypto.Internal.Nat
                      Crypto.Internal.Words
                      Crypto.Internal.WordArray
-  if impl(ghc < 8.8)
-    Buildable: False
-  else
-    Build-depends:   base
 
-  Build-depends:     bytestring
+  Build-depends:     base
+                   , bytestring
                    , memory >= 0.14.18
                    , basement >= 0.0.6
                    , ghc-prim
# hackport make-ebuild dev-haskell /tmp/cryptonite-0.30-r1/cryptonite.cabal

generated cryptonite-0.30.ebuild:

# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# ebuild generated by hackport 0.7.2.2.9999
#hackport: flags: -check_alignment,-old_toolchain_inliner,+support_deepseq,support_aesni:cpu_flags_x86_aes,support_pclmuldq:cpu_flags_x86_sse4_1,support_sse:cpu_flags_x86_sse,support_rdrand:cpu_flags_x86_rdrand

CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal

DESCRIPTION="Cryptography Primitives sink"
HOMEPAGE="https://github.com/haskell-crypto/cryptonite"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE="+cpu_flags_x86_aes +cpu_flags_x86_rdrand cpu_flags_x86_sse cpu_flags_x86_sse4_1 +integer-gmp +target-attributes"

RDEPEND=">=dev-haskell/basement-0.0.6:=[profile?]
        >=dev-haskell/memory-0.14.18:=[profile?]
        >=dev-lang/ghc-8.4.3:=
        virtual/libc
"
DEPEND="${RDEPEND}
        >=dev-haskell/cabal-2.2.0.1
        test? ( dev-haskell/tasty
                dev-haskell/tasty-hunit
                dev-haskell/tasty-kat
                dev-haskell/tasty-quickcheck )
"

src_configure() {
        haskell-cabal_src_configure \
                --flag=-check_alignment \
                $(cabal_flag integer-gmp integer-gmp) \
                --flag=-old_toolchain_inliner \
                $(cabal_flag cpu_flags_x86_aes support_aesni) \
                --flag=support_deepseq \
                $(cabal_flag cpu_flags_x86_sse4_1 support_pclmuldq) \
                $(cabal_flag cpu_flags_x86_rdrand support_rdrand) \
                $(cabal_flag cpu_flags_x86_sse support_sse) \
                $(cabal_flag target-attributes use_target_attributes)
}

@hololeap
Copy link
Member Author

hololeap commented Sep 4, 2022

It is also worth mentioning the virtual/libc in RDEPEND seems pointless.

(New bug: #117)

@hololeap
Copy link
Member Author

hololeap commented Sep 4, 2022

It looks like this bug also stems from a conditional buildable: False in the .cabal file:

    if impl(ghc < 8.6)
        buildable: False

@hololeap
Copy link
Member Author

hololeap commented Sep 5, 2022

Also seems related:

The problem is not in multiple stanzas, but in a version-specific guard:

  if !impl(ghc >=8.0)
    buildable: False

hackport starts off with ghc-7 and settles on an older ghc version with subset of tests disabled.

#81 (comment)

@hololeap hololeap pinned this issue Oct 21, 2022
hololeap added a commit to gentoo-haskell/gentoo-haskell that referenced this issue Jul 28, 2023
Hackport did not add the dependencies correctly. The fix was to manually
edit the .cabal file like so (and then run `hackport make-ebuild ...`):

@@ -23,10 +23,6 @@

 library
     import:           warnings
-    if impl(ghc < 9.2)
-      buildable: False
-    else
-      buildable: True
     exposed-modules:  Ide.Plugin.OverloadedRecordDot
     build-depends:
       , base                  >=4.16 && <5
@@ -47,10 +43,6 @@

 test-suite tests
     import:           warnings
-    if impl(ghc < 9.2)
-      buildable: False
-    else
-      buildable: True
     default-language: GHC2021
     type:             exitcode-stdio-1.0
     hs-source-dirs:   test

Bug: gentoo-haskell/hackport#116
Bug: #1465
Signed-off-by: hololeap <[email protected]>
hololeap added a commit that referenced this issue Jul 28, 2023
The added code checks for any unbuildable components. For libraries, it
throws an error. For executables and test-suites, it creates a warning
that will be displayed at the end.

Bug: #116
Signed-off-by: hololeap <[email protected]>
hololeap added a commit that referenced this issue Jul 28, 2023
Old versions are not used and could cause issues when the minimum GHC
version is chosen.

If the chosen GHC version is too old, `if impl(ghc<X)` expressions in
the .cabal file could lead to unexpected results.

Bug: #116
Signed-off-by: hololeap <[email protected]>
hololeap added a commit to hololeap/hackport that referenced this issue Jul 28, 2023
The added code checks for any unbuildable components. For libraries, it
throws an error. For executables and test-suites, it creates a warning
that will be displayed at the end.

Bug: gentoo-haskell#116
Signed-off-by: hololeap <[email protected]>
@hololeap
Copy link
Member Author

hololeap commented Jul 28, 2023

f4cf447 addresses the most egregious case, where an entire library in a package is marked with buildable: False (usually inside if impl(ghc<X)). It will now throw an error if a library is marked unbuildable and display a warning for executables and test-suites.

hololeap added a commit that referenced this issue Jul 28, 2023
Old versions are not used and could cause issues when the minimum GHC
version is chosen.

If the chosen GHC version is too old, `if impl(ghc<X)` expressions in
the .cabal file could lead to unexpected results.

Bug: #116
Signed-off-by: hololeap <[email protected]>
@hololeap
Copy link
Member Author

hololeap commented Jul 28, 2023

dd883f1 raises the minimum version of GHC that hackport will consider.

Many of these if impl(ghc<X) expressions in .cabal files are strictly for compatibility with old versions of GHC. If hackport chooses a version of GHC that is too old, the ebuild will be generated based off this version of GHC and may pull in dependencies that are meant as compatibility options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant