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

Better handle new package names #67

Open
l29ah opened this issue Jul 1, 2020 · 11 comments
Open

Better handle new package names #67

l29ah opened this issue Jul 1, 2020 · 11 comments
Labels

Comments

@l29ah
Copy link
Member

l29ah commented Jul 1, 2020

It generates it as dev-haskell/ghc while ghc lives in dev-lang. For example, try hint package from hackage.

@solpeth
Copy link
Member

solpeth commented Jul 1, 2020

Can you please post the generated ebuild? Mine generated correctly.

@l29ah
Copy link
Member Author

l29ah commented Jul 2, 2020

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

EAPI=7

# ebuild generated by hackport 0.6.5.9999

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

DESCRIPTION="Runtime Haskell interpreter (GHC API wrapper)"
HOMEPAGE="https://github.com/haskell-hint/hint"
SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND=">=dev-haskell/exceptions-0.10:=[profile?] <dev-haskell/exceptions-0.11:=[profile?]
	>=dev-haskell/ghc-8.4:=[profile?] <dev-haskell/ghc-8.11:=[profile?]
	dev-haskell/ghc-paths:=[profile?]
	dev-haskell/random:=[profile?]
	dev-haskell/temporary:=[profile?]
	>=dev-lang/ghc-8.0.1:=
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-1.24.0.0
	test? ( >=dev-haskell/exceptions-0.10.0
		dev-haskell/hunit
		dev-haskell/stm )
"

@solpeth
Copy link
Member

solpeth commented Jul 2, 2020

Very odd. I'm on the same hackport version and don't have this issue. I'll keep an eye on it. Let me know if it occurs with other packages.

I suspect it's trying to generate a dependency on dev-haskell/ghc-api but I don't think we handle that conversion in hackport.

@trofi
Copy link
Contributor

trofi commented Jul 2, 2020

Which hlint version is that? Can you attach actual .cabal file used? (And while at it verify that hackport make-ebuild also generates wrong dependency).

@l29ah
Copy link
Member Author

l29ah commented Jul 2, 2020

This is not hlint, but hint-0.9.0.3, fetched from up-to-date hackage automagically.
https://hackage.haskell.org/package/hint-0.9.0.3/hint.cabal

@l29ah
Copy link
Member Author

l29ah commented Jul 2, 2020

Yes, make-ebuild generates the same.

@trofi
Copy link
Contributor

trofi commented Jul 3, 2020

Let's inline .cabal file here as hackage's one ends to change over time:

name:         hint
version:      0.9.0.3
description:
        This library defines an Interpreter monad. It allows to load Haskell
        modules, browse them, type-check and evaluate strings with Haskell
        expressions and even coerce them into values. The library is thread-safe
        and type-safe (even the coercion of expressions to values).

        It is, essentially, a huge subset of the GHC API wrapped in a simpler
        API.

synopsis:     Runtime Haskell interpreter (GHC API wrapper)
category:     Language, Compilers/Interpreters
license:      BSD3
license-file: LICENSE
author:       The Hint Authors
maintainer:   [email protected]
homepage:     https://github.com/haskell-hint/hint

cabal-version: >= 1.9.2
build-type:    Simple

extra-source-files: README.md
                    AUTHORS
                    CHANGELOG.md
                    examples/example.hs
                    examples/SomeModule.hs

source-repository head
  type:     git
  location: https://github.com/haskell-hint/hint

test-suite unit-tests
  type:           exitcode-stdio-1.0
  hs-source-dirs: unit-tests
  main-is:        run-unit-tests.hs

  build-depends:  base == 4.*,
                  hint,
                  HUnit,
                  directory,
                  filepath,
                  exceptions >= 0.10.0,
                  stm,

                  -- packages used by setImports calls
                  containers

  if impl(ghc >= 8.10) {
      cpp-options: -DTHREAD_SAFE_LINKER
  }

  if !os(windows) {
      build-depends: unix >= 2.2.0.0
  }

  extensions:  CPP

