Fix up devel/git-annex for ghc-9.2.2

Missing dependencies releases result in somewhat questionable patching
practice.

ok kili@
This commit is contained in:
gnezdo 2022-04-30 02:38:58 +00:00
parent ea68ad6fba
commit 4a818343b2
5 changed files with 525 additions and 25 deletions

View File

@ -26,9 +26,21 @@ MAKE_ENV = LC_ALL=en_US.UTF-8
MODCABAL_STEM = git-annex
MODCABAL_VERSION = 10.20220322
MODCABAL_BUILD_ARGS = --allow-newer
MAN1_STAGING_DIR = ${WRKBUILD}/man1_staging
# Two dependencies don't have new releases yet. This is a rare situation
# and so far there was no need to patch the dependencies. Thus it is
# done ad-hoc instead of supporting directly via normal `make patch`.
# If this code doesn't disappear by 2023, it'd make sense to support
# this flow properly in cabal.port.mk.
post-patch:
# https://github.com/bos/bloomfilter/pull/20
${PATCH} -d ${WRKDIR}/bloomfilter-2.0.1.0 < ${PATCHDIR}/0001-Fix-build-with-GHC-9.2.patch
# https://github.com/aristidb/aws/pull/277
${PATCH} -d ${WRKDIR}/aws-0.22 < ${PATCHDIR}/0001-build-with-aeson-2.patch
post-build:
@mkdir -p ${MAN1_STAGING_DIR}
@for source in \
@ -58,7 +70,7 @@ MODCABAL_MANIFEST = \
abstract-deque 0.3 0 \
abstract-par 0.3.3 0 \
adjunctions 4.4 2 \
aeson 1.5.6.0 5 \
aeson 2.0.3.0 0 \
alex 3.2.7.1 0 \
ansi-terminal 0.11.1 0 \
ansi-wl-pprint 0.6.9 3 \
@ -133,11 +145,11 @@ MODCABAL_MANIFEST = \
fast-logger 3.1.1 0 \
feed 1.3.2.1 0 \
file-embed 0.0.15.0 0 \
filepath-bytestring 1.4.2.1.9 0 \
filepath-bytestring 1.4.2.1.10 0 \
free 5.1.7 1 \
git-lfs 1.2.0 0 \
happy 1.20.0 0 \
hashable 1.3.5.0 1 \
hashable 1.4.0.2 0 \
hjsmin 0.2.0.4 2 \
hourglass 0.2.12 0 \
hsc2hs 0.68.8 0 \
@ -188,7 +200,7 @@ MODCABAL_MANIFEST = \
parallel 3.2.2.0 4 \
path-pieces 0.2.1 1 \
pem 0.2.4 0 \
persistent 2.13.3.4 0 \
persistent 2.14.0.0 0 \
persistent-sqlite 2.13.1.0 0 \
persistent-template 2.12.0.0 0 \
primitive 0.7.3.0 0 \
@ -204,6 +216,7 @@ MODCABAL_MANIFEST = \
sandi 0.5 1 \
scientific 0.3.7.0 2 \
securemem 0.1.10 0 \
semialign 1.2.0.1 1 \
semigroupoids 5.3.7 0 \
semigroups 0.20 0 \
setenv 0.1.1.3 1 \
@ -258,11 +271,12 @@ MODCABAL_MANIFEST = \
void 0.7.3 0 \
wai 3.2.3 0 \
wai-app-static 3.1.7.4 0 \
wai-extra 3.1.8 0 \
wai-extra 3.1.10 0 \
wai-logger 2.4.0 0 \
warp 3.3.20 0 \
warp-tls 3.3.2 0 \
wcwidth 0.0.2 0 \
witherable 0.4.2 2 \
word8 0.1.3 0 \
x509 1.7.6 0 \
x509-store 1.6.9 0 \
@ -274,9 +288,9 @@ MODCABAL_MANIFEST = \
xss-sanitize 0.3.7 1 \
yaml 0.11.8.0 0 \
yesod 1.6.2 0 \
yesod-core 1.6.22.0 0 \
yesod-core 1.6.23 0 \
yesod-form 1.7.0 0 \
yesod-persistent 1.6.0.7 0 \
yesod-persistent 1.6.0.8 0 \
yesod-static 1.6.1.0 0 \
zlib 0.6.2.3 1 \

View File

