update for newer h-s-e

This commit is contained in:
Jens Petersen 2017-02-22 21:24:03 +09:00
parent 7397657f09
commit 16d2cbbdd9
2 changed files with 59 additions and 3 deletions

View File

@ -1,15 +1,18 @@
# generated by cabal-rpm-0.11.1
# https://fedoraproject.org/wiki/Packaging:Haskell
%global pkg_name hgettext
%global pkgver %{pkg_name}-%{version}
Name: ghc-%{pkg_name}
Version: 0.1.30
Release: 11%{?dist}
Release: 12%{?dist}
Summary: Haskell binding to libintl
License: BSD
Url: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz
Patch0: hgettext-hse-1.18.patch
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-rpm-macros
@ -40,7 +43,8 @@ This package provides the Haskell %{pkg_name} library development files.
%prep
%setup -q -n %{pkg_name}-%{version}
%setup -q -n %{pkgver}
%patch0 -p1 -b .orig
%build
@ -68,6 +72,9 @@ This package provides the Haskell %{pkg_name} library development files.
%changelog
* Wed Feb 22 2017 Jens Petersen <petersen@redhat.com> - 0.1.30-12
- patch for newer haskell-src-exts
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.30-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

49
hgettext-hse-1.18.patch Normal file
View File

@ -0,0 +1,49 @@
From 5bf5932d6a40f5b830ffdbaa2cda2948eef52732 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <siarheit@google.com>
Date: Sat, 1 Oct 2016 15:13:10 +0100
Subject: [PATCH] update to support haskell-src-exts-1.18
One of major haskell-src-exts-1.18 changes
is to parameterise AST with source location
and add that field to every ast node.
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
---
hgettext.cabal | 2 +-
src/hgettext.hs | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hgettext.cabal b/hgettext.cabal
index af934ac..37b659c 100644
--- a/hgettext.cabal
+++ b/hgettext.cabal
@@ -26,6 +26,6 @@ Executable hgettext
Main-Is: hgettext.hs
Extensions: TemplateHaskell
Hs-Source-Dirs: src
- Build-Depends: base>=3.0.3.0 && <5, uniplate, haskell-src-exts
+ Build-Depends: base>=3.0.3.0 && <5, uniplate, haskell-src-exts >= 1.18
Other-Modules: Paths_hgettext
diff --git a/src/hgettext.hs b/src/hgettext.hs
index c3b1b12..4139cae 100644
--- a/src/hgettext.hs
+++ b/src/hgettext.hs
@@ -49,8 +49,15 @@ parseArgs args =
where header = "Usage: hgettext [OPTION] [INPUTFILE] ..."
-toTranslate :: String -> H.ParseResult H.Module -> [(Int, String)]
-toTranslate f (H.ParseOk z) = nub [ (0, s) | H.App (H.Var (H.UnQual (H.Ident x))) (H.Lit (H.String s)) <- universeBi z, x == f]
+toTranslate :: String -> H.ParseResult (H.Module H.SrcSpanInfo) -> [(Int, String)]
+toTranslate f (H.ParseOk z) = nub [ (0, s)
+ | H.App _
+ (H.Var _
+ (H.UnQual _
+ (H.Ident _ x)))
+ (H.Lit _
+ (H.String _ s _slit)) <- universeBi z :: [H.Exp H.SrcSpanInfo]
+ , x == f]
toTranslate _ _ = []
-- Create list of messages from a single file