Date: Tuesday, May 22, 2018 @ 10:16:43 Author: felixonmars Revision: 326882
upgpkg: hindent 5.2.5-28 rebuild with ghc 8.4.2 Added: hindent/trunk/ghc-8.4.patch Modified: hindent/trunk/PKGBUILD ---------------+ PKGBUILD | 17 +++++++++---- ghc-8.4.patch | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 5 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2018-05-22 10:11:10 UTC (rev 326881) +++ PKGBUILD 2018-05-22 10:16:43 UTC (rev 326882) @@ -4,18 +4,25 @@ pkgname=hindent pkgver=5.2.5 -pkgrel=27 +pkgrel=28 pkgdesc="Extensible Haskell pretty printer" url="https://github.com/commercialhaskell/hindent" license=("custom:BSD3") arch=('x86_64') -depends=('ghc-libs' 'haskell-descriptive' 'haskell-exceptions' 'haskell-monad-loops' 'haskell-mtl' - 'haskell-path' 'haskell-path-io' 'haskell-src-exts' 'haskell-text' 'haskell-unix-compat' +depends=('ghc-libs' 'haskell-descriptive' 'haskell-exceptions' 'haskell-monad-loops' + 'haskell-path' 'haskell-path-io' 'haskell-src-exts' 'haskell-unix-compat' 'haskell-utf8-string' 'haskell-yaml') makedepends=('ghc' 'haskell-diff' 'haskell-hspec') -source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz") -sha512sums=('72a6b57ad5a2514ae7d3dd39d87b92757c8a5c85b60daad1e883ebb20385de3d4794b5f9550653b48cf682e5476b38d5dfaf348caec05df3d4396f3aa0f743ef') +source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz" + ghc-8.4.patch) +sha512sums=('72a6b57ad5a2514ae7d3dd39d87b92757c8a5c85b60daad1e883ebb20385de3d4794b5f9550653b48cf682e5476b38d5dfaf348caec05df3d4396f3aa0f743ef' + '32d8f5f3df69ec204afc2ec6afee28c05670137285bb6ff3978d5ae729e0e67830d7cfe7c5775dd5ced0bbd93270d9f73f8c93282f3eaaded48d023e88ccdc72') +prepare() { + cd $pkgname-$pkgver + patch -p1 -i ../ghc-8.4.patch +} + build() { cd $pkgname-$pkgver Added: ghc-8.4.patch =================================================================== --- ghc-8.4.patch (rev 0) +++ ghc-8.4.patch 2018-05-22 10:16:43 UTC (rev 326882) @@ -0,0 +1,72 @@ +From f0ac1ebed87bde6d93dbe5eac42ff5b5fb23e7ee Mon Sep 17 00:00:00 2001 +From: Rob Looby <[email protected]> +Date: Fri, 11 May 2018 13:12:07 -0500 +Subject: [PATCH] Make work with lts-11 and ghc-8.4.2 nightly build + +--- + .travis.yml | 6 +++++- + src/HIndent/CabalFile.hs | 28 ++++++++++++++++++++++++---- + stack.yaml | 7 ++++--- + 3 files changed, 33 insertions(+), 8 deletions(-) + +diff --git a/src/HIndent/CabalFile.hs b/src/HIndent/CabalFile.hs +index 083d965..d8c731e 100644 +--- a/src/HIndent/CabalFile.hs ++++ b/src/HIndent/CabalFile.hs +@@ -1,14 +1,21 @@ ++{-# LANGUAGE CPP #-} ++ + module HIndent.CabalFile + ( getCabalExtensionsForSourcePath + ) where + ++import qualified Data.ByteString as BS + import Data.List + import Data.Maybe + import Data.Traversable + import Distribution.ModuleName + import Distribution.PackageDescription + import Distribution.PackageDescription.Configuration ++#if MIN_VERSION_Cabal(2, 2, 0) ++import Distribution.PackageDescription.Parsec ++#else + import Distribution.PackageDescription.Parse ++#endif + import Language.Haskell.Extension + import qualified Language.Haskell.Exts.Extension as HSE + import System.Directory +@@ -82,6 +89,19 @@ findCabalFiles dir rel = do + [] -> findCabalFiles (takeDirectory dir) (takeFileName dir </> rel) + _ -> return $ Just (fmap (\n -> dir </> n) cabalnames, rel) + ++getGenericPackageDescription :: FilePath -> IO (Maybe GenericPackageDescription) ++#if MIN_VERSION_Cabal(2, 2, 0) ++getGenericPackageDescription cabalPath = do ++ cabaltext <- BS.readFile cabalPath ++ return $ parseGenericPackageDescriptionMaybe cabaltext ++#else ++getGenericPackageDescription cabalPath = do ++ cabaltext <- readFile cabalPath ++ case parsePackageDescription cabaltext of ++ ParseOk _ gpd -> return $ Just gpd ++ _ -> return Nothing ++#endif ++ + -- | Find the `Stanza` that refers to this source path + getCabalStanza :: FilePath -> IO (Maybe Stanza) + getCabalStanza srcpath = do +@@ -91,10 +111,10 @@ getCabalStanza srcpath = do + Just (cabalpaths, relpath) -> do + stanzass <- + for cabalpaths $ \cabalpath -> do +- cabaltext <- readFile cabalpath +- case parsePackageDescription cabaltext of +- ParseFailed _ -> return [] +- ParseOk _ gpd -> do ++ genericPackageDescription <- getGenericPackageDescription cabalpath ++ case genericPackageDescription of ++ Nothing -> return [] ++ Just gpd -> do + return $ packageStanzas $ flattenPackageDescription gpd + return $ + case filter (\stanza -> stanzaIsSourceFilePath stanza relpath) $
