Bug#726372: [Pkg-haskell-maintainers] Bug#726372: build on arches w/o TH

2013-10-15 Thread Joachim Breitner
Hi Joey,

Am Montag, den 14.10.2013, 23:45 -0400 schrieb Joey Hess:
 The modifications turn out to be fairly reasonable. Patches attached.

thanks. Some hunks went into the wrong patches, e.g. changes to
debian/control in remove hlint ANNotations. Could you rebase them?

Also, is there a corresponding upstream tickets, at least for the
add-without-th-flag.patch? I’d feel more comfortable applying it
upstream already carries it.

In that case, the HLint annotations might also be upstreamable, if they
are guarded by the DISABLE_TEMPLATE_HASKELL #ifndef.

Greetings,
Joachim

-- 
Joachim nomeata Breitner
Debian Developer
  nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata




signature.asc
Description: This is a digitally signed message part


Bug#726372: [Pkg-haskell-maintainers] Bug#726372: build on arches w/o TH

2013-10-15 Thread Joey Hess
Joachim Breitner wrote:
 thanks. Some hunks went into the wrong patches, e.g. changes to
 debian/control in remove hlint ANNotations. Could you rebase them?

done

 Also, is there a corresponding upstream tickets, at least for the
 add-without-th-flag.patch? I’d feel more comfortable applying it
 upstream already carries it.

I have not had a chance to update the patches to the newer upstream
version.

-- 
see shy jo
From ada3d5e40893019ace7e339c96ef70928b30959e Mon Sep 17 00:00:00 2001
From: Joey Hess j...@kitenet.net
Date: Tue, 15 Oct 2013 09:54:16 -0400
Subject: [PATCH 1/3] packaging changes

---
 debian/control | 15 +++
 debian/rules   |  5 +
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/debian/control b/debian/control
index 83af3b0..fa467a6 100644
--- a/debian/control
+++ b/debian/control
@@ -26,9 +26,9 @@ Build-Depends: debhelper (= 9)
  , libghc-distributive-dev ( 0.3)
  , libghc-distributive-dev ( 1)
  , libghc-distributive-prof
- , libghc-generic-deriving-dev ( 1.4)
- , libghc-generic-deriving-dev ( 1.6)
- , libghc-generic-deriving-prof
+ , libghc-generic-deriving-dev ( 1.4) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-generic-deriving-dev ( 1.6) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-generic-deriving-prof [!armel !armhf !mips !mipsel !s390 !s390x]
  , libghc-hashable-dev ( 1.1.2.3)
  , libghc-hashable-dev ( 1.3)
  , libghc-hashable-prof
@@ -47,9 +47,9 @@ Build-Depends: debhelper (= 9)
  , libghc-profunctors-dev ( 3.2)
  , libghc-profunctors-dev ( 4)
  , libghc-profunctors-prof
- , libghc-reflection-dev ( 1.1.6)
- , libghc-reflection-dev ( 2)
- , libghc-reflection-prof
+ , libghc-reflection-dev ( 1.1.6) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-reflection-dev ( 2) [!armel !armhf !mips !mipsel !s390 !s390x]
+ , libghc-reflection-prof [!armel !armhf !mips !mipsel !s390 !s390x]
  , libghc-semigroupoids-dev ( 3.0.2)
  , libghc-semigroupoids-dev ( 4)
  , libghc-semigroupoids-prof
@@ -62,7 +62,6 @@ Build-Depends: debhelper (= 9)
  , libghc-tagged-dev ( 0.4.4)
  , libghc-tagged-dev ( 1)
  , libghc-tagged-prof
- , ghc-ghci
  , libghc-text-dev ( 0.11)
  , libghc-text-dev ( 0.12)
  , libghc-text-prof
@@ -83,7 +82,7 @@ Build-Depends: debhelper (= 9)
  , libghc-test-framework-dev ( 0.6)
  , libghc-test-framework-quickcheck2-dev ( 0.2)
  , libghc-test-framework-hunit-dev ( 0.2)
- , libghc-test-framework-th-dev ( 0.2)
+ , libghc-test-framework-th-dev ( 0.2) [!armel !armhf !mips !mipsel !s390 !s390x]
  , libghc-doctest-dev ( 0.9.1)
  , libghc-simple-reflect-dev ( 0.3.1)
 Build-Depends-Indep: ghc-doc
