summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhololeap <hololeap@protonmail.com>2023-11-04 14:34:08 -0600
committerSam James <sam@gentoo.org>2023-11-19 18:32:28 +0000
commita82e6b057b90fd2838c62678163ab18d03082b96 (patch)
treeebadac53ac21688269eb95e451ebda77a1f22852 /dev-haskell/foldl
parentdev-haskell/tagged: Hackage revision bump (diff)
downloadgentoo-a82e6b057b90fd2838c62678163ab18d03082b96.tar.gz
gentoo-a82e6b057b90fd2838c62678163ab18d03082b96.tar.bz2
gentoo-a82e6b057b90fd2838c62678163ab18d03082b96.zip
dev-haskell/foldl: Fix doctests
Change patch so that Setup.hs no longer requires cabal-doctest, but it will use it if it's available. Add dev-haskell/cabal-doctest as a conditional DEPEND if USE=test is enabled. Closes: https://bugs.gentoo.org/916851 Signed-off-by: hololeap <hololeap@protonmail.com> Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-haskell/foldl')
-rw-r--r--dev-haskell/foldl/files/foldl-1.4.15-cabal-doctest.patch116
-rw-r--r--dev-haskell/foldl/foldl-1.4.15.ebuild17
2 files changed, 128 insertions, 5 deletions
diff --git a/dev-haskell/foldl/files/foldl-1.4.15-cabal-doctest.patch b/dev-haskell/foldl/files/foldl-1.4.15-cabal-doctest.patch
new file mode 100644
index 000000000000..6c554607eff5
--- /dev/null
+++ b/dev-haskell/foldl/files/foldl-1.4.15-cabal-doctest.patch
@@ -0,0 +1,116 @@
+From 7dc9bf5a311c56408f5f102c09d36ab127e64b94 Mon Sep 17 00:00:00 2001
+From: hololeap <hololeap@protonmail.com>
+Date: Sat, 4 Nov 2023 14:43:01 -0600
+Subject: [PATCH 1/1] Migrate to cabal-doctest
+
+doctest pulls in the out-of-scope packages if they are installed on the
+system. The best current workaround is to migrate to cabal-doctest.
+
+Bug: https://bugs.gentoo.org/916851
+Signed-off-by: hololeap <hololeap@protonmail.com>
+---
+ Setup.hs | 17 +++++++++++++++++
+ foldl.cabal | 13 +++++++++++--
+ test/doctest.hs | 29 +++++++++++++++++++++++++++--
+ 3 files changed, 55 insertions(+), 4 deletions(-)
+
+diff --git a/Setup.hs b/Setup.hs
+index 9a994af..f21ad76 100644
+--- a/Setup.hs
++++ b/Setup.hs
+@@ -1,2 +1,19 @@
++{-# LANGUAGE CPP #-}
++
++module Main (main) where
++
++#if MIN_VERSION_cabal_doctest(1,0,0)
++
++import Distribution.Extra.Doctest ( defaultMainWithDoctests )
++
++main :: IO ()
++main = defaultMainWithDoctests "doctest"
++
++#else
++
+ import Distribution.Simple
++
++main :: IO ()
+ main = defaultMain
++
++#endif
+diff --git a/foldl.cabal b/foldl.cabal
+index 08715aa..ec2983e 100644
+--- a/foldl.cabal
++++ b/foldl.cabal
+@@ -1,7 +1,7 @@
+ Name: foldl
+ Version: 1.4.15
+ Cabal-Version: >=1.10
+-Build-Type: Simple
++Build-Type: Custom
+ License: BSD3
+ License-File: LICENSE
+ Copyright: 2013 Gabriella Gonzalez
+@@ -21,6 +21,12 @@ Source-Repository head
+ Type: git
+ Location: https://github.com/Gabriella439/Haskell-Foldl-Library
+
++custom-setup
++ setup-depends:
++ base
++ , Cabal
++ , cabal-doctest >= 1.0.0
++
+ Library
+ HS-Source-Dirs: src
+ Build-Depends:
+@@ -83,6 +89,9 @@ Test-Suite doctest
+ Main-Is: doctest.hs
+ Build-Depends:
+ base,
+- doctest >= 0.16
++ doctest >= 0.16,
++ directory,
++ filepath,
++ base-compat
+ GHC-Options: -threaded
+ Default-Language: Haskell2010
+diff --git a/test/doctest.hs b/test/doctest.hs
+index 5981eb4..847b897 100644
+--- a/test/doctest.hs
++++ b/test/doctest.hs
+@@ -1,4 +1,29 @@
+ import Test.DocTest
++import GHC.IO.Encoding (setLocaleEncoding)
++import System.Directory (getCurrentDirectory, makeAbsolute)
++import System.FilePath.Posix ((</>))
++import System.IO (utf8)
++import Build_doctests (pkgs)
++
++main = do
++ setLocaleEncoding utf8
++ pwd <- getCurrentDirectory
++ prefix <- makeAbsolute pwd
+
+-main :: IO ()
+-main = doctest ["-isrc", "src/Control/Foldl.hs", "src/Control/Scanl.hs"]
++ let customFlags =
++ [ "-package-env=-"
++ , "-hide-all-packages"
++ , "-no-user-package-db"
++ , "-package-db=" ++ prefix </> "dist/package.conf.inplace"
++ ]
++
++ let origFlags =
++ [ "-isrc"
++ ]
++
++ let modules =
++ [ "src/Control/Foldl.hs"
++ , "src/Control/Scanl.hs"
++ ]
++
++ doctest $ customFlags ++ pkgs ++ origFlags ++ modules
+--
+2.41.0
+
diff --git a/dev-haskell/foldl/foldl-1.4.15.ebuild b/dev-haskell/foldl/foldl-1.4.15.ebuild
index bc6602decc62..b18f0c7da8e3 100644
--- a/dev-haskell/foldl/foldl-1.4.15.ebuild
+++ b/dev-haskell/foldl/foldl-1.4.15.ebuild
@@ -15,10 +15,8 @@ LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
-PATCHES=( "${FILESDIR}/${PN}-1.4.12-cabal-doctest.patch" )
-
-GHC_BOOTSTRAP_PACKAGES=(
- cabal-doctest
+PATCHES=(
+ "${FILESDIR}/${PN}-1.4.15-cabal-doctest.patch"
)
RDEPEND=">=dev-haskell/comonad-4.0:=[profile?] <dev-haskell/comonad-6:=[profile?]
@@ -35,5 +33,14 @@ RDEPEND=">=dev-haskell/comonad-4.0:=[profile?] <dev-haskell/comonad-6:=[profile?
"
DEPEND="${RDEPEND}
>=dev-haskell/cabal-3.0.0.0
- test? ( >=dev-haskell/doctest-0.16 )
+ test? (
+ >=dev-haskell/cabal-doctest-1.0.0
+ >=dev-haskell/doctest-0.16
+ )
"
+
+src_configure() {
+ use test && export GHC_BOOTSTRAP_PACKAGES+=( cabal-doctest )
+
+ haskell-cabal_src_configure
+}