Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-haskell/test-framework-th-prime/files/, dev-haskell/test-framework-th-prime/
Date: Fri, 07 Aug 2020 21:57:07
Message-Id: 1596837411.d89c8965369e2c264653128521a4a0112c243302.slyfox@gentoo
1 commit: d89c8965369e2c264653128521a4a0112c243302
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri Aug 7 21:56:51 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Aug 7 21:56:51 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d89c8965
7
8 dev-haskell/test-framework-th-prime: port to ghc-8
9
10 Reported-by: Agostino Sarubbo
11 Closes: https://bugs.gentoo.org/736252
12 Package-Manager: Portage-3.0.1, Repoman-2.3.23
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 .../test-framework-th-prime-0.0.8-ghc-8.patch | 25 +++++++
16 .../test-framework-th-prime-0.0.9-hse-1.18.patch | 76 ++++++++++++++++++++++
17 .../test-framework-th-prime-0.0.9.ebuild | 2 +
18 3 files changed, 103 insertions(+)
19
20 diff --git a/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch
21 new file mode 100644
22 index 00000000000..b3cbf27a28f
23 --- /dev/null
24 +++ b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.8-ghc-8.patch
25 @@ -0,0 +1,25 @@
26 +diff --git a/Test/Framework/TH/Prime.hs b/Test/Framework/TH/Prime.hs
27 +index 75b0798..0bed643 100644
28 +--- a/Test/Framework/TH/Prime.hs
29 ++++ b/Test/Framework/TH/Prime.hs
30 +@@ -1,2 +1,3 @@
31 + {-# LANGUAGE QuasiQuotes, TemplateHaskell #-}
32 ++{-# LANGUAGE CPP #-}
33 +
34 +@@ -119,3 +120,7 @@ isDefined :: String -> Q Bool
35 + isDefined n = return False `recover` do
36 ++#if MIN_VERSION_template_haskell(2,11,0)
37 ++ VarI (Name _ flavour) _ _ <- reify (mkName n)
38 ++#else
39 + VarI (Name _ flavour) _ _ _ <- reify (mkName n)
40 ++#endif
41 + modul <- loc_module <$> location
42 +diff --git a/Test/Framework/TH/Prime/Parser.hs b/Test/Framework/TH/Prime/Parser.hs
43 +index 7f541c4..fef60f1 100644
44 +--- a/Test/Framework/TH/Prime/Parser.hs
45 ++++ b/Test/Framework/TH/Prime/Parser.hs
46 +@@ -78,3 +78,3 @@ parseTest file = do
47 + #if MIN_VERSION_haskell_src_exts(1, 14, 0)
48 +- extensions = nub $ EnableExtension TemplateHaskell : exts raw
49 ++ extensions = nub $ EnableExtension Language.Haskell.Exts.Extension.TemplateHaskell : exts raw
50 + #else
51
52 diff --git a/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch
53 new file mode 100644
54 index 00000000000..359d5ea4f6a
55 --- /dev/null
56 +++ b/dev-haskell/test-framework-th-prime/files/test-framework-th-prime-0.0.9-hse-1.18.patch
57 @@ -0,0 +1,76 @@
58 +diff --git a/Test/Framework/TH/Prime/Parser.hs b/Test/Framework/TH/Prime/Parser.hs
59 +index 87553a6..f188390 100644
60 +--- a/Test/Framework/TH/Prime/Parser.hs
61 ++++ b/Test/Framework/TH/Prime/Parser.hs
62 +@@ -10,2 +10,5 @@ import Language.Haskell.Exts.Extension
63 + import Language.Haskell.Exts.Parser
64 ++#if MIN_VERSION_haskell_src_exts(1, 18, 0)
65 ++import Language.Haskell.Exts.SrcLoc
66 ++#endif
67 + import Language.Haskell.Exts.Syntax hiding (VarName, Exp)
68 +@@ -14,2 +17,11 @@ import Language.Preprocessor.Cpphs hiding (Ident)
69 +
70 ++#if MIN_VERSION_haskell_src_exts(1, 18, 0)
71 ++-- location field for haskell-src-exts-1.18
72 ++#define L SrcSpanInfo
73 ++#define loc _
74 ++#else
75 ++#define L
76 ++#define loc
77 ++#endif
78 ++
79 + ----------------------------------------------------------------
80 +@@ -45,3 +57,7 @@ getTests :: FilePath -> IO ([String], [String])
81 + getTests file = do
82 ++#if MIN_VERSION_haskell_src_exts(1, 18, 0)
83 ++ ParseOk (Module _ _ _ _ decls) <- parseTest file
84 ++#else
85 + ParseOk (Module _ _ _ _ _ _ decls) <- parseTest file
86 ++#endif
87 + let funs = map fromFunBind $ filter isFunBind decls
88 +@@ -54,3 +70,3 @@ getTests file = do
89 +
90 +-parseTest :: FilePath -> IO (ParseResult Module)
91 ++parseTest :: FilePath -> IO (ParseResult (Module L))
92 + parseTest file = do
93 +@@ -74,4 +90,4 @@ parseTest file = do
94 + #endif
95 +- toStr (Ident str) = str
96 +- toStr (Symbol str) = str
97 ++ toStr (Ident loc str) = str
98 ++ toStr (Symbol loc str) = str
99 + opt raw = defaultParseMode {
100 +@@ -88,7 +104,7 @@ parseTest file = do
101 +
102 +-isFunBind :: Decl -> Bool
103 +-isFunBind (FunBind _) = True
104 +-isFunBind _ = False
105 ++isFunBind :: Decl L -> Bool
106 ++isFunBind (FunBind loc _) = True
107 ++isFunBind _ = False
108 +
109 +-isPatBind :: Decl -> Bool
110 ++isPatBind :: Decl L -> Bool
111 + isPatBind PatBind{} = True
112 +@@ -96,6 +112,6 @@ isPatBind _ = False
113 +
114 +-fromPatBind :: Decl -> String
115 ++fromPatBind :: Decl L -> String
116 + #if MIN_VERSION_haskell_src_exts(1, 16, 0)
117 +-fromPatBind (PatBind _ (PVar (Ident name)) _ _) = name
118 +-fromPatBind (PatBind _ (PVar (Symbol name)) _ _) = name
119 ++fromPatBind (PatBind _ (PVar loc (Ident loc name)) _ _) = name
120 ++fromPatBind (PatBind _ (PVar loc (Symbol loc name)) _ _) = name
121 + #else
122 +@@ -106,5 +122,10 @@ fromPatBind _ = error "fromPatBind"
123 +
124 +-fromFunBind :: Decl -> String
125 ++fromFunBind :: Decl L -> String
126 ++#if MIN_VERSION_haskell_src_exts(1, 18, 0)
127 ++fromFunBind (FunBind _floc (Match _ (Ident _iloc name) _ _ _:_)) = name
128 ++fromFunBind (FunBind _floc (Match _ (Symbol _sloc name) _ _ _:_)) = name
129 ++#else
130 + fromFunBind (FunBind (Match _ (Ident name) _ _ _ _:_)) = name
131 + fromFunBind (FunBind (Match _ (Symbol name) _ _ _ _:_)) = name
132 ++#endif
133 + fromFunBind _ = error "fromFunBind"
134
135 diff --git a/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild b/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild
136 index fd0bfb0801c..ab54c1b6765 100644
137 --- a/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild
138 +++ b/dev-haskell/test-framework-th-prime/test-framework-th-prime-0.0.9.ebuild
139 @@ -25,3 +25,5 @@ RDEPEND=">=dev-haskell/cpphs-0.2.1:=[profile?]
140 DEPEND="${RDEPEND}
141 >=dev-haskell/cabal-1.6
142 "
143 +
144 +PATCHES=("${FILESDIR}"/${P}-hse-1.18.patch)