[arch-commits] Commit in hledger-iadd/repos (3 files)
Felix Yan
felixonmars at archlinux.org
Mon Jul 5 13:55:53 UTC 2021
Date: Monday, July 5, 2021 @ 13:55:53
Author: felixonmars
Revision: 972352
archrelease: copy trunk to community-staging-x86_64
Added:
hledger-iadd/repos/community-staging-x86_64/
hledger-iadd/repos/community-staging-x86_64/PKGBUILD
(from rev 972351, hledger-iadd/trunk/PKGBUILD)
hledger-iadd/repos/community-staging-x86_64/hledger-lib-1.22.patch
(from rev 972351, hledger-iadd/trunk/hledger-lib-1.22.patch)
------------------------+
PKGBUILD | 56 ++++++++++++++++++++++++
hledger-lib-1.22.patch | 107 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 163 insertions(+)
Copied: hledger-iadd/repos/community-staging-x86_64/PKGBUILD (from rev 972351, hledger-iadd/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2021-07-05 13:55:53 UTC (rev 972352)
@@ -0,0 +1,56 @@
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+
+_hkgname=hledger-iadd
+pkgname=hledger-iadd
+pkgver=1.3.14
+pkgrel=31
+pkgdesc="A terminal UI as drop-in replacement for hledger add"
+url="https://github.com/hpdeifel/hledger-iadd#readme"
+license=("BSD")
+arch=('x86_64')
+depends=('ghc-libs' 'haskell-brick' 'haskell-free' 'haskell-hledger-lib' 'haskell-megaparsec'
+ 'haskell-microlens' 'haskell-microlens-th' 'haskell-optparse-applicative'
+ 'haskell-text-zipper' 'haskell-unordered-containers' 'haskell-vector' 'haskell-vty'
+ 'haskell-xdg-basedir')
+makedepends=('ghc' 'uusi' 'haskell-quickcheck' 'haskell-hspec' 'haskell-hspec-discover')
+source=("https://hackage.haskell.org/packages/archive/$_hkgname/$pkgver/$_hkgname-$pkgver.tar.gz"
+ hledger-lib-1.22.patch)
+sha256sums=('c5472492ec443948762e4e236d91d9057ed23e8f0866c2aa32929997ae479c4d'
+ '37a144b21334670e126a6aa76ab806f72a28456d6a969496db2a7be2c70bf328')
+
+prepare() {
+ cd $_hkgname-$pkgver
+ patch -p1 -i ../hledger-lib-1.22.patch
+ uusi -d semigroups $_hkgname.cabal
+}
+
+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 \
+ --ghc-option=-optl-Wl\,-z\,relro\,-z\,now \
+ --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 $_hkgname-$pkgver
+ runhaskell Setup test --show-details=direct
+}
+
+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 -t "$pkgdir"/usr/share/licenses/$pkgname/
+ rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE
+}
Copied: hledger-iadd/repos/community-staging-x86_64/hledger-lib-1.22.patch (from rev 972351, hledger-iadd/trunk/hledger-lib-1.22.patch)
===================================================================
--- community-staging-x86_64/hledger-lib-1.22.patch (rev 0)
+++ community-staging-x86_64/hledger-lib-1.22.patch 2021-07-05 13:55:53 UTC (rev 972352)
@@ -0,0 +1,107 @@
+commit ee3a0ab82fad7d70328a4ed0a8796cd112195737
+Author: Felix Yan <felixonmars at archlinux.org>
+Date: Mon Jul 5 21:39:16 2021 +0800
+
+ Support hledger-lib 1.22
+
+ All tests are passing here.
+
+diff --git a/hledger-iadd.cabal b/hledger-iadd.cabal
+index 845472a..8cc93ee 100644
+--- a/hledger-iadd.cabal
++++ b/hledger-iadd.cabal
+@@ -60,7 +60,7 @@ library
+ , Data.Time.Ext
+ default-language: Haskell2010
+ build-depends: base >= 4.9 && < 5
+- , hledger-lib >= 1.21 && < 1.22
++ , hledger-lib >= 1.22 && < 1.23
+ , brick >= 0.27
+ , vty >= 5.4
+ , text
+@@ -88,7 +88,7 @@ executable hledger-iadd
+ default-language: Haskell2010
+ build-depends: base >= 4.9 && < 5
+ , hledger-iadd
+- , hledger-lib >= 1.21 && < 1.22
++ , hledger-lib >= 1.22 && < 1.23
+ , brick >= 0.27
+ , vty >= 5.4
+ , text
+@@ -116,7 +116,7 @@ test-suite spec
+ default-language: Haskell2010
+ build-depends: base >= 4.9 && < 5
+ , hledger-iadd
+- , hledger-lib >= 1.21 && < 1.22
++ , hledger-lib >= 1.22 && < 1.23
+ , text
+ , transformers >= 0.3
+ , time >= 1.5
+diff --git a/src/Model.hs b/src/Model.hs
+index 8478e30..24b79da 100644
+--- a/src/Model.hs
++++ b/src/Model.hs
+@@ -269,7 +269,7 @@ isSubsetTransaction current origin =
+ cmpPosting a b = HL.paccount a == HL.paccount b
+ && cmpAmount (HL.pamount a) (HL.pamount b)
+
+- cmpAmount (HL.Mixed a) (HL.Mixed b) = ((==) `on` map (HL.acommodity &&& HL.aquantity)) a b
++ cmpAmount a b = ((==) `on` map (HL.acommodity &&& HL.aquantity)) (HL.amounts a) (HL.amounts b)
+
+ listToMaybe' :: [a] -> Maybe [a]
+ listToMaybe' [] = Nothing
+@@ -280,7 +280,7 @@ numPostings = length . HL.tpostings
+
+ -- | Returns True if all postings balance and the transaction is not empty
+ transactionBalanced :: HL.Transaction -> Bool
+-transactionBalanced = HL.isTransactionBalanced Nothing
++transactionBalanced = HL.isTransactionBalanced HL.balancingOpts
+
+ -- | Computes the sum of all postings in the transaction and inverts it
+ negativeAmountSum :: HL.Transaction -> HL.MixedAmount
+@@ -371,13 +371,13 @@ isDuplicateTransaction journal trans = any ((==EQ) . cmpTransaction trans) (HL.
+ -- | Compare two mixed amounts by first sorting the individual amounts
+ -- deterministically and then comparing them one-by-one.
+ cmpMixedAmount :: HL.MixedAmount -> HL.MixedAmount -> Ordering
+- cmpMixedAmount (HL.Mixed as1) (HL.Mixed as2) =
++ cmpMixedAmount as1 as2 =
+ let
+- sortedAs1 = sortBy cmpAmount as1
+- sortedAs2 = sortBy cmpAmount as2
++ sortedAs1 = sortBy cmpAmount $ HL.amounts as1
++ sortedAs2 = sortBy cmpAmount $ HL.amounts as2
+ in
+ mconcat $
+- compare (length as1) (length as2) : zipWith cmpAmount sortedAs1 sortedAs2
++ compare (length $ HL.amounts as1) (length $ HL.amounts as2) : zipWith cmpAmount sortedAs1 sortedAs2
+
+ cmpBalanceAssertion :: HL.BalanceAssertion -> HL.BalanceAssertion -> Ordering
+ cmpBalanceAssertion = lexical [cmp HL.baamount, cmp HL.batotal]
+diff --git a/tests/AmountParserSpec.hs b/tests/AmountParserSpec.hs
+index fc1586c..e250738 100644
+--- a/tests/AmountParserSpec.hs
++++ b/tests/AmountParserSpec.hs
+@@ -34,7 +34,7 @@ spec = describe "parseAmount" $ do
+ parseAmount HL.nulljournal "23 +" `shouldSatisfy` isLeft
+
+ amount :: Text -> HL.MixedAmount
+-amount = HL.mixed . pure . fromRight . runIdentity . runParserT (evalStateT HL.amountp HL.nulljournal) ""
++amount = HL.mixed . Just . fromRight . runIdentity . runParserT (evalStateT HL.amountp HL.nulljournal) ""
+
+ fromRight :: Either a b -> b
+ fromRight = either (error "fromRight: Left value encountered") id
+diff --git a/tests/ModelSpec.hs b/tests/ModelSpec.hs
+index 4c33bc6..6e72ba6 100644
+--- a/tests/ModelSpec.hs
++++ b/tests/ModelSpec.hs
+@@ -198,8 +198,8 @@ isDuplicateTransactionSpec = do
+ a2 = (HL.eur 0.5) { HL.astyle = HL.amountstyle { HL.asprecision = HL.Precision 15 } }
+
+ p1 = mkPosting ("Test", -1)
+- p2 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.Mixed [a1] }
+- p3 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.Mixed [a2] }
++ p2 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.mixedAmount a1 }
++ p3 = HL.nullposting { HL.paccount = "Toast", HL.pamount = HL.mixedAmount a2 }
+
+ t0 = mkTransaction ((2017,9,23), "Test", [])
+ t1 = t0 { HL.tpostings = [p1,p2,p2] }
More information about the arch-commits
mailing list