git-annex.cabal: Deal with breaking changes in Cabal 2.0

https://github.com/haskell/cabal/issues/4655

This means that when a module is conditionally imported via ifdef
depending on the OS or build flags, the cabal file has to mirror the
same logic there to only list the module then.

Since there are lots of OS's and lots of combinations of build flags
here, it's rather difficult to know if the cabal file has been completelty
correctly updated to match the source code.

So I am very unhappy with needing to update things in two places. I've
only tested this on linux with most build flags enables; this will
probably need significant time and testing to catch every cabal file
tweak that this change to Cabal requires. And it will be a continual
source of compile failures going forward when the code is modified and
the cabal file not also updated.

DRY DRY DRY, I repeat myself, but: DRY! Sigh..

(Also, had to remove all Build.* that are standalone programs from the
Other-Modules list, because since cabal passes those modules to ghc when
building git-annex, it complains that they use module Main. Those
modules are only used when building with the Makefile anyway, so this
change shouldn't break anything.)

This commit was sponsored by Thomas Hochstein on Patreon.
This commit is contained in:
Joey Hess 2017-08-18 10:53:31 -04:00
parent 1b1c970b99
commit 55495c5a98
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 35 additions and 28 deletions

View file

@ -39,6 +39,7 @@ git-annex (6.20170521) UNRELEASED; urgency=medium
* Fix the external special remotes git-annex-remote-ipfs, * Fix the external special remotes git-annex-remote-ipfs,
git-annex-remote-torrent and the example.sh template to correctly git-annex-remote-torrent and the example.sh template to correctly
support filenames with spaces. support filenames with spaces.
* git-annex.cabal: Deal with breaking changes in Cabal 2.0.
-- Joey Hess <id@joeyh.name> Sat, 17 Jun 2017 13:02:24 -0400 -- Joey Hess <id@joeyh.name> Sat, 17 Jun 2017 13:02:24 -0400

View file

@ -48,3 +48,4 @@ Dependency tree exhaustively searched.
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
Yes :) Yes :)
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,14 @@
[[!comment format=mdwn
username="joey"
subject="""comment 6"""
date="2017-08-18T15:02:42Z"
content="""
I've updated the cabal file, it should build now. Although unfortunately
the breaking changes to cabal are such that it might still fail to build
with some OS's and some combinations of build flags, where it used to build
before. I only tested on Linux with stack (modified for resolver:
nightly-2017-08-17)
As to the quickcheck failures, I think that's the same problem I already
fixed in [[!commit da8e84efe997fcbfcf489bc4fa9cc835ed131d3a]].
"""]]

View file

