couple bug fixes in build-version code
This commit is contained in:
parent
0994f4a814
commit
90933360de
1 changed files with 4 additions and 2 deletions
|
@ -21,6 +21,7 @@ import Git.Command
|
||||||
|
|
||||||
import Data.Default
|
import Data.Default
|
||||||
import Data.Time.Clock
|
import Data.Time.Clock
|
||||||
|
import Data.Char
|
||||||
|
|
||||||
-- git-annex distribution signing key (for Joey Hess)
|
-- git-annex distribution signing key (for Joey Hess)
|
||||||
signingKey :: String
|
signingKey :: String
|
||||||
|
@ -59,10 +60,10 @@ main = do
|
||||||
getbuild :: FilePath -> (URLString, FilePath) -> IO (Maybe (FilePath, Version))
|
getbuild :: FilePath -> (URLString, FilePath) -> IO (Maybe (FilePath, Version))
|
||||||
getbuild repodir (url, f) = do
|
getbuild repodir (url, f) = do
|
||||||
bv1 <- getbv
|
bv1 <- getbv
|
||||||
createDirectoryIfMissing True repodir
|
|
||||||
let dest = repodir </> f
|
let dest = repodir </> f
|
||||||
let tmp = dest ++ ".tmp"
|
let tmp = dest ++ ".tmp"
|
||||||
nukeFile tmp
|
nukeFile tmp
|
||||||
|
createDirectoryIfMissing True (parentDir dest)
|
||||||
let oops s = do
|
let oops s = do
|
||||||
nukeFile tmp
|
nukeFile tmp
|
||||||
putStrLn $ "*** " ++ s
|
putStrLn $ "*** " ++ s
|
||||||
|
@ -86,7 +87,8 @@ getbuild repodir (url, f) = do
|
||||||
getbv = do
|
getbv = do
|
||||||
bv <- catchDefaultIO "" $
|
bv <- catchDefaultIO "" $
|
||||||
readProcess "curl" [takeDirectory url ++ "build-version"]
|
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 :: [(FilePath, Version)] -> Annex ()
|
||||||
makeinfos updated = do
|
makeinfos updated = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue