exherbo-cabal 0.2.0.0 → 0.2.1.1
raw patch · 5 files changed
+57/−23 lines, 5 filesdep +deepseqdep +directorydep +filepathdep ~Cabaldep ~basedep ~haddock-libraryPVP ok
version bump matches the API change (PVP)
Dependencies added: deepseq, directory, filepath
Dependency ranges changed: Cabal, base, haddock-library
API changes (from Hackage documentation)
Files
- README.md +2/−0
- exherbo-cabal.cabal +20/−15
- src/ExRender.hs +1/−1
- src/ExRender/Base.hs +3/−3
- src/Main.hs +31/−4
README.md view
@@ -1,3 +1,5 @@+[](https://travis-ci.org/ony/exherbo-cabal)+ Description =========== Generate package description from .cabal files in format of exheres-0 for
exherbo-cabal.cabal view
@@ -1,16 +1,16 @@--- Initial exherbo-cabal.cabal generated by cabal init. For further +-- Initial exherbo-cabal.cabal generated by cabal init. For further -- documentation, see http://haskell.org/cabal/users-guide/ -- The name of the package. name: exherbo-cabal --- The package version. See the Haskell package versioning policy (PVP) +-- The package version. See the Haskell package versioning policy (PVP) -- for standards guiding when and how versions should be incremented. -- http://www.haskell.org/haskellwiki/Package_versioning_policy -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.2.0.0+version: 0.2.1.1 -- A short (one-line) description of the package. synopsis: Exheres generator for cabal packages@@ -28,24 +28,26 @@ -- The package author(s). author: Mykola Orliuk --- An email address to which users can send suggestions, bug reports, and +-- An email address to which users can send suggestions, bug reports, and -- patches. maintainer: virkony@gmail.com -- A copyright notice.--- copyright: +-- copyright: category: Distribution build-type: Simple --- Extra files to be distributed with the package, such as examples or a +-- Extra files to be distributed with the package, such as examples or a -- README. extra-source-files: README.md -- Constraint on the version of Cabal needed to build this package. cabal-version: >=1.10 +Tested-with: GHC == 7.10.3, GHC == 8.0.1+ source-repository head type: git location: https://github.com/ony/exherbo-cabal@@ -61,11 +63,11 @@ ExRender.License build-depends:- Cabal >=1.20 && <1.23,- base >=4.7 && <4.9,+ Cabal >=1.20 && <1.26,+ base >=4.7 && <5, containers, data-default >=0.2 && <1,- haddock-library >=1.0 && <1.3,+ haddock-library >=1.0 && <1.6, pretty >=1.1 && <1.2 hs-source-dirs: src@@ -77,7 +79,7 @@ ghc-options: -threaded main-is: src/doctests.hs build-depends:- base >=4.7 && <4.9,+ base >=4.7 && <5, doctest >=0.8 default-language: Haskell2010 @@ -85,9 +87,9 @@ ghc-options: -O3 -Wall -fwarn-tabs -fwarn-monomorphism-restriction -- .hs or .lhs file containing the Main module. main-is: src/Main.hs- + -- Modules included in this executable, other than Main.- + -- LANGUAGE extensions used by modules in this package. other-extensions: FlexibleInstances,@@ -98,16 +100,19 @@ -- Other library packages from which modules are imported. build-depends:- Cabal >=1.20 && <1.23,+ Cabal >=1.20 && <1.25, ansi-wl-pprint >=0.6 && <0.7,- base >=4.7 && <4.9,+ base >=4.7 && <5, bytestring >=0.10 && <0.11, data-default >=0.2 && <1,+ deepseq <1.5,+ directory <1.4, exherbo-cabal >=0.2 && <0.3,+ filepath <1.5, http-client >=0.4 && <0.5, http-types <1, optparse-applicative >=0.12 && <0.13, pcre-light <0.5- + -- Base language which the package is written in. default-language: Haskell2010
src/ExRender.hs view
@@ -167,7 +167,7 @@ -- | Render 'a' to a final Exheres exRenderPkg ∷ ExRenderPackage a ⇒ ExPackageEnv a → a → String-exRenderPkg env = render . exDispPkg env+exRenderPkg env = (++ "\n") . render . exDispPkg env -- |Sort dependencies according to Exherbo order sortDeps ∷ [Dependency] → [Dependency]
src/ExRender/Base.hs view
@@ -11,9 +11,9 @@ import Text.PrettyPrint --- | Wrap width soft limitt+-- | Wrap width soft limit exWrapWidth ∷ Int-exWrapWidth = 80+exWrapWidth = 100 class ExRender a where -- | Renders 'a' into a 'Doc' representing some part of exheres@@ -64,7 +64,7 @@ -- |Render a single-line with potential wrap meta-field of Exheres if non-empty value exField ∷ String → String → Doc exField _ "" = empty-exField name x | length singleLine < exWrapWidth = text singleLine+exField name x | length singleLine <= exWrapWidth = text singleLine | otherwise = exFieldDoc name (reflow exWrapWidth (dquoted x)) where singleLine = name ++ "=\"" ++ dquoted x ++ "\""
src/Main.hs view
@@ -10,6 +10,7 @@ import Control.Monad import Control.Concurrent (threadDelay) import Control.Exception+import Control.DeepSeq import Data.Maybe import Data.Default import Data.ByteString.Lazy.Char8 (unpack)@@ -17,6 +18,8 @@ import Options.Applicative import System.IO+import System.FilePath+import System.Directory import Distribution.Text import Distribution.Package@@ -28,7 +31,7 @@ import Network.HTTP.Client import Network.HTTP.Types -import Text.PrettyPrint.ANSI.Leijen hiding ((<>), (<$>), empty, text)+import Text.PrettyPrint.ANSI.Leijen hiding ((<>), (<$>), (</>), empty, text) import qualified Text.Regex.PCRE.Light.Char8 as R import ExRender@@ -51,7 +54,8 @@ isTemporary (fromException → Just (StatusCodeException e _ _)) = statusCode e `elem` [503] isTemporary _ = False req ← parseUrl url- withManager settings $ liftM (unpack . responseBody) . httpLbs req+ manager ← newManager settings+ liftM (unpack . responseBody) $ httpLbs req manager licenseHints ∷ [(R.Regex, License)] licenseHints = [@@ -132,6 +136,7 @@ data ExCabal = ExCabal { ghcVersion ∷ Version+ , destFolder ∷ Maybe FilePath , targets ∷ Maybe [TargetCabal] } deriving (Show)@@ -145,6 +150,12 @@ <> showDefaultWith display <> value (exGHCVersion def) )+ <*> optional (strOption+ ( long "dest-dir" <> short 'd'+ <> metavar "DIRECTORY"+ <> help ("Generate output into exheres-0 files under DIRECTORY " +++ "(usually repo/packages) instead of standart output.")+ )) <*> optional targetArguments main ∷ IO ()@@ -162,11 +173,26 @@ Nothing → liftM (map (either TargetInvalid id . targetParse) . lines) getContents + let output = case destFolder params of+ Nothing → const putStr -- output to stdout+ Just dirpath → \descr exheres → do+ let pkgId = package $ packageDescription descr+ pnv = display pkgId+ pn = display (pkgName pkgId)+ folder = dirpath </> "dev-haskell" </> pn+ filepath = folder </> (pnv ++ ".exheres-0")+ createDirectoryIfMissing True folder+ writeFile filepath exheres+ let generate source getDescr = do let handler ∷ SomeException → IO () handler e = hPutStrLn stderr $ "# Failed fetch/generate for " ++ show source ++ ": " ++ show e+ body = do+ descr ← getDescr+ let exheres = exRenderPkg env descr+ exheres `deepseq` output descr exheres hPutStrLn stderr $ "# Processing " ++ show source- catch (liftM (exRenderPkg env) getDescr >>= putStrLn) handler+ catch body handler forM_ targets' $ \case TargetInvalid err → hPutStrLn stderr $ "# Invalid target: " ++ err@@ -192,5 +218,6 @@ "> exherbo-cabal mtl transformers", "> echo yesod-core | exherbo-cabal", "> exherbo-cabal ./exherbo-cabal.cabal",- "> find /tmp/index -name \\*.cabal | exherbo-cabal"+ "> find /tmp/index -name \\*.cabal | exherbo-cabal",+ "> find /tmp/index -name \\*.cabal | exherbo-cabal --dest-dir hackage-repo/packages" ], mempty, "See https://github.com/ony/exherbo-cabal"]