From 47fbeac70e53e97d0ea42fafad8078c0d9d4d9f7 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 22 May 2016 09:59:10 +0900 Subject: hasLimits requires installed --- src/Propellor/Property/Ccache.hs | 24 ++++++++++++++---------- 1 file 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 -- cgit v1.2.3