hsinstall 2.5 → 2.6
raw patch · 12 files changed
+51/−34 lines, 12 filesdep +transformersdep −fmtPVP ok
version bump matches the API change (PVP)
Dependencies added: transformers
Dependencies removed: fmt
API changes (from Hackage documentation)
Files
- LICENSE +1/−1
- README.md +3/−3
- changelog.md +9/−0
- hsinstall.cabal +4/−4
- package.yaml +3/−3
- src/app/HSInstall/DeploymentInfo.hs +13/−5
- src/app/HSInstall/Except.hs +1/−1
- src/app/HSInstall/Opts.hs +5/−5
- src/app/HSInstall/System/Directory.hs +2/−2
- src/app/hsinstall.hs +5/−5
- stack.yaml +1/−1
- stack.yaml.lock +4/−4
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2016-2019, Dino Morelli <dino@ui3.info>+Copyright (c) 2016-2020, Dino Morelli <dino@ui3.info> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided
README.md view
@@ -14,7 +14,7 @@ structure for deployment. It builds upon the `stack install` command and adds these features: -- Copies the `LICENSE` file into <PREFIX>/share/<PROJECT-NAME>/doc+- Copies the `LICENSE` file into `<PREFIX>/share/<PROJECT-NAME>/doc` - Copies the contents of a static directory stucture in your project (named `hsinstall`) into the destination prefix directory. This can contain additional binaries or scripts, resources, documentation, etc. (more on this@@ -26,7 +26,7 @@ https://docs.haskellstack.org/en/stable/README/ If the AppImage features are desired, you must have these tools on your PATH:-linuxdeploy: https://github.com/linuxdeploy/linuxdeploy/releases+linuxdeploy: https://github.com/linuxdeploy/linuxdeploy/releases, linuxdeploy-plugin-appimage: https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases Running hsinstall on a project for the first time and with no arguments will produce this in . :@@ -89,7 +89,7 @@ In order to locate data files at runtime, including resources, the hsinstall project includes a library to construct the share path relative to the-executable. See [this source code](https://github.com/dino-/hsinstall/blob/master/src/lib/HSInstall/Resources.hs)+executable. See [this source code](https://github.com/dino-/hsinstall/blob/master/src/lib/HSInstall/Paths.hs) for help with integrating this into your app.
changelog.md view
@@ -1,3 +1,12 @@+2.6 (2020-01-12)++ * Moved stack resolver up to lts-14.20+ * Switched from fmt library to Text.Printf+ * Try to force hpack cabal file creation if it's missing+ * Moved copyright date up to 2020+ * Fixed various problems in the README++ 2.5 (2019-12-01) * Using an infoHelper for the --version switch
hsinstall.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: cde38aac58226456391a0e700ed87399090f09072641677d7446a999c45dc231+-- hash: eaeb3c491f0d773e1e6a91540369700f5dd54203a30fe8e3e280500279513414 name: hsinstall-version: 2.5+version: 2.6 synopsis: Install Haskell software description: This is a tool for deploying software projects into directory structures suitable for installation on a system. It builds upon the `stack install` command and adds more features. It's also a tool for easier AppImage creation. category: Utility@@ -15,7 +15,7 @@ bug-reports: https://github.com/dino-/hsinstall/issues author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info>-copyright: 2016-2019 Dino Morelli+copyright: 2016-2020 Dino Morelli license: ISC license-file: LICENSE build-type: Simple@@ -68,10 +68,10 @@ , base >=4.8 && <5.0 , directory , filepath- , fmt , heredoc , hsinstall , optparse-applicative , process , safe-exceptions+ , transformers default-language: Haskell2010
package.yaml view
@@ -1,11 +1,11 @@ name: hsinstall-version: '2.5'+version: '2.6' synopsis: Install Haskell software description: This is a tool for deploying software projects into directory structures suitable for installation on a system. It builds upon the `stack install` command and adds more features. It's also a tool for easier AppImage creation. license: ISC author: Dino Morelli maintainer: Dino Morelli <dino@ui3.info>-copyright: 2016-2019 Dino Morelli+copyright: 2016-2020 Dino Morelli category: Utility extra-source-files: - changelog.md@@ -44,9 +44,9 @@ dependencies: - ansi-wl-pprint - Cabal- - fmt - heredoc - hsinstall - optparse-applicative - process - safe-exceptions+ - transformers
src/app/HSInstall/DeploymentInfo.hs view
@@ -9,6 +9,8 @@ ) where +import Control.Applicative ( (<|>) )+import Control.Monad.Trans.Maybe ( MaybeT (..), runMaybeT ) import Data.List ( isSuffixOf ) import Data.Maybe ( listToMaybe ) import Distribution.Package@@ -24,9 +26,9 @@ import Distribution.Pretty ( prettyShow ) import Distribution.Types.PackageName ( unPackageName ) import Distribution.Verbosity ( normal )-import Fmt ( (+|), (|+) ) import System.Directory ( getDirectoryContents ) import System.FilePath ( (</>) )+import System.Process ( callProcess ) import HSInstall.Except ( HSInstallException (NoCabalFiles)@@ -47,10 +49,16 @@ } +locateCabalFile :: IO (Maybe FilePath)+locateCabalFile = listToMaybe . filter (isSuffixOf ".cabal")+ <$> getDirectoryContents "."++ constructDeploymentInfo :: Options -> IO DeploymentInfo constructDeploymentInfo opts = do- mbCabalFile <- listToMaybe . filter (isSuffixOf ".cabal")- <$> getDirectoryContents "."+ mbCabalFile <- runMaybeT+ $ MaybeT (locateCabalFile)+ <|> MaybeT (callProcess "stack" ["query"] >> locateCabalFile) maybe (throwM NoCabalFiles) (fmap (constructDeploymentInfo' opts . package . packageDescription) . readGenericPackageDescription normal) mbCabalFile@@ -66,10 +74,10 @@ binDir' = prefixDir' </> "bin" project = unPackageName . pkgName $ pkgId version' = prettyShow . pkgVersion $ pkgId- shareDir' = prefixDir' </> "share" </> (""+|project|+"")+ shareDir' = prefixDir' </> "share" </> project computePrefixDir :: Maybe FilePath -> BuildMode -> FilePath computePrefixDir (Just prefix') _ = prefix'-computePrefixDir Nothing (AppImageExe exe) = (""+|exe|+".AppDir") </> "usr"+computePrefixDir Nothing (AppImageExe exe) = (exe ++ ".AppDir") </> "usr" computePrefixDir Nothing Project = "AppDir" </> "usr"
src/app/HSInstall/Except.hs view
@@ -21,7 +21,7 @@ deriving Typeable instance Show HSInstallException where- show NoCabalFiles = "no cabal files were found in . If this is a buildable project directory that uses hpack, try issuing any stack command to generate the cabal file from the package.yaml"+ show NoCabalFiles = "no cabal files were found in . If this is a buildable project directory that uses hpack, try issuing any stack command like `stack query` or `stack clean` to generate the cabal file from the package.yaml" instance Exception HSInstallException
src/app/HSInstall/Opts.hs view
@@ -9,12 +9,12 @@ where import Data.Version ( showVersion )-import Fmt ( (+|), (|+), format ) import Options.Applicative import Paths_hsinstall ( version ) import System.Environment ( getProgName ) import Text.Heredoc ( here ) import Text.PrettyPrint.ANSI.Leijen ( string )+import Text.Printf ( printf ) data BuildMode = AppImageExe String | Project@@ -59,7 +59,7 @@ versionHelper :: String -> Parser (a -> a) versionHelper progName =- infoOption (""+|progName|+" "+|showVersion version|+"") $ mconcat+ infoOption (printf "%s %s" progName (showVersion version)) $ mconcat [ long "version" , help "Show version information" , hidden@@ -70,13 +70,13 @@ parseOpts = do pn <- getProgName execParser $ info (parser <**> helper <**> versionHelper pn)- ( header (""+|pn|+" - Pack a haskell project into a deployable directory structure")+ ( header (printf "%s - Pack a haskell project into a deployable directory structure" pn) <> footer' ) footer' :: InfoMod a-footer' = footerDoc . Just . string . format content . showVersion $ version+footer' = footerDoc . Just . string . printf content . showVersion $ version where content = [here|OVERVIEW hsinstall is a tool for installing a Haskell software project into a directory structure for deployment. It builds upon the `stack install` command and adds these features:@@ -139,4 +139,4 @@ In order to locate data files at runtime, including resources, the hsinstall project includes a library to construct the share path relative to the executable. See this source code for help with integrating this into your app: https://github.com/dino-/hsinstall/blob/master/src/lib/HSInstall/Resources.hs -Version {} Dino Morelli <dino@ui3.info>|]+Version %s Dino Morelli <dino@ui3.info>|]
src/app/HSInstall/System/Directory.hs view
@@ -7,10 +7,10 @@ import Control.Monad ( when ) import Data.List ( (\\) )-import Fmt ( (+|), (|+), fmtLn ) import System.Directory ( copyFile, createDirectoryIfMissing, doesDirectoryExist, getDirectoryContents ) import System.FilePath ( (</>) )+import Text.Printf ( printf ) {-@@ -52,7 +52,7 @@ let targetPath = baseTargetPath </> relativePath when chatty $- fmtLn $ "Copying "+|sourcePath|+" to "+|targetPath|+""+ printf "Copying %s to %s\n" sourcePath targetPath if isDir then createDirectoryIfMissing False targetPath
src/app/hsinstall.hs view
@@ -1,11 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} import Control.Monad ( when )-import Fmt ( (+|), (|+), fmtLn ) import qualified System.Directory as Dir import System.Exit ( exitSuccess ) import System.FilePath ( (</>) ) import System.Process ( callProcess )+import Text.Printf ( printf ) import HSInstall.AppImage ( mkAppImage, prepAppImageFiles ) import HSInstall.Common ( dumpStockIcon, tmplDir )@@ -37,7 +37,7 @@ modeToStackArg :: BuildMode -> String-modeToStackArg (AppImageExe exe) = ":"+|exe|+""+modeToStackArg (AppImageExe exe) = ':' : exe modeToStackArg Project = "" @@ -54,12 +54,12 @@ let licenseFile = "LICENSE" licenseFileExists <- Dir.doesFileExist licenseFile when licenseFileExists $ do- fmtLn $ "\nCopying "+|licenseFile|+""+ printf "\nCopying %s\n" licenseFile Dir.createDirectoryIfMissing True $ docDir di Dir.copyFile licenseFile (docDir di </> licenseFile) - -- Copy the static pack files+ -- Copy the static template directory tmplExists <- Dir.doesDirectoryExist tmplDir when tmplExists $ do- putStrLn ("\nCopying distribution files from template dir ("+|tmplDir|+")")+ printf "\nCopying distribution files from template dir (%s)\n" tmplDir copyTree False tmplDir (prefixDir di)
stack.yaml view
@@ -1,4 +1,4 @@-resolver: lts-14.8+resolver: lts-14.20 packages: - '.'
stack.yaml.lock view
@@ -6,7 +6,7 @@ packages: [] snapshots: - completed:- size: 524789- url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/8.yaml- sha256: 8af5eb80734f02621d37e82cc0cde614af2ddc9c320610acb0b1b6d9ac162930- original: lts-14.8+ size: 524154+ url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/20.yaml+ sha256: 2f5099f69ddb6abfe64400fe1e6a604e8e628f55e6837211cd70a81eb0a8fa4d+ original: lts-14.20