[arch-commits] Commit in postgrest/repos (3 files)
Felix Yan
felixonmars at gemini.archlinux.org
Fri Jul 8 21:59:02 UTC 2022
Date: Friday, July 8, 2022 @ 21:59:02
Author: felixonmars
Revision: 1248943
archrelease: copy trunk to community-staging-x86_64
Added:
postgrest/repos/community-staging-x86_64/
postgrest/repos/community-staging-x86_64/PKGBUILD
(from rev 1248942, postgrest/trunk/PKGBUILD)
postgrest/repos/community-staging-x86_64/protolude-0.3.1.patch
(from rev 1248942, postgrest/trunk/protolude-0.3.1.patch)
-----------------------+
PKGBUILD | 77 ++++++++++++++++++++++++++++++
protolude-0.3.1.patch | 123 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 200 insertions(+)
Copied: postgrest/repos/community-staging-x86_64/PKGBUILD (from rev 1248942, postgrest/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2022-07-08 21:59:02 UTC (rev 1248943)
@@ -0,0 +1,77 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
+
+pkgname=postgrest
+pkgver=8.0.0
+pkgrel=235
+pkgdesc="REST API for any Postgres database"
+url="https://github.com/begriffs/postgrest"
+license=("MIT")
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-http' 'haskell-ranged-sets' 'haskell-aeson' 'haskell-ansi-wl-pprint'
+ 'haskell-base64-bytestring' 'haskell-case-insensitive' 'haskell-cassava'
+ 'haskell-configurator-pg' 'haskell-contravariant' 'haskell-contravariant-extras'
+ 'haskell-cookie' 'haskell-either' 'haskell-fast-logger' 'haskell-gitrev' 'haskell-hasql'
+ 'haskell-hasql-dynamic-statements' 'haskell-hasql-notifications' 'haskell-hasql-pool'
+ 'haskell-hasql-transaction' 'haskell-heredoc' 'haskell-http-types'
+ 'haskell-insert-ordered-containers' 'haskell-interpolatedstring-perl6' 'haskell-jose'
+ 'haskell-lens' 'haskell-lens-aeson' 'haskell-network-uri' 'haskell-optparse-applicative'
+ 'haskell-protolude' 'haskell-regex-tdfa' 'haskell-scientific'
+ 'haskell-swagger2' 'haskell-unordered-containers' 'haskell-vector' 'haskell-wai'
+ 'haskell-wai-cors' 'haskell-wai-extra' 'haskell-wai-logger' 'haskell-wai-middleware-static'
+ 'haskell-auto-update' 'haskell-retry' 'haskell-warp')
+makedepends=('ghc' 'uusi' 'haskell-aeson-qq' 'haskell-async' 'haskell-hspec' 'haskell-hspec-wai'
+ 'haskell-hspec-wai-json' 'haskell-monad-control' 'haskell-transformers-base')
+checkdepends=('pifpaf' 'postgresql' 'procps-ng')
+source=("https://github.com/begriffs/postgrest/archive/v$pkgver/$pkgname-$pkgver.tar.gz"
+ protolude-0.3.1.patch)
+sha512sums=('ae3f004d3042e236ffd3870c980cdfbb615a3de5433bd917816e8c0e719edb0bfcba763bb3c920dad64461410374231a6ab7710d48b310cdc30d5dd6f1f58337'
+ '29132a1f8d432f02177dc42c2044cb8e707978372956830c490984295f4ebcff7256ef119006204e97b7d57fcf80054d5d3ed2ad65746653f2685158e333e67e')
+
+prepare() {
+ cd $pkgname-$pkgver
+ uusi -u base -u hasql -u hasql-pool -u hspec -u HTTP -u lens -u retry $pkgname.cabal
+
+ # TODO: not a proper fix. probably newly added "column" should be shown too
+ sed -i 's/H.RowError i/H.RowError i _/' src/PostgREST/Error.hs
+
+ patch -p1 -i ../protolude-0.3.1.patch
+}
+
+build() {
+ cd $pkgname-$pkgver
+
+ runhaskell Setup configure -O --enable-shared --enable-executable-dynamic --disable-library-vanilla \
+ --prefix=/usr --docdir=/usr/share/doc/$pkgname --datasubdir=$pkgname --enable-tests \
+ --dynlibdir=/usr/lib --libsubdir=\$compiler/site-local/\$pkgid --ghc-option=-fllvm \
+ -f-CI --ghc-option='-pie'
+ runhaskell Setup build $MAKEFLAGS
+ 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 $pkgname-$pkgver
+
+ eval $(pifpaf run postgresql --host 127.0.0.1)
+ createuser -s postgrest_test
+ # https://github.com/PostgREST/postgrest/issues/1857
+ POSTGREST_TEST_CONNECTION=$(test/create_test_db "postgres://$USER@localhost" postgrest_test) runhaskell Setup test --show-details=direct || echo "Tests failed"
+
+ # Disabled: uses stack
+ # test/io-tests.sh
+
+ pifpaf_stop
+}
+
+package() {
+ cd $pkgname-$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: postgrest/repos/community-staging-x86_64/protolude-0.3.1.patch (from rev 1248942, postgrest/trunk/protolude-0.3.1.patch)
===================================================================
--- community-staging-x86_64/protolude-0.3.1.patch (rev 0)
+++ community-staging-x86_64/protolude-0.3.1.patch 2022-07-08 21:59:02 UTC (rev 1248943)
@@ -0,0 +1,123 @@
+From 47b13f4c99e89c958ed817cc2df56f46599f54a8 Mon Sep 17 00:00:00 2001
+From: Laurence Isla <lau.isla.c at gmail.com>
+Date: Mon, 6 Jun 2022 21:25:11 -0500
+Subject: [PATCH 1/3] Fix Config.hs cabal build
+
+---
+ src/PostgREST/Config.hs | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs
+index 9dbd08529..3fd9e6245 100644
+--- a/src/PostgREST/Config.hs
++++ b/src/PostgREST/Config.hs
+@@ -359,17 +359,17 @@ parser optPath env dbSettings =
+
+ coerceInt :: (Read i, Integral i) => C.Value -> Maybe i
+ coerceInt (C.Number x) = rightToMaybe $ floatingOrInteger x
+- coerceInt (C.String x) = readMaybe $ toS x
++ coerceInt (C.String x) = readMaybe (toS x :: [Char])
+ coerceInt _ = Nothing
+
+ coerceBool :: C.Value -> Maybe Bool
+ coerceBool (C.Bool b) = Just b
+ coerceBool (C.String s) =
+ -- parse all kinds of text: True, true, TRUE, "true", ...
+- case readMaybe . toS $ T.toTitle $ T.filter isAlpha $ toS s of
++ case readMaybe (toS $ T.toTitle $ T.filter isAlpha $ toS s :: [Char]) of
+ Just b -> Just b
+ -- numeric instead?
+- Nothing -> (> 0) <$> (readMaybe $ toS s :: Maybe Integer)
++ Nothing -> (> 0) <$> (readMaybe (toS s :: [Char]) :: Maybe Integer)
+ coerceBool _ = Nothing
+
+ splitOnCommas :: C.Value -> [Text]
+
+From ee86d0d2a8d71e294531dd2d3410fe8facf3c873 Mon Sep 17 00:00:00 2001
+From: Laurence Isla <lau.isla.c at gmail.com>
+Date: Tue, 7 Jun 2022 18:11:46 -0500
+Subject: [PATCH 2/3] Upgrade protolude to 0.3.1
+
+---
+ nix/overlays/haskell-packages.nix | 9 +++++++++
+ postgrest.cabal | 10 +++++-----
+ src/PostgREST/Config.hs | 6 +++---
+ src/PostgREST/Request/QueryParams.hs | 4 ++--
+ stack.yaml | 1 +
+ 5 files changed, 20 insertions(+), 10 deletions(-)
+
+diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs
+index 3fd9e6245..a623ed264 100644
+--- a/src/PostgREST/Config.hs
++++ b/src/PostgREST/Config.hs
+@@ -359,17 +359,17 @@ parser optPath env dbSettings =
+
+ coerceInt :: (Read i, Integral i) => C.Value -> Maybe i
+ coerceInt (C.Number x) = rightToMaybe $ floatingOrInteger x
+- coerceInt (C.String x) = readMaybe (toS x :: [Char])
++ coerceInt (C.String x) = readMaybe x
+ coerceInt _ = Nothing
+
+ coerceBool :: C.Value -> Maybe Bool
+ coerceBool (C.Bool b) = Just b
+ coerceBool (C.String s) =
+ -- parse all kinds of text: True, true, TRUE, "true", ...
+- case readMaybe (toS $ T.toTitle $ T.filter isAlpha $ toS s :: [Char]) of
++ case readMaybe $ T.toTitle $ T.filter isAlpha $ toS s of
+ Just b -> Just b
+ -- numeric instead?
+- Nothing -> (> 0) <$> (readMaybe (toS s :: [Char]) :: Maybe Integer)
++ Nothing -> (> 0) <$> (readMaybe s :: Maybe Integer)
+ coerceBool _ = Nothing
+
+ splitOnCommas :: C.Value -> [Text]
+diff --git a/src/PostgREST/RangeQuery.hs b/src/PostgREST/RangeQuery.hs
+index 8e77146..8d4a46a 100644
+--- a/src/PostgREST/RangeQuery.hs
++++ b/src/PostgREST/RangeQuery.hs
+@@ -27,7 +27,6 @@ import Network.HTTP.Types.Header
+ import Network.HTTP.Types.Status
+
+ import Protolude hiding (toS)
+-import Protolude.Conv (toS)
+
+ type NonnegRange = Range Integer
+
+@@ -37,7 +36,7 @@ rangeParse range = do
+
+ case listToMaybe (range =~ rangeRegex :: [[BS.ByteString]]) of
+ Just parsedRange ->
+- let [_, mLower, mUpper] = readMaybe . toS <$> parsedRange
++ let [_, mLower, mUpper] = readMaybe <$> parsedRange
+ lower = maybe emptyRange rangeGeq mLower
+ upper = maybe allRange rangeLeq mUpper in
+ rangeIntersection lower upper
+diff --git a/src/PostgREST/Request/ApiRequest.hs b/src/PostgREST/Request/ApiRequest.hs
+index dbf73bf..c3ff6db 100644
+--- a/src/PostgREST/Request/ApiRequest.hs
++++ b/src/PostgREST/Request/ApiRequest.hs
+@@ -377,9 +377,9 @@ userApiRequest conf at AppConfig{..} dbStructure req reqBody
+ headerRange = rangeRequested hdrs
+ replaceLast x s = T.intercalate "." $ L.init (T.split (=='.') s) ++ [x]
+ limitParams :: M.HashMap ByteString NonnegRange
+- limitParams = M.fromList [(toS (replaceLast "limit" k), restrictRange (readMaybe . toS =<< v) allRange) | (k,v) <- qParams, isJust v, endingIn ["limit"] k]
++ limitParams = M.fromList [(toS (replaceLast "limit" k), restrictRange (readMaybe =<< v) allRange) | (k,v) <- qParams, isJust v, endingIn ["limit"] k]
+ offsetParams :: M.HashMap ByteString NonnegRange
+- offsetParams = M.fromList [(toS (replaceLast "limit" k), maybe allRange rangeGeq (readMaybe . toS =<< v)) | (k,v) <- qParams, isJust v, endingIn ["offset"] k]
++ offsetParams = M.fromList [(toS (replaceLast "limit" k), maybe allRange rangeGeq (readMaybe =<< v)) | (k,v) <- qParams, isJust v, endingIn ["offset"] k]
+
+ urlRange = M.unionWith f limitParams offsetParams
+ where
+diff --git a/src/PostgREST/Request/DbRequestBuilder.hs b/src/PostgREST/Request/DbRequestBuilder.hs
+index abd44c3..489cc4e 100644
+--- a/src/PostgREST/Request/DbRequestBuilder.hs
++++ b/src/PostgREST/Request/DbRequestBuilder.hs
+@@ -53,7 +53,7 @@ import PostgREST.Request.Types
+
+ import qualified PostgREST.DbStructure.Relationship as Relationship
+
+-import Protolude hiding (from)
++import Protolude hiding (from, isInfixOf)
+
+ -- | Builds the ReadRequest tree on a number of stages.
+ -- | Adds filters, order, limits on its respective nodes.
More information about the arch-commits
mailing list