diff --git a/debian/rules b/debian/rules
index 8ec1809..8ad7013 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,3 +10,8 @@ ifeq ($(DEB_HOST_ARCH),sparc)
 	# Disable tests that require SMP.
 	DEB_SETUP_GHC_CONFIGURE_ARGS := -f-test-hunit -f-test-properties
 endif
+
+ifeq ($(shell if [ ! -e /usr/bin/ghci ]; then echo 0; fi),0)
+	DEB_SETUP_GHC_CONFIGURE_ARGS := -fwithout-th -f-test-hunit -f-test-properties -f-test-doctests
+endif
+
-- 
1.8.4.rc3

From 42c73dc2026eb8aeeb1cf60ca4102357f3718a06 Mon Sep 17 00:00:00 2001
From: Joey Hess j...@kitenet.net
Date: Tue, 15 Oct 2013 09:56:50 -0400
Subject: [PATCH 2/3] add without-th flag

---
 lens.cabal | 28 +---
 src/Control/Lens/Internal/Exception.hs |  6 ++
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/lens.cabal b/lens.cabal
index 8714cdd..7c31cab 100644
--- a/lens.cabal
+++ b/lens.cabal
@@ -133,6 +133,11 @@ flag dump-splices
   default: False
   manual: True
 
+-- Avoid bulding modules that need TH
+flag without-th
+  default: False
+  manual: True
+
 -- You can disable the doctests test suite with -f-test-doctests
 flag test-doctests
   default: True
@@ -175,7 +180,6 @@ library
 containers= 0.4.0  0.6,
 distributive  = 0.31,
 filepath  = 1.2.0.01.4,
-generic-deriving  = 1.41.6,
 ghc-prim,
 hashable  = 1.1.2.31.3,
 MonadCatchIO-transformers = 0.30.4,
@@ -183,7 +187,6 @@ library
 parallel  = 3.1.0.13.3,
 profunctors   = 3.24,
 profunctor-extras = 3.34,
-reflection= 1.1.6  2,
 semigroupoids = 3.0.2  4,
 semigroups= 0.8.4  1,
 split == 0.2.*,
@@ -237,7 +240,6 @@ library
 Control.Lens.Review
 Control.Lens.Setter
 Control.Lens.Simple
-Control.Lens.TH
 Control.Lens.Traversal
 Control.Lens.Tuple
 Control.Lens.Type
@@ -268,14 +270,23 @@ library
 Data.Typeable.Lens
 Data.Vector.Lens
 Data.Vector.Generic.Lens
-Generics.Deriving.Lens
-GHC.Generics.Lens
 System.Exit.Lens
 System.FilePath.Lens
-System.IO.Error.Lens
-Language.Haskell.TH.Lens
 Numeric.Lens
 
+  if flag(without-th)
+

Bug#726372: build on arches w/o TH

2013-10-14 Thread Joey Hess
Package: haskell-lens
Severity: normal
Version: 3.9.0.2
Tags: patch

Lens FTBFS on arches without TH, but the template haskell is only used
for deriving lenses for records (and some dependencies of error lenses).
Lens is otherwise useable on those arches. For example, code might only
want to use a lens into tuples, or maps, or any of the many other
provided lenses. Or a package that does need record lenses could be
fixed to build on all arches rather simply by pasting in the boilerplate
getters and setters, and could then use the rest of lens.

I have been avoiding using lens for some time because of this
portability problem. But it strikes me that the rest of the haskell
community is not likely to do that, and it seems to be getting more
widely used. So I think Debian should consider modifying lens to build
without TH on arches that lack it. 

The modifications turn out to be fairly reasonable. Patches attached.

There is a risk that some package that currently builds on arches
without TH currently tests that lens is not available, and avoids using
Control.Lens.TH. With this patch, such a test would be defeated, and the
package's build would be broken. I feel this is an fairly unlikely
scenario, and one that would be quickly caught in the regular haskell
package rebuild cycle, and would be easily fixed.

-- 
see shy jo
From 04510ab1a91ec7445b9575e9cb7fda3be94b2b2c Mon Sep 17 00:00:00 2001
From: Joey Hess j...@kitenet.net
Date: Sun, 13 Oct 2013 01:55:21 -0400
Subject: [PATCH 1/3] remove hlint ANNotations

