From 5856c13d338ada5354721b4141e788b7961ffacf Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 19 May 2016 15:05:10 +0900 Subject: Sbuild.ccachePrepared --- src/Propellor/Property/Sbuild.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 until #802850 and -- cgit v1.2.3