[arch-commits] Commit in postgrest/repos (3 files)

Felix Yan felixonmars at gemini.archlinux.org
Sat Jul 23 08:11:01 UTC 2022


    Date: Saturday, July 23, 2022 @ 08:11:01
  Author: felixonmars
Revision: 1255582

archrelease: copy trunk to community-staging-x86_64

Added:
  postgrest/repos/community-staging-x86_64/
  postgrest/repos/community-staging-x86_64/PKGBUILD
    (from rev 1255581, postgrest/trunk/PKGBUILD)
  postgrest/repos/community-staging-x86_64/protolude-0.3.1.patch
    (from rev 1255581, postgrest/trunk/protolude-0.3.1.patch)

-----------------------+
 PKGBUILD              |   78 ++++++++++++++++++++++++++++++++++++++++++++++++
 protolude-0.3.1.patch |   69 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 147 insertions(+)

Copied: postgrest/repos/community-staging-x86_64/PKGBUILD (from rev 1255581, postgrest/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD	                        (rev 0)
+++ community-staging-x86_64/PKGBUILD	2022-07-23 08:11:01 UTC (rev 1255582)
@@ -0,0 +1,78 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
+
+pkgname=postgrest
+pkgver=9.0.0
+pkgrel=8
+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-doctest' 'haskell-hspec'
+             'haskell-hspec-wai' 'haskell-hspec-wai-json' 'haskell-monad-control'
+             'haskell-pretty-simple' '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=('28f6828cc47d295e37c06aa845b14de71f87fdd1380ece04ba928b8301be2ee9561e0ae4edf78025780cf0d3512ba2694fdcd1df0d05e31fa0e704384aa4717b'
+            'eeac3a9bc7547482539c14e87c08bafa8bb4acb5863286613af3af93ff1f55c7e7c6c8c18f222b0b7c1d8ecb67eac4c5cdbc0c69e885f7716014b7cb5b1d7d23')
+
+prepare() {
+    cd $pkgname-$pkgver
+    uusi -u hasql -u hasql-pool -u hspec -u HTTP -u lens $pkgname.cabal
+
+    # TODO: not a proper fix. probably newly added "column" should be shown too
+    sed -i 's/SQL.RowError i/SQL.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 1255581, 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-23 08:11:01 UTC (rev 1255582)
@@ -0,0 +1,69 @@
+From de142b535530541476b73882f6ef5bdf3b73b76b Mon Sep 17 00:00:00 2001
+From: Laurence Isla <lau.isla.c at gmail.com>
+Date: Wed, 8 Jun 2022 11:41:39 -0500
+Subject: [PATCH] Upgrade protolude to 0.3.1
+
+---
+ nix/overlays/haskell-packages.nix         |  9 +++++++++
+ postgrest.cabal                           | 10 +++++-----
+ src/PostgREST/Config.hs                   |  6 +++---
+ src/PostgREST/Request/ApiRequest.hs       |  4 ++--
+ src/PostgREST/Request/DbRequestBuilder.hs |  2 +-
+ stack.yaml                                |  1 +
+ stack.yaml.lock                           | 24 ++++++++++++++++++-----
+ 7 files changed, 40 insertions(+), 16 deletions(-)
+
+diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs
+index d5d63cd92..06ed39d25 100644
+--- a/src/PostgREST/Config.hs
++++ b/src/PostgREST/Config.hs
+@@ -369,17 +369,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 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 of
++      case readMaybe $ T.toTitle $ T.filter isAlpha $ toS s of
+         Just b  -> Just b
+         -- numeric instead?
+-        Nothing -> (> 0) <$> (readMaybe $ toS s :: Maybe Integer)
++        Nothing -> (> 0) <$> (readMaybe s :: Maybe Integer)
+     coerceBool _            = Nothing
+ 
+     splitOnCommas :: C.Value -> [Text]
+diff --git a/src/PostgREST/Request/ApiRequest.hs b/src/PostgREST/Request/ApiRequest.hs
+index 00e076d1b..439a08aca 100644
+--- a/src/PostgREST/Request/ApiRequest.hs
++++ b/src/PostgREST/Request/ApiRequest.hs
+@@ -364,9 +364,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 Text 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 Text 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 35af9962d..88819079d 100644
+--- a/src/PostgREST/Request/DbRequestBuilder.hs
++++ b/src/PostgREST/Request/DbRequestBuilder.hs
+@@ -56,7 +56,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