summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Sbuild.hs
diff options
context:
space:
mode:
authorSean Whitton2016-05-19 15:05:10 +0900
committerSean Whitton2016-05-19 15:05:10 +0900
commit5856c13d338ada5354721b4141e788b7961ffacf (patch)
tree4463f947128ecab7a7b3fcb28915e1b47c16baae /src/Propellor/Property/Sbuild.hs
parent530d9f1b2bb1d740a4ca7404f0e885c64626a0e0 (diff)
Sbuild.ccachePrepared
Diffstat (limited to 'src/Propellor/Property/Sbuild.hs')
-rw-r--r--src/Propellor/Property/Sbuild.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Propellor/Property/Sbuild.hs b/src/Propellor/Property/Sbuild.hs
index 41f26f27..1d009f41 100644
--- a/src/Propellor/Property/Sbuild.hs
+++ b/src/Propellor/Property/Sbuild.hs
@@ -57,6 +57,7 @@ module Propellor.Property.Sbuild (
import Propellor.Base
import Debootstrap (extractSuite)
import qualified Propellor.Property.Apt as Apt
+import qualified Propellor.Property.Ccache as Ccache
import qualified Propellor.Property.File as File
import qualified Propellor.Property.Firewall as Firewall
@@ -85,6 +86,7 @@ built :: SbuildSchroot -> Apt.Url -> Property DebianLike
built s@(SbuildSchroot suite arch) mirror = check (not <$> doesDirectoryExist (schrootRoot s)) $
property ("built schroot for " ++ show s) go
`requires` keypairGenerated
+ `requires` ccachePrepared
`requires` installed
where
go :: Property DebianLike
@@ -182,6 +184,22 @@ keypairGenerated = check (not <$> doesFileExist secKeyFile) $ go
`assume` MadeChange
secKeyFile = "/var/lib/sbuild/apt-keys/sbuild-key.sec"
+ccachePrepared :: Property DebianLike
+ccachePrepared = propertyList "sbuild group ccache configured" $ props
+ & (Group "sbuild") `Ccache.hasGroupCache` "2G"
+ & "/etc/schroot/sbuild/fstab" `File.containsLine`
+ "/var/cache/ccache-sbuild /var/cache/ccache-sbuild rw,bind 0 0"
+ & "/var/cache/ccache-sbuild/sbuild-setup" `File.hasContent`
+ [ "#!/bin/sh"
+ , "export CCACHE_DIR=/var/cache/ccache-sbuild"
+ , "export CCACHE_UMASK=002"
+ , "export CCACHE_COMPRESS=1"
+ , "unset CCACHE_HARDLINK"
+ , "export PATH=\"/usr/lib/ccache:$PATH\""
+ , ""
+ , "exec \"$@\""
+ ]
+
-- | Block network access during builds
--
-- This is a hack from <https://wiki.debian.org/sbuild> until #802850 and