[arch-commits] Commit in haskell-project-template/repos (3 files)
Felix Yan
felixonmars at archlinux.org
Sat Apr 25 23:59:39 UTC 2020
Date: Saturday, April 25, 2020 @ 23:59:39
Author: felixonmars
Revision: 621229
archrelease: copy trunk to community-staging-x86_64
Added:
haskell-project-template/repos/community-staging-x86_64/
haskell-project-template/repos/community-staging-x86_64/PKGBUILD
(from rev 621228, haskell-project-template/trunk/PKGBUILD)
haskell-project-template/repos/community-staging-x86_64/base64-bytestring-1.1.patch
(from rev 621228, haskell-project-template/trunk/base64-bytestring-1.1.patch)
-----------------------------+
PKGBUILD | 51 +++++++++++++++++++++
base64-bytestring-1.1.patch | 98 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 149 insertions(+)
Copied: haskell-project-template/repos/community-staging-x86_64/PKGBUILD (from rev 621228, haskell-project-template/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2020-04-25 23:59:39 UTC (rev 621229)
@@ -0,0 +1,51 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
+
+_hkgname=project-template
+pkgname=haskell-project-template
+pkgver=0.2.0.1
+pkgrel=225
+pkgdesc="Specify Haskell project templates and generate files"
+url="https://github.com/fpco/haskell-ide"
+license=("BSD")
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-base64-bytestring' 'haskell-conduit' 'haskell-conduit-extra'
+ 'haskell-resourcet')
+makedepends=('ghc' 'haskell-hspec' 'haskell-quickcheck')
+source=("https://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+ base64-bytestring-1.1.patch)
+sha512sums=('bc5824086ba8dfaff4ff64c5115d37ea5e496d7692f1120b11c2a878e522119d362c7d119ccf7b9cc064c58f9ce6382b5e24a69cdac5ac5d683c4d616e2c66ea'
+ 'c426265cdb54a4c62d4ea743cf381f07f20e0641daea194ab17afbb15ee74db968a030260beb39158594c10131b78b6aaa2c04160e8f50d5d69d166e2d932f02')
+
+prepare() {
+ cd $_hkgname-$pkgver
+ patch -p1 -i ../base64-bytestring-1.1.patch
+}
+
+build() {
+ cd $_hkgname-$pkgver
+
+ runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
+ --prefix=/usr --docdir=/usr/share/doc/$pkgname --enable-tests \
+ --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid
+ runhaskell Setup build
+ runhaskell Setup register --gen-script
+ runhaskell Setup unregister --gen-script
+ sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+ sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+check() {
+ cd $_hkgname-$pkgver
+ runhaskell Setup test
+}
+
+package() {
+ cd $_hkgname-$pkgver
+
+ install -D -m744 register.sh "$pkgdir"/usr/share/haskell/register/$pkgname.sh
+ install -D -m744 unregister.sh "$pkgdir"/usr/share/haskell/unregister/$pkgname.sh
+ runhaskell Setup copy --destdir="$pkgdir"
+ install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+ rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
+}
Copied: haskell-project-template/repos/community-staging-x86_64/base64-bytestring-1.1.patch (from rev 621228, haskell-project-template/trunk/base64-bytestring-1.1.patch)
===================================================================
--- community-staging-x86_64/base64-bytestring-1.1.patch (rev 0)
+++ community-staging-x86_64/base64-bytestring-1.1.patch 2020-04-25 23:59:39 UTC (rev 621229)
@@ -0,0 +1,98 @@
+--- project-template-0.2.0.1/Text/ProjectTemplate.hs.orig 2020-04-26 07:50:54.007400644 +0800
++++ project-template-0.2.0.1/Text/ProjectTemplate.hs 2020-04-26 07:56:46.698254606 +0800
+@@ -1,3 +1,4 @@
++{-# LANGUAGE BangPatterns #-}
+ {-# LANGUAGE DeriveDataTypeable #-}
+ {-# LANGUAGE FlexibleContexts #-}
+ {-# LANGUAGE MultiParamTypeClasses #-}
+@@ -15,6 +16,7 @@
+ , receiveFS
+ -- * Exceptions
+ , ProjectTemplateException (..)
++ , joinWith
+ ) where
+
+ import Control.Exception (Exception, assert)
+@@ -27,6 +29,7 @@
+ import Data.ByteString (ByteString)
+ import qualified Data.ByteString as S
+ import qualified Data.ByteString.Base64 as B64
++import Data.ByteString.Internal
+ import qualified Data.ByteString.Lazy as L
+ import Data.Conduit (ConduitM, await,
+ awaitForever, leftover, yield,
+@@ -42,6 +45,8 @@
+ import Data.Text.Encoding (encodeUtf8)
+ import Data.Typeable (Typeable)
+ import Data.Void (Void)
++import Foreign.ForeignPtr (withForeignPtr)
++import Foreign.Ptr (minusPtr, plusPtr)
+ import System.Directory (createDirectoryIfMissing)
+ import System.FilePath (takeDirectory, (</>))
+
+@@ -57,7 +62,7 @@
+ yield "{-# START_FILE BASE64 "
+ yield $ encodeUtf8 $ T.pack fp
+ yield " #-}\n"
+- yield $ B64.joinWith "\n" 76 $ B64.encode bs
++ yield $ joinWith "\n" 76 $ B64.encode bs
+ yield "\n"
+ Just _ -> do
+ yield "{-# START_FILE "
+@@ -194,3 +199,45 @@
+
+ assertion1 = assert $ S.length bs1 < size
+ assertion2 = assert $ S.length bs1' `mod` size == 0
++
++-- | Efficiently intersperse a terminator string into another at
++-- regular intervals, and terminate the input with it.
++--
++-- Examples:
++--
++-- > joinWith "|" 2 "----" = "--|--|"
++--
++-- > joinWith "\r\n" 3 "foobarbaz" = "foo\r\nbar\r\nbaz\r\n"
++-- > joinWith "x" 3 "fo" = "fox"
++joinWith :: ByteString -- ^ String to intersperse and end with
++ -> Int -- ^ Interval at which to intersperse, in bytes
++ -> ByteString -- ^ String to transform
++ -> ByteString
++joinWith brk@(PS bfp boff blen) every' bs@(PS sfp soff slen)
++ | every' <= 0 = error "invalid interval"
++ | blen <= 0 = bs
++ | S.null bs = brk
++ | otherwise =
++ unsafeCreate dlen $ \dptr ->
++ withForeignPtr bfp $ \bptr -> do
++ withForeignPtr sfp $ \sptr -> do
++ let bp = bptr `plusPtr` boff
++ sp0 = sptr `plusPtr` soff
++ sEnd = sp0 `plusPtr` slen
++ dLast = dptr `plusPtr` dlen
++ loop !dp !sp !written
++ | dp == dLast = return ()
++ | otherwise = do
++ let chunkSize = min every (sEnd `minusPtr` sp)
++ memcpy dp sp (fromIntegral chunkSize)
++ let dp' = dp `plusPtr` chunkSize
++ memcpy dp' bp (fromIntegral blen)
++ let written' = written + chunkSize + blen
++ assert (written' <= dlen) $
++ loop (dp' `plusPtr` blen) (sp `plusPtr` chunkSize) written'
++ loop dptr sp0 0
++ where dlast = slen + blen * numBreaks
++ every = min slen every'
++ dlen | rmndr > 0 = dlast + blen
++ | otherwise = dlast
++ (numBreaks, rmndr) = slen `divMod` every
+--- project-template-0.2.0.1/test/Text/ProjectTemplateSpec.hs.orig 2020-04-26 07:57:51.111744199 +0800
++++ project-template-0.2.0.1/test/Text/ProjectTemplateSpec.hs 2020-04-26 07:58:20.858483053 +0800
+@@ -31,7 +31,7 @@
+ describe "binaries" $ do
+ prop "works with multilines" $ \words' -> do
+ let bs = S.pack words'
+- encoded = B64.joinWith "\n" 5 $ B64.encode bs
++ encoded = joinWith "\n" 5 $ B64.encode bs
+ content = "{-# START_FILE BASE64 foo #-}\n" `mappend` encoded
+ m <- execWriterT $ runConduit $ yield content .| unpackTemplate receiveMem id
+ Map.lookup "foo" m `shouldBe` Just (L.fromChunks [bs])
More information about the arch-commits
mailing list