commit ghc-cabal-helper for openSUSE:Factory
Hello community,
here is the log from the commit of package ghc-cabal-helper for openSUSE:Factory checked in at 2016-01-21 23:43:32
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-cabal-helper (Old)
and /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-cabal-helper"
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-cabal-helper/ghc-cabal-helper.changes 2015-12-29 12:58:51.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-cabal-helper.new/ghc-cabal-helper.changes 2016-01-22 01:08:43.000000000 +0100
@@ -1,0 +2,5 @@
+Mon Jan 11 07:39:48 UTC 2016 - mimi.vx@gmail.com
+
+- update to 0.6.3.0
+
+-------------------------------------------------------------------
Old:
----
cabal-helper-0.6.2.0.tar.gz
New:
----
cabal-helper-0.6.3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-cabal-helper.spec ++++++
--- /var/tmp/diff_new_pack.PHISNk/_old 2016-01-22 01:08:45.000000000 +0100
+++ /var/tmp/diff_new_pack.PHISNk/_new 2016-01-22 01:08:45.000000000 +0100
@@ -19,7 +19,7 @@
%global pkg_name cabal-helper
%bcond_with tests
Name: ghc-cabal-helper
-Version: 0.6.2.0
+Version: 0.6.3.0
Release: 0
Summary: Simple interface to some of Cabal's configuration state used by ghc-mod
License: AGPL-3.0+
++++++ cabal-helper-0.6.2.0.tar.gz -> cabal-helper-0.6.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cabal-helper-0.6.2.0/Distribution/Helper.hs new/cabal-helper-0.6.3.0/Distribution/Helper.hs
--- old/cabal-helper-0.6.2.0/Distribution/Helper.hs 2015-09-24 04:11:17.000000000 +0200
+++ new/cabal-helper-0.6.3.0/Distribution/Helper.hs 2016-01-10 22:00:45.000000000 +0100
@@ -48,6 +48,7 @@
, configFlags
, nonDefaultConfigFlags
, packageId
+ , compilerVersion
-- * Result types
, ChModuleName(..)
@@ -63,8 +64,10 @@
-- * Managing @dist/@
, prepare
+ , prepare'
, reconfigure
, writeAutogenFiles
+ , writeAutogenFiles'
-- * $libexec related error handling
, LibexecNotFoundError(..)
@@ -79,6 +82,7 @@
import Control.Exception as E
import Data.Char
import Data.List
+import Data.Maybe
import Data.Version
import Data.Typeable
import Distribution.Simple.BuildPaths (exeExtension)
@@ -154,7 +158,8 @@
slbiPkgLicenses :: [(String, [(String, Version)])],
slbiFlags :: [(String, Bool)],
slbiConfigFlags :: [(String, Bool)],
- slbiNonDefaultConfigFlags :: [(String, Bool)]
+ slbiNonDefaultConfigFlags :: [(String, Bool)],
+ slbiCompilerVersion :: (String, Version)
} deriving (Eq, Ord, Read, Show)
-- | Caches helper executable result so it doesn't have to be run more than once
@@ -164,6 +169,9 @@
(ReaderT QueryEnv m) a }
deriving (Functor, Applicative, Monad, MonadIO)
+instance MonadTrans Query where
+ lift = Query . lift . lift
+
type MonadQuery m = ( MonadIO m
, MonadState (Maybe SomeLocalBuildInfo) m
, MonadReader QueryEnv m)
@@ -230,6 +238,9 @@
-- i.e. don't rely on these being the flags set by the user directly.
nonDefaultConfigFlags :: MonadIO m => Query m [(String, Bool)]
+-- | The version of GHC the project is configured to use
+compilerVersion :: MonadIO m => Query m (String, Version)
+
-- | Package identifier, i.e. package name and version
packageId :: MonadIO m => Query m (String, Version)
@@ -246,6 +257,7 @@
flags = Query $ slbiFlags `liftM` getSlbi
configFlags = Query $ slbiConfigFlags `liftM` getSlbi
nonDefaultConfigFlags = Query $ slbiNonDefaultConfigFlags `liftM` getSlbi
+compilerVersion = Query $ slbiCompilerVersion `liftM` getSlbi
packageId = Query $ getPackageId
-- | Run @cabal configure@
@@ -266,50 +278,57 @@
_ <- liftIO $ readProc (cabalProgram progs) ("configure":progOpts) ""
return ()
-
-
-invokeHelper :: MonadQuery m => [String] -> m [Maybe ChResponse]
-invokeHelper args = ask >>= \QueryEnv {..} -> do
- let progs = qePrograms
- projdir = qeProjectDir
- distdir = qeDistDir
-
- progArgs = [ "--with-ghc=" ++ ghcProgram progs
- , "--with-ghc-pkg=" ++ ghcPkgProgram progs
- , "--with-cabal=" ++ cabalProgram progs
+readHelper :: (MonadIO m, MonadQuery m) => [String] -> m [Maybe ChResponse]
+readHelper args = ask >>= \qe -> liftIO $ do
+ out <- either error id <$> invokeHelper qe args
+ let res = read out
+ liftIO $ evaluate res `E.catch` \se@(SomeException _) -> do
+ md <- lookupEnv' "CABAL_HELPER_DEBUG"
+ let msg = "readHelper: exception: '" ++ show se ++ "'"
+ error $ msg ++ case md of
+ Nothing -> ", for more information set the environment variable CABAL_HELPER_DEBUG"
+ Just _ -> ", output: '"++ out ++"'"
+
+invokeHelper :: QueryEnv -> [String] -> IO (Either String String)
+invokeHelper QueryEnv {..} args = do
+ let progArgs = [ "--with-ghc=" ++ ghcProgram qePrograms
+ , "--with-ghc-pkg=" ++ ghcPkgProgram qePrograms
+ , "--with-cabal=" ++ cabalProgram qePrograms
+ ]
+ exe <- findLibexecExe "cabal-helper-wrapper"
+ let args' = progArgs ++ qeProjectDir:qeDistDir:args
+ out <- qeReadProcess exe args' ""
+ (Right <$> evaluate out) `E.catch` \(SomeException _) ->
+ return $ Left $ concat
+ ["invokeHelper", ": ", exe, " "
+ , intercalate " " (map show args')
+ , " failed"
]
- liftIO $ do
- exe <- findLibexecExe "cabal-helper-wrapper"
- let args' = progArgs ++ projdir:distdir:args
- out <- qeReadProcess exe args' ""
- evaluate (read out) `E.catch` \(SomeException _) ->
- error $ concat ["invokeHelper", ": ", exe, " "
- , intercalate " " (map show args')
- , " (read failed)"
- ]
getPackageId :: MonadQuery m => m (String, Version)
getPackageId = ask >>= \QueryEnv {..} -> do
- [ Just (ChResponseVersion pkgName pkgVer) ] <- invokeHelper [ "package-id" ]
+ [ Just (ChResponseVersion pkgName pkgVer) ] <- readHelper [ "package-id" ]
return (pkgName, pkgVer)
getSomeConfigState :: MonadQuery m => m SomeLocalBuildInfo
getSomeConfigState = ask >>= \QueryEnv {..} -> do
- res <- invokeHelper [ "package-db-stack"
- , "entrypoints"
- , "source-dirs"
- , "ghc-options"
- , "ghc-src-options"
- , "ghc-pkg-options"
- , "ghc-merged-pkg-options"
- , "ghc-lang-options"
- , "licenses"
- , "flags"
- , "config-flags"
- , "non-default-config-flags"
- ]
+ res <- readHelper
+ [ "package-db-stack"
+ , "entrypoints"
+ , "source-dirs"
+ , "ghc-options"
+ , "ghc-src-options"
+ , "ghc-pkg-options"
+ , "ghc-merged-pkg-options"
+ , "ghc-lang-options"
+ , "licenses"
+ , "flags"
+ , "config-flags"
+ , "non-default-config-flags"
+ , "compiler-version"
+ ]
let [ Just (ChResponsePkgDbs pkgDbs),
Just (ChResponseEntrypoints eps),
Just (ChResponseCompList srcDirs),
@@ -321,28 +340,31 @@
Just (ChResponseLicenses pkgLics),
Just (ChResponseFlags fls),
Just (ChResponseFlags cfls),
- Just (ChResponseFlags ndcfls)
+ Just (ChResponseFlags ndcfls),
+ Just (ChResponseVersion comp compVer)
] = res
return $ SomeLocalBuildInfo
- pkgDbs eps srcDirs ghcOpts ghcSrcOpts ghcPkgOpts ghcMergedPkgOpts ghcLangOpts pkgLics fls cfls ndcfls
+ pkgDbs eps srcDirs ghcOpts ghcSrcOpts ghcPkgOpts ghcMergedPkgOpts ghcLangOpts pkgLics fls cfls ndcfls (comp, compVer)
--- | Make sure the appropriate helper executable for the given project is
--- installed and ready to run queries.
prepare :: MonadIO m
=> (FilePath -> [String] -> String -> IO String)
-> FilePath
- -- ^ Path to project directory, i.e. the one containing the
- -- @project.cabal@ file
-> FilePath
- -- ^ Path to the @dist/@ directory
-> m ()
prepare readProc projdir distdir = liftIO $ do
exe <- findLibexecExe "cabal-helper-wrapper"
void $ readProc exe [projdir, distdir] ""
--- | Create @cabal_macros.h@ and @Paths_\
participants (1)
-
root@hilbert.suse.de