These prevent building on systems without ghci.
---
 debian/control  |7 +++
 src/Control/Exception/Lens.hs   |2 --
 src/Control/Lens.hs |1 -
 src/Control/Lens/Equality.hs|3 ---
 src/Control/Lens/Fold.hs|4 
 src/Control/Lens/Internal.hs|1 -
 src/Control/Lens/Internal/Zipper.hs |1 -
 src/Control/Lens/Iso.hs |1 -
 src/Control/Lens/Lens.hs|2 --
 src/Control/Lens/Operators.hs   |1 -
 src/Control/Lens/Plated.hs  |1 -
 src/Control/Lens/Prism.hs   |1 -
 src/Control/Lens/Setter.hs  |1 -
 src/Data/Data/Lens.hs   |3 ---
 14 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/debian/control b/debian/control
index 83af3b0..364ee63 100644
--- a/debian/control
+++ b/debian/control
@@ -26,9 +26,9 @@ Build-Depends: debhelper (= 9)
  , libghc-distributive-dev ( 0.3)
  , libghc-distributive-dev ( 1)
  , libghc-distributive-prof
- , libghc-generic-deriving-dev ( 1.4)
- , libghc-generic-deriving-dev ( 1.6)
- , libghc-generic-deriving-prof
+ , libghc-generic-deriving-dev ( 1.4) [!armel]
+ , libghc-generic-deriving-dev ( 1.6) [!armel]
+ , libghc-generic-deriving-prof [!armel]
  , libghc-hashable-dev ( 1.1.2.3)
  , libghc-hashable-dev ( 1.3)
  , libghc-hashable-prof
@@ -62,7 +62,6 @@ Build-Depends: debhelper (= 9)
  , libghc-tagged-dev ( 0.4.4)
  , libghc-tagged-dev ( 1)
  , libghc-tagged-prof
- , ghc-ghci
  , libghc-text-dev ( 0.11)
  , libghc-text-dev ( 0.12)
  , libghc-text-prof
diff --git a/src/Control/Exception/Lens.hs b/src/Control/Exception/Lens.hs
index 4bc3926..34b46ff 100644
--- a/src/Control/Exception/Lens.hs
+++ b/src/Control/Exception/Lens.hs
@@ -112,8 +112,6 @@ import Prelude
   ,  Maybe(..), Either(..), Functor(..), String, IO
   )
 
-{-# ANN module HLint: ignore Use Control.Exception.catch #-}
-
 -- $setup
 --  :set -XNoOverloadedStrings
 --  :m + Control.Exception Control.Monad Data.List Prelude
diff --git a/src/Control/Lens.hs b/src/Control/Lens.hs
index 242c3c1..c60cf91 100644
--- a/src/Control/Lens.hs
+++ b/src/Control/Lens.hs
@@ -99,4 +99,3 @@ import Control.Lens.Wrapped
 import Control.Lens.Zipper
 import Control.Lens.Zoom
 
-{-# ANN module HLint: ignore Use import/export shortcut #-}
diff --git a/src/Control/Lens/Equality.hs b/src/Control/Lens/Equality.hs
index 982c2d7..32c25c3 100644
--- a/src/Control/Lens/Equality.hs
+++ b/src/Control/Lens/Equality.hs
@@ -28,9 +28,6 @@ module Control.Lens.Equality
 import Control.Lens.Internal.Setter
 import Control.Lens.Type
 
-{-# ANN module HLint: ignore Use id #-}
-{-# ANN module HLint: ignore Eta reduce #-}
-
 -- $setup
 --  import Control.Lens
 
diff --git a/src/Control/Lens/Fold.hs b/src/Control/Lens/Fold.hs
index 32a4073..aec2d4d 100644
--- a/src/Control/Lens/Fold.hs
+++ b/src/Control/Lens/Fold.hs
@@ -163,10 +163,6 @@ import Data.Traversable
 --  let g :: Expr - Expr; g = Debug.SimpleReflect.Vars.g
 --  let timingOut :: NFData a = a - IO a; timingOut = fmap (fromMaybe (error timeout)) . timeout (5*10^6) . evaluate . force
 
-{-# ANN module HLint: ignore Eta reduce #-}
-{-# ANN module HLint: ignore Use camelCase #-}
-{-# ANN module HLint: ignore Use curry #-}
-
 infixl 8 ^.., ^?, ^?!, ^@.., ^@?, ^@?!
 
 --
diff --git a/src/Control/Lens/Internal.hs b/src/Control/Lens/Internal.hs
index 295662e..7b30335 100644
---