[arch-commits] Commit in misfortune/trunk (PKGBUILD random-fu-0.3.patch)

Felix Yan felixonmars at gemini.archlinux.org
Sun Jul 24 08:31:02 UTC 2022


    Date: Sunday, July 24, 2022 @ 08:31:01
  Author: felixonmars
Revision: 1255884

upgpkg: misfortune 0.1.2-1

Modified:
  misfortune/trunk/PKGBUILD
Deleted:
  misfortune/trunk/random-fu-0.3.patch

---------------------+
 PKGBUILD            |   25 ++++++---------
 random-fu-0.3.patch |   83 --------------------------------------------------
 2 files changed, 11 insertions(+), 97 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2022-07-24 03:01:34 UTC (rev 1255883)
+++ PKGBUILD	2022-07-24 08:31:01 UTC (rev 1255884)
@@ -1,27 +1,19 @@
 # Maintainer: Felix Yan <felixonmars at archlinux.org>
 
 pkgname=misfortune
-pkgver=0.1.1.2
-pkgrel=144
+pkgver=0.1.2
+pkgrel=1
 pkgdesc="fortune-mod clone"
-url="https://github.com/mokus0/misfortune"
+url="https://github.com/ncfavier/misfortune"
 license=("custom:PublicDomain")
 arch=('x86_64')
 depends=('ghc-libs' 'haskell-cereal' 'haskell-knob' 'haskell-monad-loops' 'haskell-random'
          'haskell-random-fu' 'haskell-regex-base' 'haskell-regex-pcre' 'haskell-utf8-string'
          'haskell-vector')
-makedepends=('ghc' 'uusi')
-source=("https://hackage.haskell.org/packages/archive/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz"
-        random-fu-0.3.patch)
-sha256sums=('ae4b44215f811e7af6af756c813b9bd6e4161be555f30dd817324f8d1ffe2349'
-            '954b412585a7406f4cff350dc63a45595864bb9d7ce874c922db3840a48c6e4e')
+makedepends=('ghc')
+source=("https://hackage.haskell.org/packages/archive/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz")
+sha256sums=('09b96e39b0441d8f4221d36f76c117138f5a237d830a1f0778abb7c274d0dc4a')
 
-prepare() {
-  cd $pkgname-$pkgver
-  patch -Np1 -i ../random-fu-0.3.patch
-  uusi -d semigroups $pkgname.cabal
-}
-
 build() {
   cd $pkgname-$pkgver
 
@@ -38,6 +30,11 @@
   sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
 }
 
+check() {
+  cd $pkgname-$pkgver
+  runhaskell Setup test
+}
+
 package() {
   cd $pkgname-$pkgver
 

Deleted: random-fu-0.3.patch
===================================================================
--- random-fu-0.3.patch	2022-07-24 03:01:34 UTC (rev 1255883)
+++ random-fu-0.3.patch	2022-07-24 08:31:01 UTC (rev 1255884)
@@ -1,83 +0,0 @@
-From 61b2b05b86e87a0a5c0795877024ff9449ba6cad Mon Sep 17 00:00:00 2001
-From: Felix Yan <felixonmars at archlinux.org>
-Date: Mon, 7 Mar 2022 00:57:28 +0200
-Subject: [PATCH] Fix compatibility for random-fu 0.3
-
-Fixes #4
-Many thanks to @berberman
----
- misfortune.cabal    | 6 ++----
- src/Data/Fortune.hs | 6 ++++--
- src/Fortune.hs      | 6 ++++--
- 3 files changed, 10 insertions(+), 8 deletions(-)
-
-diff --git a/misfortune.cabal b/misfortune.cabal
-index b01ba69..f5f86cd 100644
---- a/misfortune.cabal
-+++ b/misfortune.cabal
-@@ -121,7 +121,8 @@ Library
-                         directory,
-                         filepath,
-                         knob,
--                        random-fu >= 0.2.2,
-+                        random,
-+                        random-fu >= 0.3,
-                         semigroups,
-                         text,
-                         utf8-string,
-diff --git a/src/Data/Fortune.hs b/src/Data/Fortune.hs
-index 16d221e..ffbc970 100644
---- a/src/Data/Fortune.hs
-+++ b/src/Data/Fortune.hs
-@@ -64,6 +64,7 @@ import Paths_misfortune
- import System.Directory
- import System.Environment
- import System.FilePath
-+import System.Random.Stateful (newIOGenM, newStdGen)
- 
- -- |The number of fortune strings in the index
- numFortunes :: S.FortuneStats -> Int
-@@ -233,9 +234,10 @@ randomFortune paths = withFortuneFiles '%' False paths $ \fs -> do
- -- random fortune from that file (unformly).
- randomFortuneFromRandomFile :: RVar FortuneFile -> IO String
- randomFortuneFromRandomFile file = do
--    f <- sample file
-+    gen <- newStdGen >>= newIOGenM
-+    f <- sampleFrom gen file
-     n <- getNumFortunes f
--    i <- sample (uniform 0 (n-1))
-+    i <- sampleFrom gen (uniform 0 (n-1))
-     T.unpack <$> getFortune f i
- 
- -- |Given a list of 'FortuneFile's, compute a distrubution over them weighted by the number
-diff --git a/src/Fortune.hs b/src/Fortune.hs
-index 5a27578..d6ffb74 100644
---- a/src/Fortune.hs
-+++ b/src/Fortune.hs
-@@ -21,6 +21,7 @@ import System.Environment
- import System.Exit
- import System.FilePath
- import System.IO
-+import System.Random.Stateful (newIOGenM, newStdGen)
- import Text.Printf
- import Text.Regex.Base
- import Text.Regex.PCRE
-@@ -200,6 +201,7 @@ main = do
-     fortunes <- filterM (filterFile args) (fortuneFiles args)
-     
-     dist <- getDist args fortunes
-+    gen <- newStdGen >>= newIOGenM
-     
-     when (numEvents dist == 0) $ do
-         hPutStrLn stderr "No fortunes matched the filter criteria"
-@@ -225,8 +227,8 @@ main = do
-             , let pctStr = printf "(%.2f%%)" (100 * weight / totalWeight dist) :: String
-             ]
-         else do
--            (file, fortuneDist) <- sample dist
--            fortune <- sample fortuneDist
-+            (file, fortuneDist) <- sampleFrom gen dist
-+            fortune <- sampleFrom gen fortuneDist
-             putStrLn . T.unpack =<< getFortune file fortune
- 
- getDist :: Args -> [FortuneFile] -> IO (Categorical Float (FortuneFile, Categorical Float Int))



More information about the arch-commits mailing list