darcs

Patch 436 add a couple of cabal flags

Title add a couple of cabal flags
Superseder Nosy List galbolle, ganesh
Related Issues
Status accepted Assigned To
Milestone

Created on 2010-10-23.20:53:03 by ganesh, last changed 2011-05-10.20:06:09 by darcswatch. Tracked on DarcsWatch.

Files
File name Status Uploaded Type Edit Remove
make-test-harness-optional.dpatch ganesh, 2010-10-23.20:53:03 text/x-darcs-patch
unnamed ganesh, 2010-10-23.20:53:03
See mailing list archives for discussion on individual patches.
Messages
msg12810 (view) Author: ganesh Date: 2010-10-23.20:53:03
This bundle introduces -ftest (default off) and
-foptimize (default on).

The test harness build was originally optional, but this was
temporarily removed when the unit tests were moved into it.
Since the buildbots use -ftest it should be fine to replace it.
It's important that we do this before making a release, as
default dependencies on QuickCheck can be disruptive.

The other flag allows for -f-optimize in local development,
which speeds up builds.

2 patches for repository http://darcs.net/screened:

Wed Oct 20 06:44:43 BST 2010  Ganesh Sittampalam <ganesh@earth.li>
  * make test harness optional

Fri Oct 22 19:17:56 BST 2010  Ganesh Sittampalam <ganesh@earth.li>
  * move optimization setting into a flag
  Turning this off is particularly useful during development
Attachments
msg12814 (view) Author: darcswatch Date: 2010-10-23.21:08:26
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/screened.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_screened.html#bundle-c5e39308e924a6dcaf67222f24b2dd8682e2fe13
msg12910 (view) Author: galbolle Date: 2010-11-04.21:19:54
do we want -ftest to be off by default in HEAD, as opposed to release 
branches?
msg12917 (view) Author: ganesh Date: 2010-11-05.05:48:34
On Thu, 4 Nov 2010, Florent Becker wrote:

> Florent Becker <florent.becker@ens-lyon.org> added the comment:
>
> do we want -ftest to be off by default in HEAD, as opposed to release
> branches?

I think it'd be easiest to be consistent, both in terms of helping 
developers remember what the current setting is, and to avoid the overhead 
of having to switch it when we make release branches and then be careful 
not to merge that patch into HEAD.

Ganesh
msg12922 (view) Author: galbolle Date: 2010-11-05.11:18:07
is it possible to have cabal test fail and explain why it fails if tests 
have not been enabled?
msg12992 (view) Author: galbolle Date: 2010-11-11.13:00:47
Applying

make test harness optional
--------------------------
Ganesh Sittampalam <ganesh@earth.li>**20101020054443

hunk ./darcs.cabal 110
>    default:     False
>    description: A cunning trick to have cabal install build 
dependencies
>  
> +flag test
> +  default:     False
> +  description: Build test harness
> +
>  -- ------------------------------------------------------------------
----
>  -- darcs library
>  -- ------------------------------------------------------------------
----

Add a test flag.

hunk ./darcs.cabal 509
>  Executable          darcs-test
>    main-is:          test.hs
>  
> -  buildable: True
> -  build-depends:   base          < 5,
> -                   extensible-exceptions >= 0.1 && < 0.2,
> -                   regex-compat >= 0.71 && < 0.94,
> -                   mtl          >= 1.0 && < 1.2,
> -                   parsec       >= 2.0 && < 3.1,
> -                   html         == 1.0.*,
> -                   filepath     == 1.1.*,
> -                   QuickCheck   >= 2.1.0.0,
> -                   HUnit        >= 1.0,
> -                   cmdlib       >= 0.2.1 && < 0.3,
> -                   shellish     >= 0.1.1 && < 0.2,
> -                   test-framework             >= 0.2.2,
> -                   test-framework-hunit       >= 0.2.2,
> -                   test-framework-quickcheck2 >= 0.2.2
> +  if !flag(test)
> +    buildable: False
> +  else
> +    buildable: True
> +    build-depends:   base          < 5,
> +                     extensible-exceptions >= 0.1 && < 0.2,
> +                     regex-compat >= 0.71 && < 0.94,
> +                     mtl          >= 1.0 && < 1.2,
> +                     parsec       >= 2.0 && < 3.1,
> +                     html         == 1.0.*,
> +                     filepath     == 1.1.*,
> +                     QuickCheck   >= 2.1.0.0,
> +                     HUnit        >= 1.0,
> +                     cmdlib       >= 0.2.1 && < 0.3,
> +                     shellish     >= 0.1.1 && < 0.2,
> +                     test-framework             >= 0.2.2,
> +                     test-framework-hunit       >= 0.2.2,
> +                     test-framework-quickcheck2 >= 0.2.2
>  

Do not build tests when user said no tests.

