|author||Joey Hess||2017-05-15 20:09:31 -0400|
|committer||Joey Hess||2017-05-15 20:09:31 -0400|
Removed dependency on MissingH, instead depends on split and hashable.
MissingH is a heavy dependency, which pulls in parsec and a bunch of stuff. So eliminating it makes propellor easier to install and less likely to fail to build. changesFileContent now uses hashable's hash. This may not be stable across upgrades, I'm not sure -- but it's surely ok here, as the hash is not stored. socketFile also uses hash. I *think* this is ok, even if it's not stable. If it's not stable, an upgrade might make propellor hash a hostname to a different number, but with 9 digets of number in use, the chances of a collision are small. In any case, I've opned a bug report asking for the stability to be documented, and I think it's intended to be stable, only the documentation is bad. NB: I have not checked that the arch linux and freebsd packages for the new deps, that Propellor.Bootstrap lists, are the right names or even exist. Since propellor depends on hashable, it could be changed to use unordered-containers, rather than containers, which would be faster and perhaps less deps too. This commit was sponsored by Alexander Thompson on Patreon.
Diffstat (limited to 'src/Propellor/Property.hs')
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Propellor/Property.hs b/src/Propellor/Property.hs
index 94c82c9f..8b2a4e3d 100644
@@ -50,8 +50,8 @@ import Data.Monoid
import "mtl" Control.Monad.RWS.Strict
-import qualified Data.Hash.MD5 as MD5
@@ -64,8 +64,8 @@ import Propellor.Info
-- | Makes a perhaps non-idempotent Property be idempotent by using a flag
-- file to indicate whether it has run before.
@@ -228,12 +228,12 @@ changesFile p f = checkResult getstat comparestat p
-- Changes to mtime etc that do not change file content are treated as
changesFileContent :: Checkable p i => p i -> FilePath -> Property i
-changesFileContent p f = checkResult getmd5 comparemd5 p
+changesFileContent p f = checkResult gethash comparehash p
- getmd5 = catchMaybeIO $ MD5.md5 . MD5.Str <$> readFileStrict f
- comparemd5 oldmd5 = do
- newmd5 <- getmd5
- return $ if oldmd5 == newmd5 then NoChange else MadeChange
+ gethash = catchMaybeIO $ hash <$> readFileStrict f
+ comparehash oldhash = do
+ newhash <- gethash
+ return $ if oldhash == newhash then NoChange else MadeChange
-- | Determines if the first file is newer than the second file.