diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-25 00:05:12 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-25 00:05:17 -0400 |
commit | be3ba969eca03384fcf93b1da59b186c4932dcd6 (patch) | |
tree | 5e7ef24b1b3e5f1f22b6be24de096ddcae01b951 /Build/TestConfig.hs | |
parent | 53a057a1cb6661b62cd992efe0ad885bcac84cba (diff) |
configure: Check that checksum programs produce correct checksums. + bitter rant
So, it might be called sha1sum, or on some other OS, it might be called
sha1. It might be hidden away off of PATH on that OS. That's just expected
insanity; UNIX has been this way since 1980's. And these days, nobody even
gives the flying flip about standards that we briefly did in the 90's
after the first round of unix wars.
But it's the 2010's now, and we've certainly learned something.
So, let's make it so sometimes sha1 is a crazy program that wants to run as
root so it can lock memory while prompting for a passphrase, and outputting
binary garbage. Yes, that'd be wise. Let's package that in major Linux
distros, too, so users can stumble over it.
Diffstat (limited to 'Build/TestConfig.hs')
-rw-r--r-- | Build/TestConfig.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Build/TestConfig.hs b/Build/TestConfig.hs index 0cc2019cf..eb920c13f 100644 --- a/Build/TestConfig.hs +++ b/Build/TestConfig.hs @@ -75,7 +75,7 @@ testCmd k cmdline = do {- Ensures that one of a set of commands is available by running each in - turn. The Config is set to the first one found. -} -selectCmd :: ConfigKey -> [String] -> String -> Test +selectCmd :: ConfigKey -> [(String, String)] -> Test selectCmd k = searchCmd (return . Config k . StringConfig) (\cmds -> do @@ -83,17 +83,17 @@ selectCmd k = searchCmd error $ "* need one of these commands, but none are available: " ++ show cmds ) -maybeSelectCmd :: ConfigKey -> [String] -> String -> Test +maybeSelectCmd :: ConfigKey -> [(String, String)] -> Test maybeSelectCmd k = searchCmd (return . Config k . MaybeStringConfig . Just) (\_ -> return $ Config k $ MaybeStringConfig Nothing) -searchCmd :: (String -> Test) -> ([String] -> Test) -> [String] -> String -> Test -searchCmd success failure cmds param = search cmds +searchCmd :: (String -> Test) -> ([String] -> Test) -> [(String, String)] -> Test +searchCmd success failure cmdsparams = search cmdsparams where - search [] = failure cmds - search (c:cs) = do - ret <- system $ quiet c ++ " " ++ param + search [] = failure $ fst $ unzip cmdsparams + search ((c, params):cs) = do + ret <- system $ quiet $ c ++ " " ++ params if ret == ExitSuccess then success c else search cs |