@ -15,8 +15,7 @@ SHA256 (hackage/abstract-deque-0.3.tar.gz) = CaoQ84GTqCdad5G5Kk86cZKjBIdGN+KjXIl
SHA256 (hackage/abstract-par-0.3.3.tar.gz) = JIqHOb2QJGLLFnVbaQtVZg4ZbljMfm74FXpywqPV2GA=
SHA256 (hackage/adjunctions-4.4.tar.gz) = UHwu9VM3rmHIBfjLwSE9/X0rhRhzQmddZiJUuNihauk=
SHA256 (hackage/adjunctions-4.4_2.cabal) = JzjdX11ek3Sa2xSgVHLlipanXQ8pnkY3HG9G3E6X2vk=
SHA256 (hackage/aeson-1.5.6.0.tar.gz) = A2HDS+PS7JRSAfAlAWk0NvvaENzFSUaUgaCEst4iv+g=
SHA256 (hackage/aeson-1.5.6.0_5.cabal) = UAO7b9Jg0uLVpR3uK/XI6PKeTg4CiP74BcItzIDsqwY=
SHA256 (hackage/aeson-2.0.3.0.tar.gz) = GXYKK4R2T6PO5lxj3wyA1FSX4vDDuV1ObcIIO4YEsyU=
SHA256 (hackage/alex-3.2.7.1.tar.gz) = m9Lxon6PGy/9tbL70+2CtvDoUZFFmhsk/8vvTmioG+w=
SHA256 (hackage/ansi-terminal-0.11.1.tar.gz) = rlTaBmSTdHBZwSjsZrAKsWaN8xhGDRM3zsKLRETbcis=
SHA256 (hackage/ansi-wl-pprint-0.6.9.tar.gz) = p7Lo580/AvKVTosX3GCgzNiJ9J4gaOuxWr+h1C96Tqw=
@ -116,14 +115,13 @@ SHA256 (hackage/entropy-0.4.1.7.tar.gz) = qQY9/rVmtEPm6hAfvMIvI9jOyLlgC/0TeLDsrf
SHA256 (hackage/fast-logger-3.1.1.tar.gz) = Q19ufgdxubUlVQwpKpQatXJrIz59kf3spwfjzbUxqOc=
SHA256 (hackage/feed-1.3.2.1.tar.gz) = qPVAcu2q9+l4Biud6Ucz6MxD4xst2jRG+QG/V/GBWVU=
SHA256 (hackage/file-embed-0.0.15.0.tar.gz) = 8Ga4XVN6ICUvqllIn2qFTk6POQgPCHMMnhleQYzsW90=
SHA256 (hackage/filepath-bytestring-1.4.2.1.9.tar.gz) = Z9KdHUUiMPN9FdIJoUvjMJwsEHmKZEKoiav+2SvpS7Y=
SHA256 (hackage/filepath-bytestring-1.4.2.1.10.tar.gz) = WYmzcw9mqzPNo9Ssa9kK2cq1RFKAzXttjDNKRRr1jls=
SHA256 (hackage/free-5.1.7.tar.gz) = sjDR5+a9Daa4ocg/4MFgnLUQu+yf73gEs2BM2XlAK4g=
SHA256 (hackage/free-5.1.7_1.cabal) = i/sOdQEF2VPUA6YNHlNaTl67pxEsooGKcMXUE648bXQ=
SHA256 (hackage/git-annex-10.20220322.tar.gz) = e5m0mcWpTtQCavvHIecwDb6hou91WW1uEXMUTgUL+4A=
SHA256 (hackage/git-lfs-1.2.0.tar.gz) = atGAOgtnJfy+SaywPeBx9r5IJbw6j59Ujbryd1jQY8c=
SHA256 (hackage/happy-1.20.0.tar.gz) = Ox06j5OicjtVTZ8Hss0Ta+GnsvyrGFWxK3qrXLrIhow=
SHA256 (hackage/hashable-1.3.5.0.tar.gz) = uqrYLNQnGxlwFr2+dvItXD05E/44U0zsfYF9ubrhmIY=
SHA256 (hackage/hashable-1.3.5.0_1.cabal) = Oivur7Ig+d5wZWin5KWzx2LMTJ8lyU1+95W4wtamkdc=
SHA256 (hackage/hashable-1.4.0.2.tar.gz) = g2Bu3TVtkUwHXs1E9tX+kaOxhqoGg8jdjJp+jiKkdgA=
SHA256 (hackage/hjsmin-0.2.0.4.tar.gz) = gbmUdxTY0rc9CrqeLgKvfjDBOyz4FE34kEVk2WQuV+Q=
SHA256 (hackage/hjsmin-0.2.0.4_2.cabal) = ToEmDwGQgfG91+TihbNfLwnuqD/5zXIaqk4LqXkij6A=
SHA256 (hackage/hourglass-0.2.12.tar.gz) = RDNbXEAugMYPHbanRGK+TqKdGpBDqplDNP/uEWTxyko=
@ -190,7 +188,7 @@ SHA256 (hackage/parallel-3.2.2.0_4.cabal) = Gf9jHzom7nzwYD4rgPw3XXfT81CuRgrnL+TP
SHA256 (hackage/path-pieces-0.2.1.tar.gz) = CAvUn1PiBZfKPlli4MJ5o0IjRfWwiIQKMKdRzXbUo28=
SHA256 (hackage/path-pieces-0.2.1_1.cabal) = xxOo0Es+a4nxEWwdX+Q0MFAx4XqfCtMKRXqEAuHV/Fw=
SHA256 (hackage/pem-0.2.4.tar.gz) = dwxMG5zSSz239RH4pIQEoNCYmZ4oVzw3Q6iilruW+NQ=
SHA256 (hackage/persistent-2.13.3.4.tar.gz) = f+TT6jyZf3cLccOrKLnHeaSyFxX1faM7R23vx2IMgcI=
SHA256 (hackage/persistent-2.14.0.0.tar.gz) = 4cDoPotF2WPKnSQ7RSqhn79wQ8Ue3Tr5lmzc9oFIY5k=
SHA256 (hackage/persistent-sqlite-2.13.1.0.tar.gz) = KyiF9OgDG71fNCVJxfu0jNbDSJkw6mQb9caBsC0oBv0=
SHA256 (hackage/persistent-template-2.12.0.0.tar.gz) = 3EiLVn03Pr+/Xz34u6JA5iA9GxNVaHJkjV8NIo/QLDE=
SHA256 (hackage/primitive-0.7.3.0.tar.gz) = PAz9pn8e5vf2UQitb5c7W7s13bo0s8h3RqdEj3h1Adw=
@ -211,6 +209,8 @@ SHA256 (hackage/sandi-0.5_1.cabal) = snjQcspxdwbqOPm9ZG4CP38ldqd4+0NWW0NPk2OISao
SHA256 (hackage/scientific-0.3.7.0.tar.gz) = o6EhxLPWj7i5+McJqwEuSPCQ7VU2CSR6gFrQcNazQ6k=
SHA256 (hackage/scientific-0.3.7.0_2.cabal) = dkZagr6yr26oPr0AaErMD/5lnn2nBmMpkx3I8C/JdQc=
SHA256 (hackage/securemem-0.1.10.tar.gz) = MolaR0hQjaWCB7SGcmZgGvYlm3EJr4C79dLp5ZjgFqY=
SHA256 (hackage/semialign-1.2.0.1.tar.gz) = 2QBpcEGuSwzKMkMnOis+gLz3TZN0Bdal/zTcM+6VITI=
SHA256 (hackage/semialign-1.2.0.1_1.cabal) = DhebTTqO/3kAHTdNbJGRfGIhaWuWIPCk2GhS/GqblQE=
SHA256 (hackage/semigroupoids-5.3.7.tar.gz) = bUXNtsWMdcpYiFm4CyyStvSFkKA+Blwkzl12emqWN5k=
SHA256 (hackage/semigroups-0.20.tar.gz) = kC0uM8lrQKid5ZV/Kp4JcZevzDXiV+RbMuvncJk2c+E=
SHA256 (hackage/setenv-0.1.1.3.tar.gz) = 41jfOa/APVo54uxlBlLYRchcgMyY/jMWVN6vtHZ+yzI=
@ -284,11 +284,13 @@ SHA256 (hackage/vector-th-unbox-0.2.2_1.cabal) = loN8kgVmAAbd9RXF+Surglzy5Z/IC31
SHA256 (hackage/void-0.7.3.tar.gz) = U691jdw33GOYFnHlA0ONAsb2Si2HROm+xVeolEMfcxc=
SHA256 (hackage/wai-3.2.3.tar.gz) = VXTWVBAAmI/iBNMDLbh/0KVATNveM+5PoC5gBnaCKfg=
SHA256 (hackage/wai-app-static-3.1.7.4.tar.gz) = ZHGIREsZ3JU7v7q1YRyBweHyfDG6xdwx3V3ifNvwH8E=
SHA256 (hackage/wai-extra-3.1.8.tar.gz) = tHxICvy4KTQBioiRpese10Ha13haug3Km2MRMEBurzU=
SHA256 (hackage/wai-extra-3.1.10.tar.gz) = eZrar4rDkUxgmLTHcqyVcpFHNvdKEl+EqmMC+STjv1E=
SHA256 (hackage/wai-logger-2.4.0.tar.gz) = BX5jWs01o51t2uS6TF36FCXiUVebvTI5x/S1V7yWKQo=
SHA256 (hackage/warp-3.3.20.tar.gz) = knZKnhfJuAR0J7WhsgKQFmJVZUTSXF98wOLQf8Wyb0o=
SHA256 (hackage/warp-tls-3.3.2.tar.gz) = 1ehvJpSdqZiSM9z2aVVxDOtU+PitOasRJvhXbwSPOy0=
SHA256 (hackage/wcwidth-0.0.2.tar.gz) = /8aHNqO73j6BV3EPKfSpnAylk8QRlFecVKksYvbBLtg=
SHA256 (hackage/witherable-0.4.2.tar.gz) = eQ0rsnQoNBkXO9iRBEOYYGdalBD3DyGRKXPs2QmLQQQ=
SHA256 (hackage/witherable-0.4.2_2.cabal) = gf07Hlbm2MWxrNvtBtScchhpAvdAATkVKv1w43rZVtI=
SHA256 (hackage/word8-0.1.3.tar.gz) = JjCTTHVyi/vzkMHwIGsiVQezVPaNQEewbAGKNoI7XYo=
SHA256 (hackage/x509-1.7.6.tar.gz) = pdWaOldveKD0et9QnlPCq4A0kfB+sMQLX/0DBPqTmIQ=
SHA256 (hackage/x509-store-1.6.9.tar.gz) = xZITUgzzGgoYYRpguKTS16pssgbAVF2Fe5jcuQ/FyNo=
@ -301,9 +303,9 @@ SHA256 (hackage/xss-sanitize-0.3.7.tar.gz) = fAePbaEZYgkXDvYVZGXidwJlOermys3gvZd
SHA256 (hackage/xss-sanitize-0.3.7_1.cabal) = xixsnFskcfiXBdh6NcYCI20Jv8gUH2x7Ji8FobsfbZY=
SHA256 (hackage/yaml-0.11.8.0.tar.gz) = 9hpOgpu3Xhf12jnqe52NIhoQCg8MsSWLuVhKGCnNCug=
SHA256 (hackage/yesod-1.6.2.tar.gz) = sarAgdQs+QKwEEQH2ssf6hUFMs42FzSkUuHhP314O08=
SHA256 (hackage/yesod-core-1.6.22.0.tar.gz) = Bj9cjtcP672Abfu6f5xm/iY0QZo3XkkTIOpIGtQGhm0=
SHA256 (hackage/yesod-core-1.6.23.tar.gz) = ghNsZ2gnyvFiOZwZMFVoZPGOPPk0zCc61m9hoXo5ZBs=
SHA256 (hackage/yesod-form-1.7.0.tar.gz) = cRvg4iSnZfGuLSyPns6OPowkumcIJCtterfAgIZfD5w=
SHA256 (hackage/yesod-persistent-1.6.0.7.tar.gz) = ZAa52HuvQlsHitVqrH9weKYtLL0yjJ3LC1MjYM+tXYA=
SHA256 (hackage/yesod-persistent-1.6.0.8.tar.gz) = 5kVSwlav3+fC4RSpOB9ylq9oHA8oxxhMNxZ3DyoGdQs=
SHA256 (hackage/yesod-static-1.6.1.0.tar.gz) = l5QmL0rT+DS9dqoQXjSOZYIfCHosDTsXon9uZlOFxaE=
SHA256 (hackage/zlib-0.6.2.3.tar.gz) = gH9r3fnLPFF85XV9mR3ePH4xmVOiLIbuA9dFNL1avIg=
SHA256 (hackage/zlib-0.6.2.3_1.cabal) = JiqT2/Nwvln07lfzsaUbM4vCwwl5fao3wU8iYq5h2uQ=
@ -324,8 +326,7 @@ SIZE (hackage/abstract-deque-0.3.tar.gz) = 7219
SIZE (hackage/abstract-par-0.3.3.tar.gz) = 4714
SIZE (hackage/adjunctions-4.4.tar.gz) = 19891
SIZE (hackage/adjunctions-4.4_2.cabal) = 3067
SIZE (hackage/aeson-1.5.6.0.tar.gz) = 286364
SIZE (hackage/aeson-1.5.6.0_5.cabal) = 6788
SIZE (hackage/aeson-2.0.3.0.tar.gz) = 297283
SIZE (hackage/alex-3.2.7.1.tar.gz) = 108229
SIZE (hackage/ansi-terminal-0.11.1.tar.gz) = 36857
SIZE (hackage/ansi-wl-pprint-0.6.9.tar.gz) = 16723
@ -425,14 +426,13 @@ SIZE (hackage/entropy-0.4.1.7.tar.gz) = 9342
SIZE (hackage/fast-logger-3.1.1.tar.gz) = 12772
SIZE (hackage/feed-1.3.2.1.tar.gz) = 107015
SIZE (hackage/file-embed-0.0.15.0.tar.gz) = 7119
SIZE (hackage/filepath-bytestring-1.4.2.1.9.tar.gz) = 25901
SIZE (hackage/filepath-bytestring-1.4.2.1.10.tar.gz) = 25928
SIZE (hackage/free-5.1.7.tar.gz) = 61326
SIZE (hackage/free-5.1.7_1.cabal) = 5139
SIZE (hackage/git-annex-10.20220322.tar.gz) = 1421902
SIZE (hackage/git-lfs-1.2.0.tar.gz) = 17277
SIZE (hackage/happy-1.20.0.tar.gz) = 184515
SIZE (hackage/hashable-1.3.5.0.tar.gz) = 24676
SIZE (hackage/hashable-1.3.5.0_1.cabal) = 4240
SIZE (hackage/hashable-1.4.0.2.tar.gz) = 25528
SIZE (hackage/hjsmin-0.2.0.4.tar.gz) = 5233
SIZE (hackage/hjsmin-0.2.0.4_2.cabal) = 2237
SIZE (hackage/hourglass-0.2.12.tar.gz) = 25797
@ -499,7 +499,7 @@ SIZE (hackage/parallel-3.2.2.0_4.cabal) = 1821
SIZE (hackage/path-pieces-0.2.1.tar.gz) = 3529
SIZE (hackage/path-pieces-0.2.1_1.cabal) = 1233
SIZE (hackage/pem-0.2.4.tar.gz) = 4717
SIZE (hackage/persistent-2.13.3.4.tar.gz) = 166229
SIZE (hackage/persistent-2.14.0.0.tar.gz) = 170553
SIZE (hackage/persistent-sqlite-2.13.1.0.tar.gz) = 2276809
SIZE (hackage/persistent-template-2.12.0.0.tar.gz) = 4506
SIZE (hackage/primitive-0.7.3.0.tar.gz) = 55161
@ -520,6 +520,8 @@ SIZE (hackage/sandi-0.5_1.cabal) = 3010
SIZE (hackage/scientific-0.3.7.0.tar.gz) = 24723
SIZE (hackage/scientific-0.3.7.0_2.cabal) = 4826
SIZE (hackage/securemem-0.1.10.tar.gz) = 3801
SIZE (hackage/semialign-1.2.0.1.tar.gz) = 10371
SIZE (hackage/semialign-1.2.0.1_1.cabal) = 2836
SIZE (hackage/semigroupoids-5.3.7.tar.gz) = 35349
SIZE (hackage/semigroups-0.20.tar.gz) = 18788
SIZE (hackage/setenv-0.1.1.3.tar.gz) = 2710
@ -593,11 +595,13 @@ SIZE (hackage/vector-th-unbox-0.2.2_1.cabal) = 1584
SIZE (hackage/void-0.7.3.tar.gz) = 6741
SIZE (hackage/wai-3.2.3.tar.gz) = 11619
SIZE (hackage/wai-app-static-3.1.7.4.tar.gz) = 23094
SIZE (hackage/wai-extra-3.1.8.tar.gz) = 69950
SIZE (hackage/wai-extra-3.1.10.tar.gz) = 71784
SIZE (hackage/wai-logger-2.4.0.tar.gz) = 5925
SIZE (hackage/warp-3.3.20.tar.gz) = 66451
SIZE (hackage/warp-tls-3.3.2.tar.gz) = 8888
SIZE (hackage/wcwidth-0.0.2.tar.gz) = 4168
SIZE (hackage/witherable-0.4.2.tar.gz) = 11876
SIZE (hackage/witherable-0.4.2_2.cabal) = 2285
SIZE (hackage/word8-0.1.3.tar.gz) = 6271
SIZE (hackage/x509-1.7.6.tar.gz) = 21772
SIZE (hackage/x509-store-1.6.9.tar.gz) = 12734
@ -610,9 +614,9 @@ SIZE (hackage/xss-sanitize-0.3.7.tar.gz) = 11704
SIZE (hackage/xss-sanitize-0.3.7_1.cabal) = 1977
SIZE (hackage/yaml-0.11.8.0.tar.gz) = 31674
SIZE (hackage/yesod-1.6.2.tar.gz) = 9927
SIZE (hackage/yesod-core-1.6.22.0.tar.gz) = 102336
SIZE (hackage/yesod-core-1.6.23.tar.gz) = 103073
SIZE (hackage/yesod-form-1.7.0.tar.gz) = 34435
SIZE (hackage/yesod-persistent-1.6.0.7.tar.gz) = 5520
SIZE (hackage/yesod-persistent-1.6.0.8.tar.gz) = 5612
SIZE (hackage/yesod-static-1.6.1.0.tar.gz) = 25613
SIZE (hackage/zlib-0.6.2.3.tar.gz) = 149186
SIZE (hackage/zlib-0.6.2.3_1.cabal) = 5329

