better warnings

This commit is contained in:
Joey Hess 2014-06-18 15:44:16 -04:00
parent a8daa18759
commit 45f06f61ba

View file

@ -63,11 +63,15 @@ getbuild repodir (url, f) = do
let dest = repodir </> f let dest = repodir </> f
let tmp = dest ++ ".tmp" let tmp = dest ++ ".tmp"
nukeFile tmp nukeFile tmp
let oops s = do
nukeFile tmp
putStrLn $ "*** " ++ s
return Nothing
ifM (download url tmp def) ifM (download url tmp def)
( do ( do
bv2 <- getbv bv2 <- getbv
case bv2 of case bv2 of
Nothing -> return Nothing Nothing -> oops $ "no build-version file for " ++ url
(Just v) (Just v)
| bv2 == bv1 -> do | bv2 == bv1 -> do
nukeFile dest nukeFile dest
@ -75,10 +79,8 @@ getbuild repodir (url, f) = do
-- remove git rev part of version -- remove git rev part of version
let v' = takeWhile (/= '-') v let v' = takeWhile (/= '-') v
return $ Just (f, v') return $ Just (f, v')
| otherwise -> do | otherwise -> oops $ "build version changed while downloading " ++ url ++ " " ++ show (bv1, bv2)
nukeFile tmp , oops $ "failed to download " ++ url
error $ "build version changed while downloading " ++ url ++ " " ++ show (bv1, bv2)
, return Nothing
) )
where where
getbv = do getbv = do