hunk ./darcs.cabal 528
> -  hs-source-dirs:   src
> -  include-dirs:     src
> -  c-sources:        src/atomic_create.c
> -                    src/fpstring.c
> -                    src/maybe_relink.c
> -                    src/umask.c
> -                    src/Crypt/sha2.c
> -  -- list all unit test modules not exported by libdarcs; otherwise 
Cabal won't
> -  -- include them in the tarball
> -  other-modules:    Darcs.Test.Email
> -                    Darcs.Test.Patch.Check
> -                    Darcs.Test.Patch.Info
> -                    Darcs.Test.Patch.Properties
> -                    Darcs.Test.Patch.QuickCheck
> -                    Darcs.Test.Patch.Test
> -                    Darcs.Test.Patch.Unit
> -                    Darcs.Test.Patch.Unit2
> -                    Darcs.Test.Patch
> -                    Darcs.Test.Misc
> +    hs-source-dirs:   src
> +    include-dirs:     src
> +    c-sources:        src/atomic_create.c
> +                      src/fpstring.c
> +                      src/maybe_relink.c
> +                      src/umask.c
> +                      src/Crypt/sha2.c
> +    -- list all unit test modules not exported by libdarcs; otherwise 
Cabal won't
> +    -- include them in the tarball
> +    other-modules:    Darcs.Test.Email
> +                      Darcs.Test.Patch.Check
> +                      Darcs.Test.Patch.Info
> +                      Darcs.Test.Patch.Properties
> +                      Darcs.Test.Patch.QuickCheck
> +                      Darcs.Test.Patch.Test
> +                      Darcs.Test.Patch.Unit
> +                      Darcs.Test.Patch.Unit2
> +                      Darcs.Test.Patch
> +                      Darcs.Test.Misc
>  

indentation

hunk ./darcs.cabal 548
> -  -- We need optimizations, regardless of what Hackage says
> -  -- Note: "if true" works around a cabal bug with order of flag 
composition
> -  if true
> -    ghc-options:      -Wall -O2 -funbox-strict-fields -fwarn-tabs
> +    -- We need optimizations, regardless of what Hackage says
> +    -- Note: "if true" works around a cabal bug with order of flag 
composition
> +    if true
> +      ghc-options:      -Wall -O2 -funbox-strict-fields -fwarn-tabs
>  

more indentation

hunk ./darcs.cabal 553
> -  if impl(ghc>=6.12)
> -    ghc-options: -fno-warn-unused-do-bind
> +    if impl(ghc>=6.12)
> +      ghc-options: -fno-warn-unused-do-bind
>  

yet more indentation

hunk ./darcs.cabal 556
> -  ghc-prof-options: -prof -auto-all
> -  if flag(threaded)
> -    ghc-options:    -threaded
> +    ghc-prof-options: -prof -auto-all
> +    if flag(threaded)
> +      ghc-options:    -threaded
>  

i8n

hunk ./darcs.cabal 560
> -  cc-options:       -D_REENTRANT
> +    cc-options:       -D_REENTRANT
>  

i8n yet again

hunk ./darcs.cabal 562
> -  cpp-options:      -DGADT_WITNESSES=1
> +    cpp-options:      -DGADT_WITNESSES=1
>  

…

hunk ./darcs.cabal 564
> -  if os(windows)
> -    hs-source-dirs: src/win32
> -    include-dirs:   src/win32
> -    other-modules:  CtrlC
> -                    System.Posix
> -                    System.Posix.Files
> -                    System.Posix.IO
> -    cpp-options:    -DWIN32
> -    c-sources:      src/win32/send_email.c
> -    build-depends:  unix-compat >= 0.1.2,
> -                    regex-posix >= 0.94.4 && < 0.95
> +    if os(windows)
> +      hs-source-dirs: src/win32
> +      include-dirs:   src/win32
> +      other-modules:  CtrlC
> +                      System.Posix
> +                      System.Posix.Files
> +                      System.Posix.IO
> +      cpp-options:    -DWIN32
> +      c-sources:      src/win32/send_email.c
> +      build-depends:  unix-compat >= 0.1.2,
> +                      regex-posix >= 0.94.4 && < 0.95
>  

…

hunk ./darcs.cabal 576
> -  if os(solaris)
> -    cc-options:     -DHAVE_SIGINFO_H
> +    if os(solaris)
> +      cc-options:     -DHAVE_SIGINFO_H
>  

……

hunk ./darcs.cabal 579
> -  if !os(windows)
> -    build-depends: unix >= 1.0 && < 2.5
> +    if !os(windows)
> +      build-depends: unix >= 1.0 && < 2.5
>  

………

hunk ./darcs.cabal 582
> -  build-depends: base >= 4 && < 5,
> -                 bytestring >= 0.9.0 && < 0.10,
> -                 haskeline    >= 0.6.2.2 && < 0.7,
> -                 text >= 0.3,
> -                 old-time   == 1.0.*,
> -                 directory  == 1.0.*,
> -                 process    == 1.0.*,
> -                 containers >= 0.1 && < 0.4,
> -                 array      >= 0.1 && < 0.4,
> -                 hashed-storage >= 0.5.2 && < 0.6,
> -                 random     == 1.0.*
> +    build-depends: base >= 4 && < 5,
> +                   bytestring >= 0.9.0 && < 0.10,
> +                   haskeline    >= 0.6.2.2 && < 0.7,
> +                   text >= 0.3,
> +                   old-time   == 1.0.*,
> +                   directory  == 1.0.*,
> +                   process    == 1.0.*,
> +                   containers >= 0.1 && < 0.4,
> +                   array      >= 0.1 && < 0.4,
> +                   hashed-storage >= 0.5.2 && < 0.6,
> +                   random     == 1.0.*
>  