library
  build-depends: base == 4.*,
                 ghc >= 8.4 && < 8.11,
                 ghc-paths,
                 ghc-boot,
                 transformers,
                 filepath,
                 exceptions == 0.10.*,
                 random,
                 directory,
                 temporary

  if impl(ghc >= 8.10) {
      cpp-options: -DTHREAD_SAFE_LINKER
  }

  if !os(windows) {
      build-depends: unix >= 2.2.0.0
  }

  exposed-modules: Language.Haskell.Interpreter
                   Language.Haskell.Interpreter.Extension
                   Language.Haskell.Interpreter.Unsafe
                   Hint.Internal
  other-modules:   Hint.GHC
                   Hint.Base
                   Hint.InterpreterT
                   Hint.CompatPlatform
                   Hint.Configuration
                   Hint.Extension
                   Hint.Context
                   Hint.Conversions
                   Hint.Eval
                   Hint.Parsers
                   Hint.Reflection
                   Hint.Typecheck
                   Hint.Util
                   Hint.Annotations
                   Control.Monad.Ghc

  hs-source-dirs: src

  ghc-options: -Wall
  extensions:  CPP
               GeneralizedNewtypeDeriving
               DeriveDataTypeable
               MagicHash
               FunctionalDependencies
               Rank2Types
               ScopedTypeVariables
               ExistentialQuantification
               LambdaCase

@trofi
Copy link
Contributor

trofi commented Jul 3, 2020

I can't reproduce the failure either.

Please provide a few details:

  • post full output of hackport make-ebuild -v3 dev-haskell hint.cabal
  • specify version of hackport you are using
  • specify version of ghc you are using

@l29ah
Copy link
Member Author

l29ah commented Jul 3, 2020

∞ hackport -p /tmp/ make-ebuild -v3 dev-haskell hint.cabal 
Forced /tmp/
searching for minimal suitable ghc version
rejecting dep: ghc-7.4.1 as ["ghc-boot -any","transformers -any"] were not found.
rejecting dep: ghc-7.4.2 as ["ghc-boot -any","transformers -any"] were not found.
rejecting dep: ghc-7.6.2 as ["ghc-boot -any","transformers -any"] were not found.
rejecting dep: ghc-7.8.2 as ["ghc-boot -any"] were not found.
rejecting dep: ghc-7.10.1 as ["ghc-boot -any"] were not found.
rejecting dep: ghc-7.10.2 as ["ghc-boot -any"] were not found.
accepting dep: ghc-8.0.1
buildDepends pkgDesc0 raw: cabal-version: >=1.9.2
name: hint
version: 0.9.0.3
license: BSD3
license-file: LICENSE
maintainer: [email protected]
author: The Hint Authors
homepage: https://github.com/haskell-hint/hint
synopsis: Runtime Haskell interpreter (GHC API wrapper)
description:
This library defines an Interpreter monad. It allows to load Haskell
modules, browse them, type-check and evaluate strings with Haskell
expressions and even coerce them into values. The library is thread-safe
and type-safe (even the coercion of expressions to values).
It is, essentially, a huge subset of the GHC API wrapped in a simpler
API.

category: Language, Compilers/Interpreters
build-type: Simple
extra-source-files:
README.md
AUTHORS
CHANGELOG.md
examples/example.hs
examples/SomeModule.hs

source-repository head
type: git
location: https://github.com/haskell-hint/hint

library
exposed-modules:
Language.Haskell.Interpreter
Language.Haskell.Interpreter.Extension
Language.Haskell.Interpreter.Unsafe
Hint.Internal

hs-source-dirs: src
other-modules:
Hint.GHC
Hint.Base
Hint.InterpreterT
Hint.CompatPlatform
Hint.Configuration
Hint.Extension
Hint.Context
Hint.Conversions
Hint.Eval
Hint.Parsers
Hint.Reflection
Hint.Typecheck
Hint.Util
Hint.Annotations
Control.Monad.Ghc

