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

Fix ebuild output in the presence of || in build-depends #127

Open
hololeap opened this issue Dec 26, 2022 · 2 comments · May be fixed by #132
Open

Fix ebuild output in the presence of || in build-depends #127

hololeap opened this issue Dec 26, 2022 · 2 comments · May be fixed by #132
Labels

Comments

@hololeap
Copy link
Member

Currently, hackport is generating invalid ebuilds in the presence of || in the .cabal file's dependency constraints.


Here is an example with aeson-extra-0.5.1.1:

  • .cabal file:

    library
      hs-source-dirs:   src
      ghc-options:      -Wall
      build-depends:
          aeson                  >=1.5.4.1  && <1.6 || >=2.0 && <2.2
        , attoparsec             >=0.11.3.4 && <0.15
        , base                   >=4.7      && <4.18
        , base-compat-batteries  >=0.11.2   && <0.13
        , bytestring             >=0.10     && <0.12
        , deepseq                >=1.3      && <1.5
        , recursion-schemes      >=4.1.2    && <5.3
        , scientific             >=0.3      && <0.4
        , semialign              >=1        && <1.3
        , template-haskell       >=2.8      && <2.20
        , text                   >=1.2      && <1.3 || >=2.0 && <2.1
        , these                  >=1        && <1.2
        , unordered-containers   >=0.2      && <0.3
        , vector                 >=0.10     && <0.14
  • Generated RDEPEND:

    RDEPEND=">=dev-haskell/attoparsec-0.11.3.4:=[profile?] <dev-haskell/attoparsec-0.15:=[profile?]
    	>=dev-haskell/base-compat-batteries-0.11.2:=[profile?] <dev-haskell/base-compat-batteries-0.13:=[profile?]
    	>=dev-haskell/recursion-schemes-4.1.2:=[profile?] <dev-haskell/recursion-schemes-5.3:=[profile?]
    	>=dev-haskell/scientific-0.3:=[profile?] <dev-haskell/scientific-0.4:=[profile?]
    	>=dev-haskell/semialign-1:=[profile?] <dev-haskell/semialign-1.3:=[profile?]
    	>=dev-haskell/these-1:=[profile?] <dev-haskell/these-1.2:=[profile?]
    	>=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
    	>=dev-haskell/vector-0.10:=[profile?] <dev-haskell/vector-0.14:=[profile?]
    	>=dev-lang/ghc-8.4.3:=
    	|| ( ( >=dev-haskell/aeson-1.5.4.1:=[profile?] <dev-haskell/aeson-1.6:=[profile?] )
    		( >=dev-haskell/aeson-2.0:=[profile?] <dev-haskell/aeson-2.2:=[profile?] ) )
    "
  • pkgcheck scan output:

     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: DEPEND="<dev-haskell/aeson-1.6:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: DEPEND="<dev-haskell/aeson-2.2:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: DEPEND=">=dev-haskell/aeson-1.5.4.1:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: DEPEND=">=dev-haskell/aeson-2.0:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: RDEPEND="<dev-haskell/aeson-1.6:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: RDEPEND="<dev-haskell/aeson-2.2:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: RDEPEND=">=dev-haskell/aeson-1.5.4.1:=[profile?]"
     BadDependency: version 0.5.1.1: = slot operator used
    inside || block: RDEPEND=">=dev-haskell/aeson-2.0:=[profile?]"
    
@hololeap hololeap added the bug label Dec 26, 2022
@hololeap
Copy link
Member Author

This only affects dependency atoms using the = operator slot, which are only output to RDEPEND (library dependencies but not test-suite dependencies in the .cabal file).

A trick is to list the version constraints and slot operator separately:

diff --git a/dev-haskell/aeson-extra/aeson-extra-0.5.1.1.ebuild b/dev-haskell/aeson-extra/aeson-extra-0.5.1.1.ebuild
index 141caa6146..65b9474275 100644
--- a/dev-haskell/aeson-extra/aeson-extra-0.5.1.1.ebuild
+++ b/dev-haskell/aeson-extra/aeson-extra-0.5.1.1.ebuild
@@ -26,8 +26,9 @@ RDEPEND=">=dev-haskell/attoparsec-0.11.3.4:=[profile?] <dev-haskell/attoparsec-0
        >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
        >=dev-haskell/vector-0.10:=[profile?] <dev-haskell/vector-0.14:=[profile?]
        >=dev-lang/ghc-8.4.3:=
-       || ( ( >=dev-haskell/aeson-1.5.4.1:=[profile?] <dev-haskell/aeson-1.6:=[profile?] )
-               ( >=dev-haskell/aeson-2.0:=[profile?] <dev-haskell/aeson-2.2:=[profile?] ) )
+       || ( ( >=dev-haskell/aeson-1.5.4.1[profile?] <dev-haskell/aeson-1.6[profile?] )
+               ( >=dev-haskell/aeson-2.0[profile?] <dev-haskell/aeson-2.2[profile?] ) )
+       dev-haskell/aeson:=
 "
 DEPEND="${RDEPEND}
        >=dev-haskell/cabal-2.2.0.1

Writing it like this retains the wanted semantics and does not trigger the error.

@hololeap
Copy link
Member Author

Duplicate of #58

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

Successfully merging a pull request may close this issue.

1 participant