summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2018-04-22 12:15:35 -0400
committerJoey Hess2018-04-22 12:19:40 -0400
commitd8d2faece72eabd18c2ff303e5fb63c3a69961f6 (patch)
treee4fba26d18e3db8b52a94d80aff21413b642c67d
parent57ec3e2451ad7dfa70d4a1b522259e0036e3e6f2 (diff)
separate Hs-Source-Dirs for binaries
This is a trick I only just learned about, see https://stackoverflow.com/questions/6711151/how-to-avoid-recompiling-in-this-cabal-file#6711739 Significantly increased propellor build speed when your config.hs is in a fork of the propellor repository, by avoiding redundant builds of propellor library. Also avoids needing to list all the build deps 3 times. Also avoids cabal 2.x wanting every module to be listed 3 times. Note that the bulk of wrapper.hs had to move into the propellor library, since that code depended on stuff not exposed by the library. This commit was sponsored by Henrik Riomar on Patreon.
-rw-r--r--debian/changelog3
l---------executables/propellor-config.hs (renamed from src/propellor-config.hs)0
-rw-r--r--executables/wrapper.hs6
-rw-r--r--propellor.cabal53
-rw-r--r--src/Propellor/Wrapper.hs (renamed from src/wrapper.hs)9
5 files changed, 35 insertions, 36 deletions
diff --git a/debian/changelog b/debian/changelog
index 9af87222..e75d7f8f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ propellor (5.3.5) UNRELEASED; urgency=medium
* Apt.stdSourcesList now adds stable-updates suite
Thanks, Sean Whitton
+ * Significantly increased propellor build speed when your config.hs
+ is in a fork of the propellor repository, by avoiding redundant builds
+ of propellor library.
-- Joey Hess <id@joeyh.name> Wed, 18 Apr 2018 10:12:21 -0400
diff --git a/src/propellor-config.hs b/executables/propellor-config.hs
index e3af968e..e3af968e 120000
--- a/src/propellor-config.hs
+++ b/executables/propellor-config.hs
diff --git a/executables/wrapper.hs b/executables/wrapper.hs
new file mode 100644
index 00000000..3a6cee3a
--- /dev/null
+++ b/executables/wrapper.hs
@@ -0,0 +1,6 @@
+module Main where
+
+import Propellor.Wrapper
+
+main :: IO ()
+main = runWrapper
diff --git a/propellor.cabal b/propellor.cabal
index 18d28db3..4e4102d0 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -35,38 +35,6 @@ Description:
.
It is configured using haskell.
-Executable propellor
- Default-Language: Haskell98
- Main-Is: wrapper.hs
- GHC-Options: -threaded -Wall -fno-warn-tabs -O0
- if impl(ghc >= 8.0)
- GHC-Options: -fno-warn-redundant-constraints
- Default-Extensions: TypeOperators
- Hs-Source-Dirs: src
- Build-Depends:
- -- propellor needs to support the ghc shipped in Debian stable,
- -- and also only depends on packages in Debian stable.
- base >= 4.5, base < 5,
- directory, filepath, IfElse, process, bytestring, hslogger, split,
- unix, unix-compat, ansi-terminal, containers (>= 0.5), network, async,
- time, mtl, transformers, exceptions (>= 0.6), stm, text, hashable
- Other-Modules:
- Propellor.DotDir
-
-Executable propellor-config
- Default-Language: Haskell98
- Main-Is: propellor-config.hs
- GHC-Options: -threaded -Wall -fno-warn-tabs -O0
- if impl(ghc >= 8.0)
- GHC-Options: -fno-warn-redundant-constraints
- Default-Extensions: TypeOperators
- Hs-Source-Dirs: src
- Build-Depends:
- base >= 4.5, base < 5,
- directory, filepath, IfElse, process, bytestring, hslogger, split,
- unix, unix-compat, ansi-terminal, containers (>= 0.5), network, async,
- time, mtl, transformers, exceptions (>= 0.6), stm, text, hashable
-
Library
Default-Language: Haskell98
GHC-Options: -Wall -fno-warn-tabs -O0
@@ -75,6 +43,8 @@ Library
Default-Extensions: TypeOperators
Hs-Source-Dirs: src
Build-Depends:
+ -- propellor needs to support the ghc shipped in Debian stable,
+ -- and also only depends on packages in Debian stable.
base >= 4.5, base < 5,
directory, filepath, IfElse, process, bytestring, hslogger, split,
unix, unix-compat, ansi-terminal, containers (>= 0.5), network, async,
@@ -83,6 +53,7 @@ Library
Exposed-Modules:
Propellor
Propellor.Base
+ Propellor.DotDir
Propellor.Location
Propellor.Property
Propellor.Property.Aiccu
@@ -211,6 +182,7 @@ Library
Propellor.Types.ResultCheck
Propellor.Types.Singletons
Propellor.Types.ZFS
+ Propellor.Wrapper
Other-Modules:
Propellor.Bootstrap
Propellor.Git
@@ -254,6 +226,23 @@ Library
System.Console.Concurrent
System.Console.Concurrent.Internal
System.Process.Concurrent
+ Paths_propellor
+
+Executable propellor-config
+ Default-Language: Haskell98
+ Hs-Source-Dirs: executables
+ Main-Is: propellor-config.hs
+ GHC-Options: -threaded -Wall -fno-warn-tabs -O0
+ if impl(ghc >= 8.0)
+ GHC-Options: -fno-warn-redundant-constraints
+ Default-Extensions: TypeOperators
+ Build-Depends: propellor, base
+
+Executable propellor
+ Default-Language: Haskell98
+ Hs-Source-Dirs: executables
+ Main-Is: wrapper.hs
+ Build-Depends: propellor, base
source-repository head
type: git
diff --git a/src/wrapper.hs b/src/Propellor/Wrapper.hs
index 20b4d8c6..f399b2cf 100644
--- a/src/wrapper.hs
+++ b/src/Propellor/Wrapper.hs
@@ -1,4 +1,5 @@
--- | Wrapper program for propellor distribution.
+-- | This module is used to implement a wrapper program for propellor
+-- distribution.
--
-- Distributions should install this program into PATH.
-- (Cabal builds it as dist/build/propellor/propellor).
@@ -10,7 +11,7 @@
-- If ./config.hs exists and looks like a propellor config file,
-- it instead builds and runs in the current working directory.
-module Main where
+module Propellor.Wrapper (runWrapper) where
import Propellor.DotDir
import Propellor.Message
@@ -30,8 +31,8 @@ import Control.Monad.IfElse
import Control.Applicative
import Prelude
-main :: IO ()
-main = withConcurrentOutput $ do
+runWrapper :: IO ()
+runWrapper = withConcurrentOutput $ do
useFileSystemEncoding
go =<< getArgs
where