extensions:
CPP GeneralizedNewtypeDeriving DeriveDataTypeable MagicHash
FunctionalDependencies Rank2Types ScopedTypeVariables
ExistentialQuantification LambdaCase

ghc-options: -Wall
build-depends:
base ==4.*,
directory -any,
exceptions ==0.10.*,
filepath -any,
ghc >=8.4 && <8.11,
ghc-boot -any,
ghc-paths -any,
random -any,
temporary -any,
transformers -any,
unix >=2.2.0.0

test-suite unit-tests
type: exitcode-stdio-1.0
main-is: run-unit-tests.hs
hs-source-dirs: unit-tests
extensions: CPP
build-depends:
HUnit -any,
base ==4.*,
containers -any,
directory -any,
exceptions >=0.10.0,
filepath -any,
hint -any,
stm -any,
unix >=2.2.0.0
buildDepends pkgDesc0: ["base ==4.*","directory -any","exceptions
==0.10.*","filepath -any","ghc >=8.4 && <8.11","ghc-boot -any","ghc-paths
-any","random -any","temporary -any","transformers -any","unix >=2.2.0.0"]
buildDepends pkgDesc: ["exceptions ==0.10.*","ghc >=8.4 && <8.11","ghc-paths
-any","random -any","temporary -any"]
Accepted depends: ["exceptions ==0.10.*","ghc >=8.4 && <8.11","ghc-paths
-any","random -any","temporary -any"]
Skipped depends: ["base ==4.*","directory -any","filepath -any","ghc-boot
-any","transformers -any","unix >=2.2.0.0"]
Dead flags: []
Dropped flags: []
Active flags: []
Irrelevant flags: []
Excluded packages (comes with ghc): array
Excluded packages (comes with ghc): base
Excluded packages (comes with ghc): binary
Excluded packages (comes with ghc): bytestring
Excluded packages (comes with ghc): containers
Excluded packages (comes with ghc): deepseq
Excluded packages (comes with ghc): directory
Excluded packages (comes with ghc): filepath
Excluded packages (comes with ghc): ghc-boot
Excluded packages (comes with ghc): ghc-prim
Excluded packages (comes with ghc): ghci
Excluded packages (comes with ghc): hoopl
Excluded packages (comes with ghc): hpc
Excluded packages (comes with ghc): integer-gmp
Excluded packages (comes with ghc): pretty
Excluded packages (comes with ghc): process
Excluded packages (comes with ghc): template-haskell
Excluded packages (comes with ghc): time
Excluded packages (comes with ghc): transformers
Excluded packages (comes with ghc): unix
Current keywords: Nothing -> ["~amd64","~x86"]
Current license: Nothing -> Right "BSD"
Writing hint-0.9.0.3.ebuild
Writing metadata.xml

today's 9999
8.10.1

@trofi
Copy link
Contributor

trofi commented Jul 3, 2020

hackport -p /tmp/ make-ebuild -v3 dev-haskell hint.cabal

hackport tries to resolve hackage names to gentoo names by matching against known package names seen in overlay regardless of the category. If it has no ghc there it considers that to be an unknown package and fails. This scheme has it's negative side-effects like finding new packages at random locations if you run it against ::gentoo

There are a few things we can do here:

  1. at the very least we should print warnings about new packages not seen before
  2. pin ghc to dev-lang/ category
  3. pin all packages to dev-haskell/ category unless there is an override that specifies otherwise.

@trofi
Copy link
Contributor

trofi commented Jul 3, 2020

Meanwhile you either need to fix the generated dependency manually or point hackport to an overlay with ghc package name.

@hololeap hololeap added the bug label Sep 4, 2022
@hololeap hololeap changed the title hackport fails at generating ghc dep Better handle new package names Dec 26, 2022
@hololeap hololeap added feature and removed bug labels Dec 26, 2022
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

4 participants