@ -409,30 +409,31 @@ Executable git-annex
CPP-Options: -DWITH_ASSISTANT CPP-Options: -DWITH_ASSISTANT
if flag(Assistant) if flag(Assistant)
if os(linux) if os(linux) || flag(Android)
Build-Depends: hinotify Build-Depends: hinotify
CPP-Options: -DWITH_INOTIFY CPP-Options: -DWITH_INOTIFY
Other-Modules: Utility.DirWatcher.INotify
else else
if os(darwin) if os(darwin)
Build-Depends: hfsevents Build-Depends: hfsevents
CPP-Options: -DWITH_FSEVENTS CPP-Options: -DWITH_FSEVENTS
Other-Modules: Utility.DirWatcher.FSEvents
else else
if os(windows) if os(windows)
Build-Depends: Win32-notify Build-Depends: Win32-notify
CPP-Options: -DWITH_WIN32NOTIFY CPP-Options: -DWITH_WIN32NOTIFY
Other-Modules: Utility.DirWatcher.Win32Notify
else else
if (! os(solaris) && ! os(linux)) if (! os(solaris) && ! os(linux))
if flag(Android) CPP-Options: -DWITH_KQUEUE
Build-Depends: hinotify C-Sources: Utility/libkqueue.c
CPP-Options: -DWITH_INOTIFY Other-Modules: Utility.DirWatcher.Kqueue
else
CPP-Options: -DWITH_KQUEUE
C-Sources: Utility/libkqueue.c
if flag(Dbus) if flag(Dbus)
if (os(linux)) if (os(linux))
Build-Depends: dbus (>= 0.10.7), fdo-notify (>= 0.3) Build-Depends: dbus (>= 0.10.7), fdo-notify (>= 0.3)
CPP-Options: -DWITH_DBUS -DWITH_DESKTOP_NOTIFY -DWITH_DBUS_NOTIFICATIONS CPP-Options: -DWITH_DBUS -DWITH_DESKTOP_NOTIFY -DWITH_DBUS_NOTIFICATIONS
Other-Modules: Utility.DBus
if flag(Android) if flag(Android)
Build-Depends: data-endian Build-Depends: data-endian
@ -481,6 +482,7 @@ Executable git-annex
if flag(Benchmark) if flag(Benchmark)
Build-Depends: criterion, deepseq Build-Depends: criterion, deepseq
CPP-Options: -DWITH_BENCHMARK CPP-Options: -DWITH_BENCHMARK
Other-Modules: Command.Benchmark
Other-Modules: Other-Modules:
Annex Annex
@ -651,20 +653,10 @@ Executable git-annex
Backend.URL Backend.URL
Backend.Utilities Backend.Utilities
Backend.WORM Backend.WORM
Build.BuildVersion
Build.BundledPrograms Build.BundledPrograms
Build.Configure Build.Configure
Build.DesktopFile Build.DesktopFile
Build.DistributionUpdate
Build.EvilLinker
Build.EvilSplicer
Build.InstallDesktopFile
Build.LinuxMkLibs
Build.MakeMans
Build.Mans Build.Mans
Build.NullSoftInstaller
Build.OSXMkLibs
Build.Standalone
Build.TestConfig Build.TestConfig
Build.Version Build.Version
BuildInfo BuildInfo
@ -687,7 +679,6 @@ Executable git-annex
Command.AddUrl Command.AddUrl
Command.Adjust Command.Adjust
Command.Assistant Command.Assistant
Command.Benchmark
Command.CalcKey Command.CalcKey
Command.CheckPresentKey Command.CheckPresentKey
Command.Commit Command.Commit
@ -984,16 +975,11 @@ Executable git-annex
Utility.Bloom Utility.Bloom
Utility.CoProcess Utility.CoProcess
Utility.CopyFile Utility.CopyFile
Utility.DBus
Utility.Daemon Utility.Daemon
Utility.Data Utility.Data
Utility.DataUnits Utility.DataUnits
Utility.DirWatcher Utility.DirWatcher
Utility.DirWatcher.FSEvents
Utility.DirWatcher.INotify
Utility.DirWatcher.Kqueue
Utility.DirWatcher.Types Utility.DirWatcher.Types
Utility.DirWatcher.Win32Notify
Utility.Directory Utility.Directory
Utility.DiskFree Utility.DiskFree
Utility.Dot Utility.Dot
@ -1016,14 +1002,10 @@ Executable git-annex
Utility.LockFile Utility.LockFile
Utility.LockFile.LockStatus Utility.LockFile.LockStatus
Utility.LockFile.PidLock Utility.LockFile.PidLock
Utility.LockFile.Posix
Utility.LockFile.Windows
Utility.LockPool Utility.LockPool
Utility.LockPool.LockHandle Utility.LockPool.LockHandle
Utility.LockPool.PidLock Utility.LockPool.PidLock
Utility.LockPool.Posix
Utility.LockPool.STM Utility.LockPool.STM
Utility.LockPool.Windows
Utility.LogFile Utility.LogFile
Utility.Lsof Utility.Lsof
Utility.MagicWormhole Utility.MagicWormhole
@ -1070,5 +1052,14 @@ Executable git-annex
Utility.UserInfo Utility.UserInfo
Utility.Verifiable Utility.Verifiable
Utility.WebApp Utility.WebApp
Utility.WinProcess
Utility.Yesod Utility.Yesod
if (os(windows))
Other-Modules:
Utility.LockFile.Windows
Utility.LockPool.Windows
Utility.WinProcess
else
Other-Modules:
Utility.LockFile.Posix
Utility.LockPool.Posix