summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix13
-rw-r--r--pkgs/development/haskell-modules/patches/gitit-pandoc-2.12.patch65
2 files changed, 8 insertions, 70 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 0956e55ed5dc3..6237361569122 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -1165,11 +1165,14 @@ self: super: {
   # $HOME, which we don't have in our build sandbox.
   cabal-install-parsers = dontCheck super.cabal-install-parsers;
 
-  # * jailbreak can be removed at the next release (current is 0.13.0.0)
-  # * patch fixes compilation with pandoc >= 2.12, can be removed if a
-  #   release contains https://github.com/jgm/gitit/pull/670 or equivalent.
-  #   Patch is vendored in as it may change upstream in the future.
-  gitit = doJailbreak (appendPatch super.gitit ./patches/gitit-pandoc-2.12.patch);
+  # jailbreak and patch (for pandoc >= 2.12) ensure compilation with newer dependencies.
+  # can both be removed at the next release (current is 0.13.0.0)
+  gitit = doJailbreak (appendPatch super.gitit
+    (pkgs.fetchpatch {
+      url = "https://github.com/jgm/gitit/commit/e8c9d94be332e2f73de9b0eee222a2a09f191faf.patch";
+      sha256 = "1rl2c3sz8cd2c3qwv9b640853s4bblcknvfv29k472wqhs62mwz1";
+      includes = [ "src/**" ];
+    }));
 
   # Test suite requires database
   persistent-mysql = dontCheck super.persistent-mysql;
diff --git a/pkgs/development/haskell-modules/patches/gitit-pandoc-2.12.patch b/pkgs/development/haskell-modules/patches/gitit-pandoc-2.12.patch
deleted file mode 100644
index da8e27d2b31d7..0000000000000
--- a/pkgs/development/haskell-modules/patches/gitit-pandoc-2.12.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-commit a03d3b043458f45d29ba32068a77c0d3b8a4223f
-Author: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>
-Date:   Fri Apr 2 15:14:02 2021 +0200
-
-    Allow compilation with pandoc 2.12 and 2.13
-    
-    pandoc 2.13 introduced the following breakages for gitit:
-    
-    * UTF8.readFile now returns a Text which is actually ideal for gitit.
-      If pandoc is new enough we just make readFileUTF8 an alias for
-      UTF8.readFile.
-    
-    * Text.Pandoc.Shared no longer exports substitute. In order to be
-      conservative I've chosen to just copy the substitute function from
-      pandoc 2.11.4. I need this patch kind of urgently so I didn't want to
-      make any changes or refactors independently from upstream if
-      avoidable. However, I'd be happy to rebase this PR branch to adopt a
-      different solution to just copying the function.
-
-diff --git a/src/Network/Gitit/Authentication.hs b/src/Network/Gitit/Authentication.hs
-index 4c240e7..c0f92fd 100644
---- a/src/Network/Gitit/Authentication.hs
-+++ b/src/Network/Gitit/Authentication.hs
-@@ -44,7 +44,7 @@ import System.Exit
- import System.Log.Logger (logM, Priority(..))
- import Data.Char (isAlphaNum, isAlpha)
- import qualified Data.Map as M
--import Text.Pandoc.Shared (substitute)
-+import Data.List (stripPrefix)
- import Data.Maybe (isJust, fromJust, isNothing, fromMaybe)
- import Network.URL (exportURL, add_param, importURL)
- import Network.BSD (getHostName)
-@@ -54,6 +54,16 @@ import Codec.Binary.UTF8.String (encodeString)
- import Data.ByteString.UTF8 (toString)
- import Network.Gitit.Rpxnow as R
- 
-+-- | Replace each occurrence of one sublist in a list with another.
-+--   Vendored in from pandoc 2.11.4 as 2.12 removed this function.
-+substitute :: (Eq a) => [a] -> [a] -> [a] -> [a]
-+substitute _ _ [] = []
-+substitute [] _ xs = xs
-+substitute target replacement lst@(x:xs) =
-+    case stripPrefix target lst of
-+      Just lst' -> replacement ++ substitute target replacement lst'
-+      Nothing   -> x : substitute target replacement xs
-+
- data ValidationType = Register
-                     | ResetPassword
-                     deriving (Show,Read)
-diff --git a/src/Network/Gitit/Util.hs b/src/Network/Gitit/Util.hs
-index c5e9fe5..067130a 100644
---- a/src/Network/Gitit/Util.hs
-+++ b/src/Network/Gitit/Util.hs
-@@ -45,7 +45,11 @@ import Network.URL (encString)
- 
- -- | Read file as UTF-8 string.  Encode filename as UTF-8.
- readFileUTF8 :: FilePath -> IO Text
-+#if MIN_VERSION_pandoc(2,12,0)
-+readFileUTF8 = UTF8.readFile
-+#else
- readFileUTF8 = fmap T.pack . UTF8.readFile
-+#endif
- 
- -- | Perform a function a directory and return to working directory.
- inDir :: FilePath -> IO a -> IO a