ats-pkg 2.2.0.11 → 2.2.0.15
raw patch · 4 files changed
+12/−68 lines, 4 filesdep +ats-setupdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: ats-setup
Dependency ranges changed: base
API changes (from Hackage documentation)
- Language.ATS.Package: packageCompiler :: FilePath -> IO ()
Files
- ats-pkg.cabal +3/−2
- src/Language/ATS/Package.hs +1/−2
- src/Language/ATS/Package/Compiler.hs +7/−63
- stack.yaml +1/−1
ats-pkg.cabal view
@@ -1,5 +1,5 @@ name: ats-pkg-version: 2.2.0.11+version: 2.2.0.15 synopsis: Package manager for ATS description: A collection of scripts to simplify building ATS projects. homepage: https://github.com/vmchale/atspkg#readme@@ -8,7 +8,7 @@ author: Vanessa McHale maintainer: vamchale@gmail.com copyright: Copyright: (c) 2018 Vanessa McHale-category: Development+category: Development, ATS build-type: Custom extra-doc-files: README.md , docs/manual.tex@@ -62,6 +62,7 @@ , ansi-wl-pprint , binary , dependency+ , ats-setup -- , lzma -- , bzlib default-language: Haskell2010
src/Language/ATS/Package.hs view
@@ -1,5 +1,4 @@-module Language.ATS.Package ( packageCompiler- , pkgToAction+module Language.ATS.Package ( pkgToAction , fetchCompiler , setupCompiler , build
src/Language/ATS/Package/Compiler.hs view
@@ -2,30 +2,16 @@ -- | This module contains scripts to fetch the compiler. module Language.ATS.Package.Compiler- ( packageCompiler- , cleanAll+ ( cleanAll , fetchCompiler , setupCompiler ) where -import qualified Codec.Archive.Tar as Tar-import Codec.Compression.GZip (compress, decompress)-import Control.Monad (void, when)-import qualified Data.ByteString.Lazy as BS-import Language.ATS.Package.Type-import Network.HTTP.Client hiding (decompress)-import Network.HTTP.Client.TLS (tlsManagerSettings)+import Control.Monad+import Data.Dependency+import qualified Distribution.ATS as X import System.Directory-import System.Environment (getEnv)-import System.FilePath.Find (find)-import System.Posix.Files-import System.Process---- HOPEFULLY only linux or darwin?--- isDigit---- request to https://github.com/vmchale/atspkg/releases/latest/ for latest--- version, then we can upgrade this tool as well.+import System.Environment (getEnv) cleanAll :: IO () cleanAll = do@@ -35,50 +21,8 @@ putStrLn "Cleaning everything..." removeDirectoryRecursive d --- TODO depend on version-compilerDir :: Version -> IO FilePath-compilerDir v = (++ ("/.atspkg/" ++ show v)) <$> getEnv "HOME"--packageCompiler :: FilePath -> IO ()-packageCompiler directory = do- files <- find (pure True) (pure True) directory- bytes <- fmap Tar.write . Tar.pack directory $ fmap (drop $ length (directory :: String) + 1) files- BS.writeFile (directory ++ ".tar.gz") (compress bytes)--pkgUrl :: Version -> String-pkgUrl v = "https://github.com/vmchale/atspkg/raw/master/pkgs/ATS2-Postiats-" ++ show v ++ ".tar.gz"--withCompiler :: String -> Version -> IO ()-withCompiler s v = putStrLn $ s ++ " compiler v" ++ show v ++ "..."- fetchCompiler :: Version -> IO ()-fetchCompiler v = do-- cd <- compilerDir v- needsSetup <- not <$> doesDirectoryExist cd-- when needsSetup $ do-- withCompiler "Fetching" v- manager <- newManager tlsManagerSettings- initialRequest <- parseRequest $ pkgUrl v- response <- responseBody <$> httpLbs (initialRequest { method = "GET" }) manager-- withCompiler "Unpacking" v- Tar.unpack cd . Tar.read . decompress $ response+fetchCompiler = X.fetchCompiler Nothing setupCompiler :: Version -> IO ()-setupCompiler v = do-- withCompiler "Configuring" v- cd <- compilerDir v- let configurePath = cd ++ "/configure"- setFileMode configurePath ownerModes- setFileMode (cd ++ "/autogen.sh") ownerModes- void $ readCreateProcess ((proc (cd ++ "/autogen.sh") []) { cwd = Just cd }) ""- void $ readCreateProcess ((proc configurePath ["--prefix", cd]) { cwd = Just cd }) ""-- withCompiler "Building" v- void $ readCreateProcess ((proc "make" []) { cwd = Just cd, std_err = CreatePipe }) ""- withCompiler "Installing" v- void $ readCreateProcess ((proc "make" ["install"]) { cwd = Just cd, std_err = CreatePipe }) ""+setupCompiler = X.setupCompiler Nothing
stack.yaml view
@@ -4,7 +4,7 @@ - '.' extra-deps: - shake-ext-2.3.0.0- - shake-ats-1.3.0.3+ - shake-ats-1.3.0.6 - composition-prelude-1.1.0.2 - language-ats-0.2.0.0 - cli-setup-0.2.0.1