From 90933360de7d2a241d401ee5b8d57adf0639632f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 18 Jun 2014 16:11:20 -0400 Subject: [PATCH] couple bug fixes in build-version code --- Build/DistributionUpdate.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Build/DistributionUpdate.hs b/Build/DistributionUpdate.hs index 0c95297e55..c0de4cd587 100644 --- a/Build/DistributionUpdate.hs +++ b/Build/DistributionUpdate.hs @@ -21,6 +21,7 @@ import Git.Command import Data.Default import Data.Time.Clock +import Data.Char -- git-annex distribution signing key (for Joey Hess) signingKey :: String @@ -59,10 +60,10 @@ main = do getbuild :: FilePath -> (URLString, FilePath) -> IO (Maybe (FilePath, Version)) getbuild repodir (url, f) = do bv1 <- getbv - createDirectoryIfMissing True repodir let dest = repodir f let tmp = dest ++ ".tmp" nukeFile tmp + createDirectoryIfMissing True (parentDir dest) let oops s = do nukeFile tmp putStrLn $ "*** " ++ s @@ -86,7 +87,8 @@ getbuild repodir (url, f) = do getbv = do bv <- catchDefaultIO "" $ readProcess "curl" [takeDirectory url ++ "build-version"] - return $ if null bv then Nothing else Just bv + return $ if null bv || any (not . versionchar) bv then Nothing else Just bv + versionchar c = isAlphaNum c || c == '.' || c == '-' makeinfos :: [(FilePath, Version)] -> Annex () makeinfos updated = do