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

EAPI=8

# ebuild generated by hackport 0.8.5.1.9999
#hackport: flags: -test-pretty-exceptions

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

DESCRIPTION="Content addressable Haskell package management"
HOMEPAGE="https://github.com/commercialhaskell/pantry#readme"

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

PATCHES=(
	"${FILESDIR}/${PN}-0.9.3.2-disable-network-tests.patch"
)

RDEPEND="dev-haskell/aeson:=[profile?]
	>=dev-haskell/aeson-warning-parser-0.1.1:=[profile?]
	dev-haskell/ansi-terminal:=[profile?]
	>=dev-haskell/cabal-3:=[profile?] <dev-haskell/cabal-3.11:=[profile?]
	>=dev-haskell/casa-client-0.0.2:=[profile?]
	dev-haskell/casa-types:=[profile?]
	dev-haskell/companion:=[profile?]
	dev-haskell/conduit:=[profile?]
	dev-haskell/conduit-extra:=[profile?]
	dev-haskell/crypton:=[profile?]
	dev-haskell/crypton-conduit:=[profile?]
	dev-haskell/digest:=[profile?]
	dev-haskell/filelock:=[profile?]
	dev-haskell/generic-deriving:=[profile?]
	dev-haskell/hackage-security:=[profile?]
	>=dev-haskell/hpack-0.35.3:=[profile?]
	dev-haskell/http-client:=[profile?]
	>=dev-haskell/http-client-tls-0.3.6.2:=[profile?]
	dev-haskell/http-conduit:=[profile?]
	>=dev-haskell/http-download-0.2.1.0:=[profile?]
	dev-haskell/http-types:=[profile?]
	dev-haskell/memory:=[profile?]
	dev-haskell/network-uri:=[profile?]
	dev-haskell/path:=[profile?]
	dev-haskell/path-io:=[profile?]
	dev-haskell/persistent:=[profile?]
	>=dev-haskell/persistent-sqlite-2.9.3:=[profile?]
	dev-haskell/persistent-template:=[profile?]
	dev-haskell/primitive:=[profile?]
	dev-haskell/resourcet:=[profile?]
	dev-haskell/rio:=[profile?]
	dev-haskell/rio-orphans:=[profile?]
	>=dev-haskell/rio-prettyprint-0.1.7.0:=[profile?]
	dev-haskell/static-bytes:=[profile?]
	>=dev-haskell/tar-conduit-0.4.1:=[profile?]
	dev-haskell/text:=[profile?]
	dev-haskell/text-metrics:=[profile?]
	dev-haskell/unix-compat:=[profile?]
	dev-haskell/unliftio:=[profile?]
	dev-haskell/unordered-containers:=[profile?]
	dev-haskell/vector:=[profile?]
	dev-haskell/yaml:=[profile?]
	dev-haskell/zip-archive:=[profile?]
	>=dev-lang/ghc-9.0.2:=
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-3.4.1.0
	test? ( dev-haskell/hedgehog
		dev-haskell/hspec
		dev-haskell/quickcheck
		dev-haskell/raw-strings-qq )
"

src_prepare() {
	# These modules are full of tests that depend on network access
	for t in Cabal GlobalHints Hackage Tree; do
		rm "${S}/test/Pantry/${t}Spec.hs" || die
	done

	haskell-cabal_src_prepare
}

src_configure() {
	haskell-cabal_src_configure \
		--flag=-test-pretty-exceptions
}