summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Ccache.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Propellor/Property/Ccache.hs')
-rw-r--r--src/Propellor/Property/Ccache.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/Propellor/Property/Ccache.hs b/src/Propellor/Property/Ccache.hs
index 1b0f8332..89fcd54c 100644
--- a/src/Propellor/Property/Ccache.hs
+++ b/src/Propellor/Property/Ccache.hs
@@ -55,17 +55,21 @@ ccacheSizeUnits sz = filter (/= ' ') (roughSize cfgfileunits True sz)
p n = 1024^n
-- | Set limits on a given ccache
-hasLimits :: FilePath -> Limit -> Property UnixLike
-path `hasLimits` limit = property' ("limits set on ccache " ++ path) $
- \w -> if null errors
- -- We invoke ccache itself to set the limits, so that it can handle
- -- replacing old limits in the config file, duplicates etc.
- then ensureProperty w $
- cmdPropertyEnv "ccache" params' [("CCACHE_DIR", path)]
- `changesFile` (path </> "ccache.conf")
- else sequence_ (errorMessage <$> errors)
- >> return FailedChange
+hasLimits :: FilePath -> Limit -> Property DebianLike
+path `hasLimits` limit = go `requires` installed
where
+ go :: Property DebianLike
+ go = property' ("limits set on ccache " ++ path) $
+ \w -> if null errors
+ -- We invoke ccache itself to set the limits, so that it can
+ -- handle replacing old limits in the config file, duplicates
+ -- etc.
+ then ensureProperty w $
+ cmdPropertyEnv "ccache" params' [("CCACHE_DIR", path)]
+ `changesFile` (path </> "ccache.conf")
+ else sequence_ (errorMessage <$> errors)
+ >> return FailedChange
+
params = limitToParams limit
(errors, params') = partitionEithers params