Hello community,
here is the log from the commit of package ghc-cabal-doctest for
openSUSE:Factory checked in at 2019-10-18 14:33:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cabal-doctest (Old)
and /work/SRC/openSUSE:Factory/.ghc-cabal-doctest.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cabal-doctest"
Fri Oct 18 14:33:51 2019 rev:8 rq:737195 version:1.0.8
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cabal-doctest/ghc-cabal-doctest.changes
2019-08-29 17:20:22.267338933 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-cabal-doctest.new.2352/ghc-cabal-doctest.changes
2019-10-18 14:33:53.112168802 +0200
@@ -1,0 +2,9 @@
+Thu Oct 3 02:02:03 UTC 2019 - [email protected]
+
+- Update cabal-doctest to version 1.0.8.
+ Upstream has edited the change log file since the last release in
+ a non-trivial way, i.e. they did more than just add a new entry
+ at the top. You can review the file at:
+ http://hackage.haskell.org/package/cabal-doctest-1.0.8/src/ChangeLog.md
+
+-------------------------------------------------------------------
Old:
----
cabal-doctest-1.0.7.tar.gz
New:
----
cabal-doctest-1.0.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-cabal-doctest.spec ++++++
--- /var/tmp/diff_new_pack.2T8Mbv/_old 2019-10-18 14:33:53.648167405 +0200
+++ /var/tmp/diff_new_pack.2T8Mbv/_new 2019-10-18 14:33:53.652167395 +0200
@@ -18,7 +18,7 @@
%global pkg_name cabal-doctest
Name: ghc-%{pkg_name}
-Version: 1.0.7
+Version: 1.0.8
Release: 0
Summary: A Setup.hs helper for doctests running
License: BSD-3-Clause
++++++ cabal-doctest-1.0.7.tar.gz -> cabal-doctest-1.0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cabal-doctest-1.0.7/ChangeLog.md
new/cabal-doctest-1.0.8/ChangeLog.md
--- old/cabal-doctest-1.0.7/ChangeLog.md 2001-09-09 03:46:40.000000000
+0200
+++ new/cabal-doctest-1.0.8/ChangeLog.md 2001-09-09 03:46:40.000000000
+0200
@@ -1,4 +1,9 @@
-# 1.0.7 -- 2019-??-??
+# 1.0.8 -- 2019-10-02
+
+* Pass `-package-env=-` when compiler supports it
+* Amend examples to `unsetEnv "GHC_ENVIRONMENT"`
+
+# 1.0.7 -- 2019-08-26
* Make `Distribution.Extra.Doctest` `-Wall`-clean
* Support GHC-8.8, base-4.13, and Cabal-3.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cabal-doctest-1.0.7/README.md
new/cabal-doctest-1.0.8/README.md
--- old/cabal-doctest-1.0.7/README.md 2001-09-09 03:46:40.000000000 +0200
+++ new/cabal-doctest-1.0.8/README.md 2001-09-09 03:46:40.000000000 +0200
@@ -49,16 +49,24 @@
import Build_doctests (flags, pkgs, module_sources)
import Data.Foldable (traverse_)
+import System.Environment.Compat (unsetEnv)
import Test.DocTest (doctest)
main :: IO ()
main = do
traverse_ putStrLn args -- optionally print arguments
+ unsetEnv "GHC_ENVIRONMENT" -- see 'Notes'; you may not need this
doctest args
where
args = flags ++ pkgs ++ module_sources
```
+(The `System.Environment.Compat` module is from the `base-compat`
+package. That's already in the transitive closure of `doctest`'s
+dependencies. `System.Environment.unsetEnv` was added with GHC 7.8 so,
+if you don't need to support versions of GHC older than 7.8, you can
+use `System.Environment` from `base` instead.)
+
Example with multiple .cabal components
---------------------------------------
@@ -86,6 +94,7 @@
import Build_doctests (Component (..), components)
import Data.Foldable (for_)
+import System.Environment.Compat (unsetEnv)
import Test.DocTest (doctest)
main :: IO ()
@@ -94,6 +103,7 @@
putStrLn "----------------------------------------"
let args = flags ++ pkgs ++ sources
for_ args putStrLn
+ unsetEnv "GHC_ENVIRONMENT"
doctest args
```
@@ -114,10 +124,12 @@
(flags, pkgs, module_sources,
flags_exe_my_exe, pkgs_exe_my_exe, module_sources_exe_my_exe)
import Data.Foldable (traverse_)
+import System.Environment.Compat (unsetEnv)
import Test.DocTest
main :: IO ()
main = do
+ unsetEnv "GHC_ENVRIONMENT"
-- doctests for library
traverse_ putStrLn libArgs
doctest libArgs
@@ -221,6 +233,20 @@
:: Language.Haskell.TH.Syntax.Name -> Language.Haskell.TH.Lib.ExpQ
```
+* From version 2, Stack sets the `GHC_ENVRIONMENT` variable, and GHC
+ (as invoked by `doctest`) will pick that up. This is undesirable:
+ `cabal-doctest` passes all the necessary information on the command
+ line already, and can lead to ambiguous module errors as GHC will
+ load the environment in addition to what `cabal-doctest` instructs
+ it to.
+
+ Hence, `cabal-doctest` tells GHC to ignore package environments
+ altogether on the command line. However, this is only possible since
+ GHC 8.2. If you are using `cabal-doctest` with Stack 2 and GHC 8.0
+ or earlier and seeing ambiguous module errors or other mysterious
+ failures, try manually unsetting `GHC_ENVIRONMENT` before invoking
+ `doctest`.
+
Copyright
---------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/cabal-doctest-1.0.7/cabal-doctest.cabal
new/cabal-doctest-1.0.8/cabal-doctest.cabal
--- old/cabal-doctest-1.0.7/cabal-doctest.cabal 2001-09-09 03:46:40.000000000
+0200
+++ new/cabal-doctest-1.0.8/cabal-doctest.cabal 2001-09-09 03:46:40.000000000
+0200
@@ -1,53 +1,46 @@
-name: cabal-doctest
-version: 1.0.7
-synopsis: A Setup.hs helper for doctests running
+name: cabal-doctest
+version: 1.0.8
+synopsis: A Setup.hs helper for doctests running
description:
Currently (beginning of 2017), there isn't @cabal doctest@
command. Yet, to properly work doctest needs plenty of configuration.
This library provides the common bits for writing custom Setup.hs
-
See <https://github.com/haskell/cabal/issues/2327 Cabal/2327> for the
progress
of @cabal doctest@, i.e. whether this library is obsolete.
-homepage: https://github.com/phadej/cabal-doctest
-license: BSD3
-license-file: LICENSE
-author: Oleg Grenrus <[email protected]>
-maintainer: Oleg Grenrus <[email protected]>
-copyright: (c) 2017 Oleg Grenrus
-category: Distribution
-build-type: Simple
-cabal-version: >=1.10
-extra-source-files: ChangeLog.md README.md
-tested-with:
- GHC==7.0.4,
- GHC==7.2.2,
- GHC==7.4.2,
- GHC==7.6.3,
- GHC==7.8.4,
- GHC==7.10.3,
- GHC==8.0.2,
- GHC==8.2.2,
- GHC==8.4.4,
- GHC==8.6.5,
- GHC==8.8.1
+homepage: https://github.com/phadej/cabal-doctest
+license: BSD3
+license-file: LICENSE
+author: Oleg Grenrus <[email protected]>
+maintainer: Oleg Grenrus <[email protected]>
+copyright: (c) 2017 Oleg Grenrus
+category: Distribution
+build-type: Simple
+cabal-version: >=1.10
+extra-source-files:
+ ChangeLog.md
+ README.md
+
+tested-with: GHC ==8.8.1 || >=7.4 && <8.8 || ==7.2.2 || ==7.0.4
source-repository head
type: git
location: https://github.com/phadej/cabal-doctest
library
- exposed-modules: Distribution.Extra.Doctest
+ exposed-modules: Distribution.Extra.Doctest
other-modules:
other-extensions:
build-depends:
- base >=4.3 && <4.14,
- Cabal >= 1.10 && <3.1,
- filepath,
- directory
- hs-source-dirs: src
- default-language: Haskell2010
- ghc-options: -Wall
- if !impl(ghc >= 7.2)
+ base >=4.3 && <4.14
+ , Cabal >=1.10 && <3.1
+ , directory
+ , filepath
+
+ hs-source-dirs: src
+ default-language: Haskell2010
+ ghc-options: -Wall
+
+ if !impl(ghc >=7.2)
-- Work around a pattern-match coverage checking bug in GHC 7.0
- ghc-options: -fno-warn-overlapping-patterns
+ ghc-options: -fno-warn-overlapping-patterns
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/cabal-doctest-1.0.7/src/Distribution/Extra/Doctest.hs
new/cabal-doctest-1.0.8/src/Distribution/Extra/Doctest.hs
--- old/cabal-doctest-1.0.7/src/Distribution/Extra/Doctest.hs 2001-09-09
03:46:40.000000000 +0200
+++ new/cabal-doctest-1.0.8/src/Distribution/Extra/Doctest.hs 2001-09-09
03:46:40.000000000 +0200
@@ -46,47 +46,51 @@
import Control.Monad
(when)
+import Data.IORef
+ (modifyIORef, newIORef, readIORef)
import Data.List
(nub)
import Data.Maybe
- (maybeToList, mapMaybe)
+ (mapMaybe, maybeToList)
import Data.String
(fromString)
-import qualified Data.Foldable as F
- (for_)
-import qualified Data.Traversable as T
- (traverse)
-import Distribution.Package
- (InstalledPackageId)
import Distribution.Package
- (Package (..), PackageId, packageVersion)
+ (InstalledPackageId, Package (..))
import Distribution.PackageDescription
- (BuildInfo (..), Executable (..), Library (..),
GenericPackageDescription,
- PackageDescription (), TestSuite (..))
+ (BuildInfo (..), Executable (..), GenericPackageDescription,
+ Library (..), PackageDescription, TestSuite (..))
import Distribution.Simple
- (UserHooks (..), autoconfUserHooks, defaultMainWithHooks,
simpleUserHooks)
+ (UserHooks (..), autoconfUserHooks, defaultMainWithHooks,
+ simpleUserHooks)
import Distribution.Simple.Compiler
- (PackageDB (..), showCompilerId)
+ (CompilerFlavor (GHC), CompilerId (..), PackageDB (..), compilerId)
import Distribution.Simple.LocalBuildInfo
- (ComponentLocalBuildInfo (componentPackageDeps), LocalBuildInfo (),
+ (ComponentLocalBuildInfo (componentPackageDeps), LocalBuildInfo,
compiler, withExeLBI, withLibLBI, withPackageDB, withTestLBI)
import Distribution.Simple.Setup
- (BuildFlags (buildDistPref, buildVerbosity), HaddockFlags
(haddockDistPref, haddockVerbosity), fromFlag, emptyBuildFlags)
+ (BuildFlags (buildDistPref, buildVerbosity),
+ HaddockFlags (haddockDistPref, haddockVerbosity), emptyBuildFlags,
+ fromFlag)
import Distribution.Simple.Utils
(createDirectoryIfMissingVerbose, info)
import Distribution.Text
- (display, simpleParse)
+ (display)
import System.FilePath
((</>))
-import Data.IORef (newIORef, modifyIORef, readIORef)
+import qualified Data.Foldable as F
+ (for_)
+import qualified Data.Traversable as T
+ (traverse)
-import Distribution.Simple.BuildPaths
#if MIN_VERSION_Cabal(1,25,0)
+import Distribution.Simple.BuildPaths
(autogenComponentModulesDir)
#else
+import Distribution.Simple.BuildPaths
(autogenModulesDir)
#endif
+
#if MIN_VERSION_Cabal(2,0,0)
import Distribution.Types.MungedPackageId
(MungedPackageId)
@@ -94,20 +98,31 @@
(unUnqualComponentName)
-- For amendGPD
-import Distribution.Types.GenericPackageDescription
- (GenericPackageDescription (condTestSuites))
import Distribution.PackageDescription
(CondTree (..))
+import Distribution.Types.GenericPackageDescription
+ (GenericPackageDescription (condTestSuites))
+
+import Distribution.Version
+ (mkVersion)
+#else
+import Data.Version
+ (Version (..))
+import Distribution.Package
+ (PackageId)
#endif
#if MIN_VERSION_Cabal(3,0,0)
-import Distribution.Simple.Utils (findFileEx)
+import Distribution.Simple.Utils
+ (findFileEx)
#else
-import Distribution.Simple.Utils (findFile)
+import Distribution.Simple.Utils
+ (findFile)
#endif
#if MIN_VERSION_Cabal(3,0,0)
-import Distribution.Types.LibraryName (libraryNameString)
+import Distribution.Types.LibraryName
+ (libraryNameString)
#endif
#if MIN_VERSION_directory(1,2,2)
@@ -131,6 +146,15 @@
findFileEx _ = findFile
#endif
+#if !MIN_VERSION_Cabal(2,0,0)
+mkVersion :: [Int] -> Version
+mkVersion ds = Version ds []
+#endif
+
+-------------------------------------------------------------------------------
+-- Mains
+-------------------------------------------------------------------------------
+
-- | A default main with doctests:
--
-- @
@@ -227,9 +251,12 @@
let verbosity = fromFlag (buildVerbosity flags)
let distPref = fromFlag (buildDistPref flags)
- -- Package DBs
+ -- Package DBs & environments
let dbStack = withPackageDB lbi ++ [ SpecificPackageDB $ distPref </>
"package.conf.inplace" ]
let dbFlags = "-hide-all-packages" : packageDbArgs dbStack
+ let envFlags
+ | ghcCanBeToldToIgnorePkgEnvs = [ "-package-env=-" ]
+ | otherwise = []
withTestLBI pkg lbi $ \suite suitecfg -> when (testName suite == fromString
testSuiteName) $ do
#if MIN_VERSION_Cabal(1,25,0)
@@ -331,6 +358,7 @@
[ iArgs
, additionalDirs
, includeArgs
+ , envFlags
, dbFlags
, cppFlags
, extensionArgs
@@ -388,10 +416,14 @@
parseComponentName _ = Nothing
-- we do this check in Setup, as then doctests don't need to depend on
Cabal
- isOldCompiler = maybe False id $ do
- a <- simpleParse $ showCompilerId $ compiler lbi
- b <- simpleParse "7.5"
- return $ packageVersion (a :: PackageId) < b
+ isNewCompiler = case compilerId $ compiler lbi of
+ CompilerId GHC v -> v >= mkVersion [7,6]
+ _ -> False
+
+ ghcCanBeToldToIgnorePkgEnvs :: Bool
+ ghcCanBeToldToIgnorePkgEnvs = case compilerId $ compiler lbi of
+ CompilerId GHC v -> v >= mkVersion [8,4,4]
+ _ -> False
formatDeps = map formatOne
formatOne (installedPkgId, pkgId)
@@ -408,8 +440,8 @@
-- From Distribution.Simple.Program.GHC
packageDbArgs :: [PackageDB] -> [String]
- packageDbArgs | isOldCompiler = packageDbArgsConf
- | otherwise = packageDbArgsDb
+ packageDbArgs | isNewCompiler = packageDbArgsDb
+ | otherwise = packageDbArgsConf
-- GHC <7.6 uses '-package-conf' instead of '-package-db'.
packageDbArgsConf :: [PackageDB] -> [String]
@@ -476,7 +508,7 @@
-> GenericPackageDescription
-> GenericPackageDescription
#if !(MIN_VERSION_Cabal(2,0,0))
-amendGPD _ = id
+amendGPD _ gpd = gpd
#else
amendGPD testSuiteName gpd = gpd
{ condTestSuites = map f (condTestSuites gpd)