Hello community, here is the log from the commit of package hdevtools for openSUSE:Factory checked in at 2016-09-05 21:21:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hdevtools (Old) and /work/SRC/openSUSE:Factory/.hdevtools.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "hdevtools" Changes: -------- --- /work/SRC/openSUSE:Factory/hdevtools/hdevtools.changes 2016-07-20 09:22:51.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.hdevtools.new/hdevtools.changes 2016-09-05 21:21:09.000000000 +0200 @@ -1,0 +2,5 @@ +Wed Aug 17 18:34:02 UTC 2016 - psimons@suse.com + +- Update to version 0.1.4.0 revision 0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- hdevtools-0.1.3.2.tar.gz New: ---- hdevtools-0.1.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hdevtools.spec ++++++ --- /var/tmp/diff_new_pack.poUfmk/_old 2016-09-05 21:21:11.000000000 +0200 +++ /var/tmp/diff_new_pack.poUfmk/_new 2016-09-05 21:21:11.000000000 +0200 @@ -17,15 +17,14 @@ Name: hdevtools -Version: 0.1.3.2 +Version: 0.1.4.0 Release: 0 Summary: Persistent GHC powered background server for FAST haskell development tools License: MIT -Group: System/Libraries +Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{name} Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel -# Begin cabal-rpm deps: BuildRequires: ghc-cmdargs-devel BuildRequires: ghc-directory-devel BuildRequires: ghc-filepath-devel @@ -39,7 +38,6 @@ BuildRequires: ghc-transformers-devel BuildRequires: ghc-unix-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build -# End cabal-rpm deps %description 'hdevtools' is a backend for text editor plugins, to allow for things such as @@ -70,15 +68,12 @@ %prep %setup -q - %build %ghc_bin_build - %install %ghc_bin_install - %files %defattr(-,root,root,-) %doc LICENSE ++++++ hdevtools-0.1.3.2.tar.gz -> hdevtools-0.1.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/CHANGELOG.md new/hdevtools-0.1.4.0/CHANGELOG.md --- old/hdevtools-0.1.3.2/CHANGELOG.md 2016-06-10 21:11:40.000000000 +0200 +++ new/hdevtools-0.1.4.0/CHANGELOG.md 2016-08-08 13:40:29.000000000 +0200 @@ -1,5 +1,9 @@ # Changelog +## 0.1.4.0 - 2016-08-08 + + * Determine GHC libdir and binaries using stack. + ## 0.1.3.2 - 2016-06-09 * Added GHC 8.0.x support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/README.md new/hdevtools-0.1.4.0/README.md --- old/hdevtools-0.1.3.2/README.md 2016-01-19 09:28:21.000000000 +0100 +++ new/hdevtools-0.1.4.0/README.md 2016-08-08 13:39:43.000000000 +0200 @@ -44,12 +44,8 @@ $ stack install hdevtools ``` -**Note:** As stack manages matching GHC versions, the appropriate compiler has -to be available to `hdevtools`. Thus hdevtools has to be started with `stack exec`, -for example using the alias: -``` -$ alias hdevtools="stack exec --no-ghc-package-path hdevtools --" -``` +**Note:** `hdevtools` automatically discovers compiler and libraries installed +via stack. Alternatively one can install from [Hackage][1] via cabal install: ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/hdevtools.cabal new/hdevtools-0.1.4.0/hdevtools.cabal --- old/hdevtools-0.1.3.2/hdevtools.cabal 2016-06-10 21:11:45.000000000 +0200 +++ new/hdevtools-0.1.4.0/hdevtools.cabal 2016-08-08 13:40:29.000000000 +0200 @@ -1,5 +1,5 @@ name: hdevtools -version: 0.1.3.2 +version: 0.1.4.0 synopsis: Persistent GHC powered background server for FAST haskell development tools license: MIT license-file: LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/Cabal.hs new/hdevtools-0.1.4.0/src/Cabal.hs --- old/hdevtools-0.1.3.2/src/Cabal.hs 2016-03-22 20:54:41.000000000 +0100 +++ new/hdevtools-0.1.4.0/src/Cabal.hs 2016-08-08 13:39:43.000000000 +0200 @@ -102,13 +102,17 @@ stackifyFlags :: ConfigFlags -> Maybe StackConfig -> ConfigFlags stackifyFlags cfg Nothing = cfg -stackifyFlags cfg (Just si) = cfg { configDistPref = toFlag dist +stackifyFlags cfg (Just si) = cfg { configHcPath = toFlag ghc + , configHcPkg = toFlag ghcPkg + , configDistPref = toFlag dist , configPackageDBs = pdbs } where pdbs = [Nothing, Just GlobalPackageDB] ++ pdbs' pdbs' = Just . SpecificPackageDB <$> stackDbs si dist = stackDist si + ghc = stackGhcBinDir si > "ghc" + ghcPkg = stackGhcBinDir si > "ghc-pkg" -- via: https://groups.google.com/d/msg/haskell-stack/8HJ6DHAinU0/J68U6AXTsasJ -- cabal configure --package-db=clear --package-db=global --package-db=$(stack path --snapshot-pkg-db) --package-db=$(stack path --local-pkg-db) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/Client.hs new/hdevtools-0.1.4.0/src/Client.hs --- old/hdevtools-0.1.3.2/src/Client.hs 2016-02-27 09:44:02.000000000 +0100 +++ new/hdevtools-0.1.4.0/src/Client.hs 2016-08-08 13:39:43.000000000 +0200 @@ -44,7 +44,7 @@ startClientReadLoop h Left _ -> do s <- createListenSocket sock - daemonize False $ startServer sock (Just s) + daemonize False $ startServer sock (Just s) cmdExtra serverCommand sock cmd cmdExtra startClientReadLoop :: Handle -> IO () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/CommandArgs.hs new/hdevtools-0.1.4.0/src/CommandArgs.hs --- old/hdevtools-0.1.3.2/src/CommandArgs.hs 2016-03-21 23:20:27.000000000 +0100 +++ new/hdevtools-0.1.4.0/src/CommandArgs.hs 2016-08-08 13:39:43.000000000 +0200 @@ -34,10 +34,13 @@ data HDevTools = Admin { socket :: Maybe FilePath + , ghcOpts :: [String] , start_server :: Bool + , cabalOpts :: [String] , noDaemon :: Bool , status :: Bool , stop_server :: Bool + , debug :: Bool } | Check { socket :: Maybe FilePath @@ -46,12 +49,14 @@ , path :: Maybe String , file :: String , json :: Bool + , debug :: Bool } | ModuleFile { socket :: Maybe FilePath , ghcOpts :: [String] , cabalOpts :: [String] , module_ :: String + , debug :: Bool } | Info { socket :: Maybe FilePath @@ -60,6 +65,7 @@ , path :: Maybe String , file :: String , identifier :: String + , debug :: Bool } | Type { socket :: Maybe FilePath @@ -69,6 +75,7 @@ , file :: String , line :: Int , col :: Int + , debug :: Bool } | FindSymbol { socket :: Maybe FilePath @@ -76,16 +83,20 @@ , cabalOpts :: [String] , symbol :: String , files :: [String] + , debug :: Bool } deriving (Show, Data, Typeable) dummyAdmin :: HDevTools dummyAdmin = Admin { socket = Nothing + , ghcOpts = [] + , cabalOpts = [] , start_server = False , noDaemon = False , status = False , stop_server = False + , debug = False } dummyCheck :: HDevTools @@ -96,6 +107,7 @@ , path = Nothing , file = "" , json = False + , debug = False } dummyModuleFile :: HDevTools @@ -104,6 +116,7 @@ , ghcOpts = [] , cabalOpts = [] , module_ = "" + , debug = False } dummyInfo :: HDevTools @@ -114,6 +127,7 @@ , path = Nothing , file = "" , identifier = "" + , debug = False } dummyType :: HDevTools @@ -125,6 +139,7 @@ , file = "" , line = 0 , col = 0 + , debug = False } dummyFindSymbol :: HDevTools @@ -134,15 +149,19 @@ , cabalOpts = [] , symbol = "" , files = [] + , debug = False } admin :: Annotate Ann admin = record dummyAdmin [ socket := def += typFile += help "socket file to use" + , ghcOpts := def += typ "OPTION" += help "ghc options" + , cabalOpts := def += typ "OPTION" += help "cabal options" , start_server := def += help "start server" , noDaemon := def += help "do not daemonize (only if --start-server)" , status := def += help "show status of server" , stop_server := def += help "shutdown the server" + , debug := def += help "enable debug output" ] += help "Interactions with the server" check :: Annotate Ann @@ -153,6 +172,7 @@ , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , json := def += help "render output as JSON" + , debug := def += help "enable debug output" ] += help "Check a haskell source file for errors and warnings" moduleFile :: Annotate Ann @@ -161,6 +181,7 @@ , ghcOpts := def += typ "OPTION" += help "ghc options" , cabalOpts := def += typ "OPTION" += help "cabal options" , module_ := def += typ "MODULE" += argPos 0 + , debug := def += help "enable debug output" ] += help "Get the haskell source file corresponding to a module name" info :: Annotate Ann @@ -171,6 +192,7 @@ , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , identifier := def += typ "IDENTIFIER" += argPos 1 + , debug := def += help "enable debug output" ] += help "Get info from GHC about the specified identifier" type_ :: Annotate Ann @@ -178,6 +200,7 @@ [ socket := def += typFile += help "socket file to use" , ghcOpts := def += typ "OPTION" += help "ghc options" , cabalOpts := def += typ "OPTION" += help "cabal options" + , debug := def += help "enable debug output" , path := def += typFile += help "path to target file" , file := def += typFile += argPos 0 += opt "" , line := def += typ "LINE" += argPos 1 @@ -191,6 +214,7 @@ , cabalOpts := def += typ "OPTION" += help "cabal options" , symbol := def += typ "SYMBOL" += argPos 0 , files := def += typFile += args + , debug := def += help "enable debug output" ] += help "List the modules where the given symbol could be found" full :: String -> Annotate Ann diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/CommandLoop.hs new/hdevtools-0.1.4.0/src/CommandLoop.hs --- old/hdevtools-0.1.3.2/src/CommandLoop.hs 2016-06-09 21:54:48.000000000 +0200 +++ new/hdevtools-0.1.4.0/src/CommandLoop.hs 2016-08-08 13:39:43.000000000 +0200 @@ -7,6 +7,7 @@ , startCommandLoop ) where +import Control.Applicative ((<|>)) import Control.Monad (when) import Data.IORef import Data.List (find, intercalate) @@ -101,7 +102,7 @@ startCommandLoop :: IORef State -> ClientSend -> IO (Maybe CommandObj) -> Config -> Maybe Command -> IO () startCommandLoop state clientSend getNextCommand initialConfig mbInitialCommand = do - continue <- GHC.runGhc (Just GHC.Paths.libdir) $ do + continue <- GHC.runGhc ghcLibDir $ do configResult <- configSession state clientSend initialConfig case configResult of Left e -> do @@ -119,7 +120,10 @@ -- Exit return () Just (cmd, config) -> startCommandLoop state clientSend getNextCommand config (Just cmd) - where + where + ghcLibDir = stackGhcLibDir <$> configStack initialConfig + <|> Just GHC.Paths.libdir + processNextCommand :: Bool -> GHC.Ghc (Maybe CommandObj) processNextCommand forceReconfig = do mbNextCmd <- liftIO getNextCommand diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/Main.hs new/hdevtools-0.1.4.0/src/Main.hs --- old/hdevtools-0.1.3.2/src/Main.hs 2016-06-09 23:36:06.000000000 +0200 +++ new/hdevtools-0.1.4.0/src/Main.hs 2016-08-08 13:39:43.000000000 +0200 @@ -6,7 +6,9 @@ import Data.Traversable (traverse) #endif +import Control.Monad (when) import Data.Maybe (fromMaybe) +import Data.Monoid ((<>)) import System.Directory (getCurrentDirectory) import System.Environment (getProgName) import System.IO (hPutStrLn, stderr) @@ -57,7 +59,11 @@ let argPath = pathArg args dir <- maybe getCurrentDirectory (return . takeDirectory) argPath mCabalFile <- findCabalFile dir >>= traverse absoluteFilePath + when (debug args) . + putStrLn $ "Cabal file: " <> show mCabalFile mStackYaml <- findStackYaml dir + when (debug args) . + putStrLn $ "Stack file: " <> show mStackYaml let extra = emptyCommandExtra { cePath = argPath , ceGhcOptions = ghcOpts args @@ -67,6 +73,8 @@ } let defaultSocketPath = maybe "" takeDirectory mCabalFile > defaultSocketFile let sock = fromMaybe defaultSocketPath $ socket args + when (debug args) . + putStrLn $ "Socket file: " <> show sock case args of Admin {} -> doAdmin sock args extra Check {} -> doCheck sock args extra @@ -76,12 +84,12 @@ FindSymbol {} -> doFindSymbol sock args extra doAdmin :: FilePath -> HDevTools -> CommandExtra -> IO () -doAdmin sock args _extra +doAdmin sock args cmdExtra | start_server args = - if noDaemon args then startServer sock Nothing + if noDaemon args then startServer sock Nothing cmdExtra else do s <- createListenSocket sock - daemonize True $ startServer sock (Just s) + daemonize True $ startServer sock (Just s) cmdExtra | status args = getServerStatus sock | stop_server args = stopServer sock | otherwise = do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/Server.hs new/hdevtools-0.1.4.0/src/Server.hs --- old/hdevtools-0.1.3.2/src/Server.hs 2016-02-28 10:59:04.000000000 +0100 +++ new/hdevtools-0.1.4.0/src/Server.hs 2016-08-08 13:39:43.000000000 +0200 @@ -11,7 +11,7 @@ import System.IO.Error (ioeGetErrorType, isAlreadyInUseError, isDoesNotExistError) import CommandLoop (newCommandLoopState, Config, updateConfig, startCommandLoop) -import Types (ClientDirective(..), Command, emptyCommandExtra, ServerDirective(..)) +import Types (ClientDirective(..), Command, CommandExtra(..), ServerDirective(..)) import Util (readMaybe) createListenSocket :: FilePath -> IO Socket @@ -23,8 +23,8 @@ removeFile socketPath listenOn (UnixSocket socketPath) -startServer :: FilePath -> Maybe Socket -> IO () -startServer socketPath mbSock = do +startServer :: FilePath -> Maybe Socket -> CommandExtra -> IO () +startServer socketPath mbSock cmdExtra = do case mbSock of Nothing -> bracket (createListenSocket socketPath) cleanup go Just sock -> (go sock) `finally` (cleanup sock) @@ -39,7 +39,7 @@ state <- newCommandLoopState currentClient <- newIORef Nothing configRef <- newIORef Nothing - config <- updateConfig Nothing emptyCommandExtra + config <- updateConfig Nothing cmdExtra startCommandLoop state (clientSend currentClient) (getNextCommand currentClient sock configRef) config Nothing removeSocketFile :: IO () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hdevtools-0.1.3.2/src/Stack.hs new/hdevtools-0.1.4.0/src/Stack.hs --- old/hdevtools-0.1.3.2/src/Stack.hs 2016-02-28 10:59:04.000000000 +0100 +++ new/hdevtools-0.1.4.0/src/Stack.hs 2016-08-08 13:39:43.000000000 +0200 @@ -6,7 +6,6 @@ , getStackConfig ) where -import Data.Maybe (listToMaybe) import Data.Char (isSpace) #if __GLASGOW_HASKELL__ < 709 @@ -25,30 +24,35 @@ data StackConfig = StackConfig { stackYaml :: FilePath , stackDist :: FilePath , stackDbs :: [FilePath] + , stackGhcBinDir :: FilePath + , stackGhcLibDir :: FilePath } deriving (Eq, Show) -- | Search for a @stack.yaml@ upwards in given file path tree. findStackYaml :: FilePath -> IO (Maybe FilePath) -findStackYaml p = listToMaybe <$> filterM doesFileExist paths - where - paths = [ d > "stack.yaml" | d <- pathsToRoot dir] - dir = takeDirectory p +findStackYaml = fmap (fmap trim) . execInPath "stack path --config-location" -- | Run @stack path@ to compute @StackConfig@ getStackConfig :: CommandExtra -> IO (Maybe StackConfig) getStackConfig CommandExtra { ceStackYamlPath = Nothing } = return Nothing getStackConfig CommandExtra { ceStackYamlPath = Just p } = do - dbs <- getStackDbs p - dist <- getStackDist p - return $ StackConfig p <$> dist <*> dbs - -pathsToRoot :: FilePath -> [FilePath] -pathsToRoot p - | p == parent = [p] - | otherwise = p : pathsToRoot parent + dbs <- getStackDbs root + dist <- getStackDist root + ghcBinDir <- getStackGhcBinDir root + ghcLibDir <- getStackGhcLibDir root + return $ StackConfig p <$> dist + <*> dbs + <*> ghcBinDir + <*> ghcLibDir where - parent = takeDirectory p + root = takeDirectory p + +getStackGhcBinDir :: FilePath -> IO (Maybe FilePath) +getStackGhcBinDir = fmap (fmap trim) . execInPath "stack path --compiler-bin" + +getStackGhcLibDir :: FilePath -> IO (Maybe FilePath) +getStackGhcLibDir = fmap (fmap takeDirectory) . execInPath "stack path --global-pkg-db" -------------------------------------------------------------------------------- getStackDist :: FilePath -> IO (Maybe FilePath) @@ -127,5 +131,5 @@ -- no stack command is in the PATH. Left _ -> Nothing where - prc = (shell cmd) { cwd = Just $ takeDirectory p } + prc = (shell cmd) { cwd = Just p } #endif