aboutsummaryrefslogtreecommitdiff
path: root/Build/DistributionUpdate.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-13 12:43:22 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-13 12:43:22 -0400
commitffadb7e29e2874d9c5367bf4bb99e67684424fe5 (patch)
treeffba08486a9465409cbd0ec1500bd60b7ff788c7 /Build/DistributionUpdate.hs
parentb13463cd9979dc5ee1313248f61d69409acaaef8 (diff)
fix DistributionUpdate incompatability
Since DistributionUpdate builds an Annex object, the new relative paths code caused it to make a git object with paths like ../lib/downloads. However, it actually runs the system's installed git-annex, and that old version did not like being run in this situation. Probably it was buggy. Fixed by chdir to the downloads repo before doing anything else.
Diffstat (limited to 'Build/DistributionUpdate.hs')
-rw-r--r--Build/DistributionUpdate.hs27
1 files changed, 14 insertions, 13 deletions
diff --git a/Build/DistributionUpdate.hs b/Build/DistributionUpdate.hs
index 6ebe08fb0..8c5cec128 100644
--- a/Build/DistributionUpdate.hs
+++ b/Build/DistributionUpdate.hs
@@ -22,6 +22,7 @@ import Git.Command
import Data.Default
import Data.Time.Clock
import Data.Char
+import System.Posix.Directory
-- git-annex distribution signing key (for Joey Hess)
signingKey :: String
@@ -49,10 +50,12 @@ autobuilds =
main :: IO ()
main = do
+ version <- liftIO getChangelogVersion
repodir <- getRepoDir
+ changeWorkingDirectory repodir
updated <- catMaybes <$> mapM (getbuild repodir) autobuilds
- state <- Annex.new =<< Git.Construct.fromPath repodir
- Annex.eval state (makeinfos updated)
+ state <- Annex.new =<< Git.Construct.fromPath "."
+ Annex.eval state (makeinfos updated version)
-- Download a build from the autobuilder, and return its version.
-- It's very important that the version matches the build, otherwise
@@ -91,26 +94,24 @@ getbuild repodir (url, f) = do
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
+makeinfos :: [(FilePath, Version)] -> Version -> Annex ()
+makeinfos updated version = do
mapM_ (\f -> inRepo $ runBool [Param "annex", Param "add", File f]) (map fst updated)
- version <- liftIO getChangelogVersion
void $ inRepo $ runBool
[ Param "commit"
, Param "-a"
, Param "-m"
, Param $ "publishing git-annex " ++ version
]
- basedir <- liftIO getRepoDir
now <- liftIO getCurrentTime
- liftIO $ putStrLn $ "building info files in " ++ basedir
+ liftIO $ putStrLn $ "building info files"
forM_ updated $ \(f, bv) -> do
- v <- lookupFile (basedir </> f)
+ v <- lookupFile f
case v of
Nothing -> noop
Just k -> whenM (inAnnex k) $ do
liftIO $ putStrLn f
- let infofile = basedir </> f ++ ".info"
+ let infofile = f ++ ".info"
liftIO $ writeFile infofile $ show $ GitAnnexDistribution
{ distributionUrl = mkUrl f
, distributionKey = k
@@ -120,7 +121,7 @@ makeinfos updated = do
}
void $ inRepo $ runBool [Param "add", File infofile]
signFile infofile
- signFile (basedir </> f)
+ signFile f
void $ inRepo $ runBool
[ Param "commit"
, Param "-m"
@@ -137,14 +138,14 @@ makeinfos updated = do
-- Check for out of date info files.
infos <- liftIO $ filter (".info" `isSuffixOf`)
- <$> dirContentsRecursive (basedir </> "git-annex")
+ <$> dirContentsRecursive "git-annex"
ds <- liftIO $ forM infos (readish <$$> readFile)
let dis = zip infos ds
- let ood = filter (outofdate version) dis
+ let ood = filter outofdate dis
unless (null ood) $
error $ "Some info files are out of date: " ++ show (map fst ood)
where
- outofdate version (_, md) = case md of
+ outofdate (_, md) = case md of
Nothing -> True
Just d -> distributionVersion d /= version