indentation

hunk ./darcs.cabal 594
> -  if flag(mmap) && !os(windows)
> -    build-depends:    mmap >= 0.5 && < 0.6
> -    cpp-options:      -DHAVE_MMAP
> +    if flag(mmap) && !os(windows)
> +      build-depends:    mmap >= 0.5 && < 0.6
> +      cpp-options:      -DHAVE_MMAP
>  

shouldn't darcs support a "reindent" patchtype?

hunk ./darcs.cabal 598
> -  build-depends:    zlib >= 0.5.1.0 && < 0.6.0.0
> +    build-depends:    zlib >= 0.5.1.0 && < 0.6.0.0
>  

it definitely should

hunk ./darcs.cabal 600
> -  -- The terminfo package cannot be built on Windows.
> -  if flag(terminfo) && !os(windows)
> -    build-depends:    terminfo == 0.3.*
> -    cpp-options:      -DHAVE_TERMINFO
> +    -- The terminfo package cannot be built on Windows.
> +    if flag(terminfo) && !os(windows)
> +      build-depends:    terminfo == 0.3.*
> +      cpp-options:      -DHAVE_TERMINFO
>  

indentation [snip some more of it]


move optimization setting into a flag
-------------------------------------
Ganesh Sittampalam <ganesh@earth.li>**20101022181756

hunk ./darcs.cabal 114
>    default:     False
>    description: Build test harness
>  
> +-- We need optimizations by default, regardless of what Hackage says
> +flag optimize
> +  default:     True
> +  description: Build with optimizations (-O2)
> +
>  -- ------------------------------------------------------------------
----
>  -- darcs library
>  -- ------------------------------------------------------------------
----

Add an optimization flag

hunk ./darcs.cabal 336
>                     random     == 1.0.*
>  
>  
> -    -- We need optimizations, regardless of what Hackage says
> +    if flag(optimize)
> +      ghc-options:      -O2
> +    else
> +      ghc-options:      -O0
> +
>      -- Note: "if true" works around a cabal bug with order of flag 
composition
>      if true

use the flag

hunk ./darcs.cabal 343
> -      ghc-options:      -Wall -O2 -funbox-strict-fields -fwarn-tabs
> +      ghc-options:      -Wall -funbox-strict-fields -fwarn-tabs
>  
>      if impl(ghc>=6.12)
>        ghc-options: -fno-warn-unused-do-bind

remove the hard-coded -O2

[snip]
And twice again (for the two other builds)
msg12993 (view) Author: galbolle Date: 2010-11-11.13:03:43
actually, this bundle depends on patch421, so application is delayed 
until that gets reviewed.
msg12994 (view) Author: ganesh Date: 2010-11-11.13:14:47
Thanks for the review. BTW I agree with your suggestion about making cabal 
test fail if it's not built, though I'm not sure I know how to implement 
it.
msg13140 (view) Author: darcswatch Date: 2010-11-21.12:51:58
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-c5e39308e924a6dcaf67222f24b2dd8682e2fe13
msg14243 (view) Author: darcswatch Date: 2011-05-10.20:06:09
This patch bundle (with 2 patches) was just applied to the repository http://darcs.net/reviewed.
This message was brought to you by DarcsWatch
http://darcswatch.nomeata.de/repo_http:__darcs.net_reviewed.html#bundle-c5e39308e924a6dcaf67222f24b2dd8682e2fe13
History
Date User Action Args
2010-10-23 20:53:03ganeshcreate
2010-10-23 20:54:55darcswatchsetdarcswatchurl: http://darcswatch.nomeata.de/repo_http:__darcs.net_.html#bundle-c5e39308e924a6dcaf67222f24b2dd8682e2fe13
2010-10-23 21:08:26darcswatchsetstatus: needs-screening -> needs-review
messages: + msg12814
2010-11-04 21:19:54galbollesetmessages: + msg12910
2010-11-05 05:48:35ganeshsetmessages: + msg12917
2010-11-05 11:17:28galbollesetassignedto: galbolle
nosy: + galbolle
2010-11-05 11:18:07galbollesetmessages: + msg12922
2010-11-09 13:32:45galbollesetassignedto: galbolle ->
2010-11-11 13:00:47galbollesetstatus: needs-review -> accepted-pending-tests
messages: + msg12992
2010-11-11 13:03:43galbollesetmessages: + msg12993
2010-11-11 13:14:47ganeshsetmessages: + msg12994
2010-11-21 12:51:58darcswatchsetstatus: accepted-pending-tests -> accepted
messages: + msg13140
2011-05-10 20:06:09darcswatchsetmessages: + msg14243