View File

@ -0,0 +1,291 @@
From fb79b39c44404fd791a3bed973e9d844fb084f1e Mon Sep 17 00:00:00 2001
From: Simon Jakobi <simon.jakobi@gmail.com>
Date: Fri, 12 Nov 2021 01:37:36 +0100
Subject: [PATCH] Fix build with GHC 9.2
The `FastShift.shift{L,R}` methods are replaced with `unsafeShift{L,R}`
introduced in base-4.5.
Fixes #19.
---
Data/BloomFilter.hs | 16 +++++------
Data/BloomFilter/Hash.hs | 15 +++++-----
Data/BloomFilter/Mutable.hs | 20 +++++++-------
Data/BloomFilter/Util.hs | 55 ++++++-------------------------------
bloomfilter.cabal | 2 +-
5 files changed, 34 insertions(+), 74 deletions(-)
diff --git a/Data/BloomFilter.hs b/Data/BloomFilter.hs
index 2210cef..6b47c21 100644
--- a/Data/BloomFilter.hs
+++ b/Data/BloomFilter.hs
@@ -78,8 +78,8 @@ import Control.DeepSeq (NFData(..))
import Data.Array.Base (unsafeAt)
import qualified Data.Array.Base as ST
import Data.Array.Unboxed (UArray)
-import Data.Bits ((.&.))
-import Data.BloomFilter.Util (FastShift(..), (:*)(..))
+import Data.Bits ((.&.), unsafeShiftL, unsafeShiftR)
+import Data.BloomFilter.Util ((:*)(..))
import qualified Data.BloomFilter.Mutable as MB
import qualified Data.BloomFilter.Mutable.Internal as MB
import Data.BloomFilter.Mutable.Internal (Hash, MBloom)
@@ -98,7 +98,7 @@ data Bloom a = B {
}
instance Show (Bloom a) where
- show ub = "Bloom { " ++ show ((1::Int) `shiftL` shift ub) ++ " bits } "
+ show ub = "Bloom { " ++ show ((1::Int) `unsafeShiftL` shift ub) ++ " bits } "
instance NFData (Bloom a) where
rnf !_ = ()
@@ -172,7 +172,7 @@ singleton hash numBits elt = create hash numBits (\mb -> MB.insert mb elt)
-- | Given a filter's mask and a hash value, compute an offset into
-- a word array and a bit offset within that word.
hashIdx :: Int -> Word32 -> (Int :* Int)
-hashIdx mask x = (y `shiftR` logBitsInHash) :* (y .&. hashMask)
+hashIdx mask x = (y `unsafeShiftR` logBitsInHash) :* (y .&. hashMask)
where hashMask = 31 -- bitsInHash - 1
y = fromIntegral x .&. mask
@@ -191,7 +191,7 @@ hashesU ub elt = hashIdx (mask ub) `map` hashes ub elt
-- /still/ some possibility that @True@ will be returned.
elem :: a -> Bloom a -> Bool
elem elt ub = all test (hashesU ub elt)
- where test (off :* bit) = (bitArray ub `unsafeAt` off) .&. (1 `shiftL` bit) /= 0
+ where test (off :* bit) = (bitArray ub `unsafeAt` off) .&. (1 `unsafeShiftL` bit) /= 0
modify :: (forall s. (MBloom s a -> ST s z)) -- ^ mutation function (result is discarded)
-> Bloom a
@@ -255,11 +255,11 @@ insertList elts = modify $ \mb -> mapM_ (MB.insert mb) elts
-- is /still/ some possibility that @True@ will be returned.
notElem :: a -> Bloom a -> Bool
notElem elt ub = any test (hashesU ub elt)
- where test (off :* bit) = (bitArray ub `unsafeAt` off) .&. (1 `shiftL` bit) == 0
+ where test (off :* bit) = (bitArray ub `unsafeAt` off) .&. (1 `unsafeShiftL` bit) == 0
-- | Return the size of an immutable Bloom filter, in bits.
length :: Bloom a -> Int
-length = shiftL 1 . shift
+length = unsafeShiftL 1 . shift
-- | Build an immutable Bloom filter from a seed value. The seeding
-- function populates the filter as follows.
@@ -318,7 +318,7 @@ fromList hashes numBits = unfold hashes numBits convert
logPower2 :: Int -> Int
logPower2 k = go 0 k
where go j 1 = j
- go j n = go (j+1) (n `shiftR` 1)
+ go j n = go (j+1) (n `unsafeShiftR` 1)
-- $overview
--
diff --git a/Data/BloomFilter/Hash.hs b/Data/BloomFilter/Hash.hs
index 132a3a4..d071fd4 100644
--- a/Data/BloomFilter/Hash.hs
+++ b/Data/BloomFilter/Hash.hs
@@ -38,8 +38,7 @@ module Data.BloomFilter.Hash
) where
import Control.Monad (foldM)
-import Data.Bits ((.&.), (.|.), xor)
-import Data.BloomFilter.Util (FastShift(..))
+import Data.Bits ((.&.), (.|.), unsafeShiftL, unsafeShiftR, xor)
import Data.List (unfoldr)
import Data.Int (Int8, Int16, Int32, Int64)
import Data.Word (Word8, Word16, Word32, Word64)
@@ -91,11 +90,11 @@ class Hashable a where
-> Word64 -- ^ salt
-> IO Word64
hashIO64 v salt = do
- let s1 = fromIntegral (salt `shiftR` 32) .&. maxBound
+ let s1 = fromIntegral (salt `unsafeShiftR` 32) .&. maxBound
s2 = fromIntegral salt
h1 <- hashIO32 v s1
h2 <- hashIO32 v s2
- return $ (fromIntegral h1 `shiftL` 32) .|. fromIntegral h2
+ return $ (fromIntegral h1 `unsafeShiftL` 32) .|. fromIntegral h2
-- | Compute a 32-bit hash.
hash32 :: Hashable a => a -> Word32
@@ -149,8 +148,8 @@ cheapHashes :: Hashable a => Int -- ^ number of hashes to compute
cheapHashes k v = go 0
where go i | i == j = []
| otherwise = hash : go (i + 1)
- where !hash = h1 + (h2 `shiftR` i)
- h1 = fromIntegral (h `shiftR` 32)
+ where !hash = h1 + (h2 `unsafeShiftR` i)
+ h1 = fromIntegral (h `unsafeShiftR` 32)
h2 = fromIntegral h
h = hashSalt64 0x9150a946c4a8966e v
j = fromIntegral k
@@ -163,7 +162,7 @@ instance Hashable Integer where
(salt `xor` 0x3ece731e)
| otherwise = hashIO32 (unfoldr go k) salt
where go 0 = Nothing
- go i = Just (fromIntegral i :: Word32, i `shiftR` 32)
+ go i = Just (fromIntegral i :: Word32, i `unsafeShiftR` 32)
instance Hashable Bool where
hashIO32 = hashOne32
@@ -224,7 +223,7 @@ instance Hashable Word64 where
-- | A fast unchecked shift. Nasty, but otherwise GHC 6.8.2 does a
-- test and branch on every shift.
div4 :: CSize -> CSize
-div4 k = fromIntegral ((fromIntegral k :: HTYPE_SIZE_T) `shiftR` 2)
+div4 k = fromIntegral ((fromIntegral k :: HTYPE_SIZE_T) `unsafeShiftR` 2)
alignedHash :: Ptr a -> CSize -> Word32 -> IO Word32
alignedHash ptr bytes salt
diff --git a/Data/BloomFilter/Mutable.hs b/Data/BloomFilter/Mutable.hs
index edff1fc..0bb5cc9 100644
--- a/Data/BloomFilter/Mutable.hs
+++ b/Data/BloomFilter/Mutable.hs
@@ -65,9 +65,9 @@ module Data.BloomFilter.Mutable
import Control.Monad (liftM, forM_)
import Control.Monad.ST (ST)
import Data.Array.Base (unsafeRead, unsafeWrite)
-import Data.Bits ((.&.), (.|.))
+import Data.Bits ((.&.), (.|.), unsafeShiftL, unsafeShiftR)
import Data.BloomFilter.Array (newArray)
-import Data.BloomFilter.Util (FastShift(..), (:*)(..), nextPowerOfTwo)
+import Data.BloomFilter.Util ((:*)(..), nextPowerOfTwo)
import Data.Word (Word32)
import Data.BloomFilter.Mutable.Internal
@@ -86,9 +86,9 @@ new hash numBits = MB hash shft msk `liftM` newArray numElems numBytes
| numBits > maxHash = maxHash
| isPowerOfTwo numBits = numBits
| otherwise = nextPowerOfTwo numBits
- numElems = max 2 (twoBits `shiftR` logBitsInHash)
- numBytes = numElems `shiftL` logBytesInHash
- trueBits = numElems `shiftL` logBitsInHash
+ numElems = max 2 (twoBits `unsafeShiftR` logBitsInHash)
+ numBytes = numElems `unsafeShiftL` logBytesInHash
+ trueBits = numElems `unsafeShiftL` logBitsInHash
shft = logPower2 trueBits
msk = trueBits - 1
isPowerOfTwo n = n .&. (n - 1) == 0
@@ -109,7 +109,7 @@ logBytesInHash = 2 -- logPower2 (sizeOf (undefined :: Hash))
-- | Given a filter's mask and a hash value, compute an offset into
-- a word array and a bit offset within that word.
hashIdx :: Int -> Word32 -> (Int :* Int)
-hashIdx msk x = (y `shiftR` logBitsInHash) :* (y .&. hashMask)
+hashIdx msk x = (y `unsafeShiftR` logBitsInHash) :* (y .&. hashMask)
where hashMask = 31 -- bitsInHash - 1
y = fromIntegral x .&. msk
@@ -125,7 +125,7 @@ insert mb elt = do
let mu = bitArray mb
forM_ (hashesM mb elt) $ \(word :* bit) -> do
old <- unsafeRead mu word
- unsafeWrite mu word (old .|. (1 `shiftL` bit))
+ unsafeWrite mu word (old .|. (1 `unsafeShiftL` bit))
-- | Query a mutable Bloom filter for membership. If the value is
-- present, return @True@. If the value is not present, there is
@@ -135,7 +135,7 @@ elem elt mb = loop (hashesM mb elt)
where mu = bitArray mb
loop ((word :* bit):wbs) = do
i <- unsafeRead mu word
- if i .&. (1 `shiftL` bit) == 0
+ if i .&. (1 `unsafeShiftL` bit) == 0
then return False
else loop wbs
loop _ = return True
@@ -145,7 +145,7 @@ elem elt mb = loop (hashesM mb elt)
-- | Return the size of a mutable Bloom filter, in bits.
length :: MBloom s a -> Int
-length = shiftL 1 . shift
+length = unsafeShiftL 1 . shift
-- | Slow, crummy way of computing the integer log of an integer known
@@ -153,7 +153,7 @@ length = shiftL 1 . shift
logPower2 :: Int -> Int
logPower2 k = go 0 k
where go j 1 = j
- go j n = go (j+1) (n `shiftR` 1)
+ go j n = go (j+1) (n `unsafeShiftR` 1)
-- $overview
--
diff --git a/Data/BloomFilter/Util.hs b/Data/BloomFilter/Util.hs
index 7f695dc..6ade6e5 100644
--- a/Data/BloomFilter/Util.hs
+++ b/Data/BloomFilter/Util.hs
@@ -2,15 +2,11 @@
module Data.BloomFilter.Util
(
- FastShift(..)
- , nextPowerOfTwo
+ nextPowerOfTwo
, (:*)(..)
) where
-import Data.Bits ((.|.))
-import qualified Data.Bits as Bits
-import GHC.Base
-import GHC.Word
+import Data.Bits ((.|.), unsafeShiftR)
-- | A strict pair type.
data a :* b = !a :* !b
@@ -22,46 +18,11 @@ nextPowerOfTwo :: Int -> Int
{-# INLINE nextPowerOfTwo #-}
nextPowerOfTwo n =
let a = n - 1
- b = a .|. (a `shiftR` 1)
- c = b .|. (b `shiftR` 2)
- d = c .|. (c `shiftR` 4)
- e = d .|. (d `shiftR` 8)
- f = e .|. (e `shiftR` 16)
- g = f .|. (f `shiftR` 32) -- in case we're on a 64-bit host
+ b = a .|. (a `unsafeShiftR` 1)
+ c = b .|. (b `unsafeShiftR` 2)
+ d = c .|. (c `unsafeShiftR` 4)
+ e = d .|. (d `unsafeShiftR` 8)
+ f = e .|. (e `unsafeShiftR` 16)
+ g = f .|. (f `unsafeShiftR` 32) -- in case we're on a 64-bit host
!h = g + 1
in h
-
--- | This is a workaround for poor optimisation in GHC 6.8.2. It
--- fails to notice constant-width shifts, and adds a test and branch
--- to every shift. This imposes about a 10% performance hit.
-class FastShift a where
- shiftL :: a -> Int -> a
- shiftR :: a -> Int -> a
-
-instance FastShift Word32 where
- {-# INLINE shiftL #-}
- shiftL (W32# x#) (I# i#) = W32# (x# `uncheckedShiftL#` i#)
-
- {-# INLINE shiftR #-}
- shiftR (W32# x#) (I# i#) = W32# (x# `uncheckedShiftRL#` i#)
-
-instance FastShift Word64 where
- {-# INLINE shiftL #-}
- shiftL (W64# x#) (I# i#) = W64# (x# `uncheckedShiftL64#` i#)
-
- {-# INLINE shiftR #-}
- shiftR (W64# x#) (I# i#) = W64# (x# `uncheckedShiftRL64#` i#)
-
-instance FastShift Int where
- {-# INLINE shiftL #-}
- shiftL (I# x#) (I# i#) = I# (x# `iShiftL#` i#)
-
- {-# INLINE shiftR #-}
- shiftR (I# x#) (I# i#) = I# (x# `iShiftRA#` i#)
-
-instance FastShift Integer where
- {-# INLINE shiftL #-}
- shiftL = Bits.shiftL
-
- {-# INLINE shiftR #-}
- shiftR = Bits.shiftR
--
2.35.1

View File

@ -0,0 +1,177 @@
From 7af7586c5d244d07f77d49e5fdc739e6e8e54816 Mon Sep 17 00:00:00 2001
From: Joey Hess <joeyh@joeyh.name>
Date: Mon, 18 Oct 2021 14:35:30 -0400
Subject: [PATCH] build with aeson 2
---
Aws/DynamoDb/Commands/Table.hs | 4 +--
Aws/DynamoDb/Commands/UpdateItem.hs | 5 ++--
Aws/DynamoDb/Core.hs | 39 +++++++++++++++--------------
aws.cabal | 2 +-
4 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/Aws/DynamoDb/Commands/Table.hs b/Aws/DynamoDb/Commands/Table.hs
index 5fb42e0..a5fe025 100644
--- a/Aws/DynamoDb/Commands/Table.hs
+++ b/Aws/DynamoDb/Commands/Table.hs
@@ -35,9 +35,9 @@ module Aws.DynamoDb.Commands.Table
import Control.Applicative
import Data.Aeson ((.!=), (.:), (.:?), (.=))
import qualified Data.Aeson as A
+import qualified Data.Aeson.KeyMap as KM
import qualified Data.Aeson.Types as A
import Data.Char (toUpper)
-import qualified Data.HashMap.Strict as M
import Data.Scientific (Scientific)
import qualified Data.Text as T
import Data.Time
@@ -281,7 +281,7 @@ data TableDescription
instance A.FromJSON TableDescription where
parseJSON = A.withObject "Table must be an object" $ \o -> do
- t <- case (M.lookup "Table" o, M.lookup "TableDescription" o) of
+ t <- case (KM.lookup "Table" o, KM.lookup "TableDescription" o) of
(Just (A.Object t), _) -> return t
(_, Just (A.Object t)) -> return t
_ -> fail "Table description must have key 'Table' or 'TableDescription'"
diff --git a/Aws/DynamoDb/Commands/UpdateItem.hs b/Aws/DynamoDb/Commands/UpdateItem.hs
index 0d94a59..1152b5a 100644
--- a/Aws/DynamoDb/Commands/UpdateItem.hs
+++ b/Aws/DynamoDb/Commands/UpdateItem.hs
@@ -31,6 +31,7 @@ module Aws.DynamoDb.Commands.UpdateItem
-------------------------------------------------------------------------------
import Control.Applicative
import Data.Aeson
+import qualified Data.Aeson.Key as AK
import Data.Default
import qualified Data.Text as T
import Prelude
@@ -91,9 +92,9 @@ instance ToJSON AttributeUpdates where
toJSON = object . map mk . getAttributeUpdates
where
mk AttributeUpdate { auAction = UDelete, auAttr = auAttr } =
- (attrName auAttr) .= object
+ (AK.fromText (attrName auAttr)) .= object
["Action" .= UDelete]
- mk AttributeUpdate { .. } = (attrName auAttr) .= object
+ mk AttributeUpdate { .. } = AK.fromText (attrName auAttr) .= object
["Value" .= (attrVal auAttr), "Action" .= auAction]
diff --git a/Aws/DynamoDb/Core.hs b/Aws/DynamoDb/Core.hs
index 1c116d3..b9a6cc4 100644
--- a/Aws/DynamoDb/Core.hs
+++ b/Aws/DynamoDb/Core.hs
@@ -128,6 +128,8 @@ import Control.Monad.Trans.Resource (throwM)
import qualified Crypto.Hash as CH
import Data.Aeson
import qualified Data.Aeson as A
+import qualified Data.Aeson.Key as AK
+import qualified Data.Aeson.KeyMap as KM
import Data.Aeson.Types (Pair, parseEither)
import qualified Data.Aeson.Types as A
import qualified Data.Attoparsec.ByteString as AttoB (endOfInput)
@@ -141,7 +143,6 @@ import Data.Conduit
import Data.Conduit.Attoparsec (sinkParser)
import Data.Default
import Data.Function (on)
-import qualified Data.HashMap.Strict as HM
import Data.Int
import Data.IORef
import Data.List
@@ -536,7 +537,7 @@ instance ToJSON PrimaryKey where
toJSON (PrimaryKey h (Just r)) =
let Object p1 = toJSON h
Object p2 = toJSON r
- in Object (p1 `HM.union` p2)
+ in Object (p1 `KM.union` p2)
instance FromJSON PrimaryKey where
parseJSON p = do
@@ -544,8 +545,8 @@ instance FromJSON PrimaryKey where
case length l of
1 -> return $ head l
_ -> fail "Unable to parse PrimaryKey"
- where listPKey p'= map (\(txt,dval)-> hk txt dval)
- . HM.toList <$> parseJSON p'
+ where listPKey p'= map (\(k,dval)-> hk (AK.toText k) dval)
+ . KM.toList <$> parseJSON p'
-- | A key-value pair
@@ -661,9 +662,9 @@ instance ToJSON Attribute where
-------------------------------------------------------------------------------
-- | Parse a JSON object that contains attributes
parseAttributeJson :: Value -> A.Parser [Attribute]
-parseAttributeJson (Object v) = mapM conv $ HM.toList v
+parseAttributeJson (Object v) = mapM conv $ KM.toList v
where
- conv (k, o) = Attribute k <$> parseJSON o
+ conv (k, o) = Attribute (AK.toText k) <$> parseJSON o
parseAttributeJson _ = error "Attribute JSON must be an Object"
@@ -674,7 +675,7 @@ attributesJson as = object $ map attributeJson as
-- | Convert into JSON pair
attributeJson :: Attribute -> Pair
-attributeJson (Attribute nm v) = nm .= v
+attributeJson (Attribute nm v) = AK.fromText nm .= v
-------------------------------------------------------------------------------
@@ -962,7 +963,7 @@ conditionsJson key (Conditions op es) = b ++ a
where
a = if null es
then []
- else [key .= object (map conditionJson es)]
+ else [AK.fromText key .= object (map conditionJson es)]
b = if length (take 2 es) > 1
then ["ConditionalOperator" .= String (rendCondOp op) ]
@@ -1046,7 +1047,7 @@ renderCondOp c = case c of
conditionJson :: Condition -> Pair
-conditionJson Condition{..} = condAttr .= condOp
+conditionJson Condition{..} = AK.fromText condAttr .= condOp
instance ToJSON CondOp where
@@ -1076,12 +1077,12 @@ data ConsumedCapacity = ConsumedCapacity {
instance FromJSON ConsumedCapacity where
- parseJSON (Object v) = ConsumedCapacity
- <$> v .: "CapacityUnits"
- <*> (HM.toList <$> v .:? "GlobalSecondaryIndexes" .!= mempty)
- <*> (HM.toList <$> v .:? "LocalSecondaryIndexes" .!= mempty)
- <*> (v .:? "Table" >>= maybe (return Nothing) (.: "CapacityUnits"))
- <*> v .: "TableName"
+ parseJSON (Object o) = ConsumedCapacity
+ <$> o .: "CapacityUnits"
+ <*> (map (\(k, v) -> (AK.toText k, v)) . KM.toList <$> o .:? "GlobalSecondaryIndexes" .!= mempty)
+ <*> (map (\(k, v) -> (AK.toText k, v)) . KM.toList <$> o .:? "LocalSecondaryIndexes" .!= mempty)
+ <*> (o .:? "Table" >>= maybe (return Nothing) (.: "CapacityUnits"))
+ <*> o .: "TableName"
parseJSON _ = fail "ConsumedCapacity must be an Object."
@@ -1115,10 +1116,10 @@ data ItemCollectionMetrics = ItemCollectionMetrics {
instance FromJSON ItemCollectionMetrics where
- parseJSON (Object v) = ItemCollectionMetrics
- <$> (do m <- v .: "ItemCollectionKey"
- return $ head $ HM.toList m)
- <*> v .: "SizeEstimateRangeGB"
+ parseJSON (Object o) = ItemCollectionMetrics
+ <$> (do m <- o .: "ItemCollectionKey"
+ return $ (\(k, v) -> (AK.toText k, v)) $ head $ KM.toList m)
+ <*> o .: "SizeEstimateRangeGB"
parseJSON _ = fail "ItemCollectionMetrics must be an Object."
--
2.35.2

View File

@ -0,0 +1,14 @@
Make an import qualified to avoid name conflicts in Types.Export
Index: Types/Export.hs
--- Types/Export.hs.orig
+++ Types/Export.hs
@@ -21,7 +21,7 @@ import Git.FilePath
import Utility.Split
import Utility.FileSystemEncoding
-import Data.ByteString.Short as S
+import qualified Data.ByteString.Short as S
import qualified System.FilePath.Posix as Posix
import GHC.Generics
import Control.DeepSeq