[arch-commits] Commit in hledger-iadd/trunk (PKGBUILD hledger-lib-1.22.patch)

Felix Yan felixonmars at archlinux.org
Mon Jul 5 13:55:31 UTC 2021


    Date: Monday, July 5, 2021 @ 13:55:30
  Author: felixonmars
Revision: 972351

upgpkg: hledger-iadd 1.3.14-31: rebuild with hledger 1.22, hledger-lib 1.22, hledger-ui 1.22, hledger-web 1.22

Added:
  hledger-iadd/trunk/hledger-lib-1.22.patch
Modified:
  hledger-iadd/trunk/PKGBUILD

------------------------+
 PKGBUILD               |    9 ++-
 hledger-lib-1.22.patch |  107 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+), 3 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-07-05 11:54:38 UTC (rev 972350)
+++ PKGBUILD	2021-07-05 13:55:30 UTC (rev 972351)
@@ -3,7 +3,7 @@
 _hkgname=hledger-iadd
 pkgname=hledger-iadd
 pkgver=1.3.14
-pkgrel=30
+pkgrel=31
 pkgdesc="A terminal UI as drop-in replacement for hledger add"
 url="https://github.com/hpdeifel/hledger-iadd#readme"
 license=("BSD")
@@ -13,11 +13,14 @@
          '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")
-sha256sums=('c5472492ec443948762e4e236d91d9057ed23e8f0866c2aa32929997ae479c4d')
+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
 }
 

Added: hledger-lib-1.22.patch
===================================================================
--- hledger-lib-1.22.patch	                        (rev 0)
+++ hledger-lib-1.22.patch	2021-07-05 13:55:30 UTC (rev 972351)
@@ -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