on master help sign in
Fix some directories to be more logical
c6f62c5Michael Snoyman
Stackage2/CompleteBuild.hs+6−3
@@ -32,6 +32,7 @@ data Settings = Settings
32 { plan :: BuildPlan
32 { plan :: BuildPlan
33 , planFile :: FilePath
33 , planFile :: FilePath
34 , buildDir :: FilePath
34 , buildDir :: FilePath
35+ , logDir :: FilePath
35 , title :: Text -> Text -- ^ GHC version -> title
36 , title :: Text -> Text -- ^ GHC version -> title
36 , slug :: Text
37 , slug :: Text
37 , setArgs :: Text -> UploadBundle -> UploadBundle
38 , setArgs :: Text -> UploadBundle -> UploadBundle
@@ -45,7 +46,8 @@ getSettings Nightly = do
45 plan' <- defaultBuildConstraints >>= newBuildPlan
46 plan' <- defaultBuildConstraints >>= newBuildPlan
46 return Settings
47 return Settings
47 { planFile = fpFromText ("nightly-" ++ day) <.> "yaml"
48 { planFile = fpFromText ("nightly-" ++ day) <.> "yaml"
49+ , buildDir = fpFromText $ "builds/stackage-nightly-" ++ day
48− , buildDir = fpFromText $ "/tmp/stackage-nightly-" ++ day
50+ , logDir = fpFromText $ "logs/stackage-nightly-" ++ day
49 , title = \ghcVer -> concat
51 , title = \ghcVer -> concat
50 [ "Stackage Nightly "
52 [ "Stackage Nightly "
51 , day
53 , day
@@ -82,7 +84,8 @@ getSettings (LTS bumpType) = do
82
84
83 return Settings
85 return Settings
84 { planFile = newfile
86 { planFile = newfile
87+ , buildDir = fpFromText $ "builds/stackage-lts-" ++ tshow new
85− , buildDir = fpFromText $ "/tmp/stackage-lts-" ++ tshow new
88+ , logDir = fpFromText $ "logs/stackage-lts-" ++ tshow new
86 , title = \ghcVer -> concat
89 , title = \ghcVer -> concat
87 [ "LTS Haskell "
90 [ "LTS Haskell "
88 , tshow new
91 , tshow new
@@ -142,7 +145,7 @@ completeBuild buildType = withManager defaultManagerSettings $ \man -> do
142 let pb = PerformBuild
145 let pb = PerformBuild
143 { pbPlan = plan
146 { pbPlan = plan
144 , pbInstallDest = buildDir
147 , pbInstallDest = buildDir
145− , pbLogDir = buildDir </> "logs"
148+ , pbLogDir = logDir
146 , pbLog = hPut stdout
149 , pbLog = hPut stdout
147 , pbJobs = 8
150 , pbJobs = 8
148 }
151 }
Stackage2/PerformBuild.hs+11−2
@@ -21,7 +21,7 @@ import Control.Concurrent.STM.TSem
21import Data.NonNull (fromNullable)
21import Data.NonNull (fromNullable)
22import Control.Concurrent.Async (async)
22import Control.Concurrent.Async (async)
23import System.IO.Temp (withSystemTempDirectory)
23import System.IO.Temp (withSystemTempDirectory)
24−import Filesystem (createTree, removeTree, isDirectory, rename, canonicalizePath)
24+import Filesystem (createTree, removeTree, isDirectory, rename, canonicalizePath, getWorkingDirectory)
25import System.IO (withBinaryFile, IOMode (WriteMode))
25import System.IO (withBinaryFile, IOMode (WriteMode))
26import Filesystem.Path (parent)
26import Filesystem.Path (parent)
27import qualified Filesystem.Path as F
27import qualified Filesystem.Path as F
@@ -113,10 +113,19 @@ pbDataDir pb = pbInstallDest pb </> "share"
113pbDocDir pb = pbInstallDest pb </> "doc"
113pbDocDir pb = pbInstallDest pb </> "doc"
114
114
115performBuild :: PerformBuild -> IO [Text]
115performBuild :: PerformBuild -> IO [Text]
116+performBuild pb = do
117+ cwd <- getWorkingDirectory
118+ performBuild' pb
119+ { pbInstallDest = cwd </> pbInstallDest pb
120+ , pbLogDir = cwd </> pbLogDir pb
121+ }
122+
123+performBuild' :: PerformBuild -> IO [Text]
116−performBuild pb@PerformBuild {..} = withBuildDir $ \builddir -> do
124+performBuild' pb@PerformBuild {..} = withBuildDir $ \builddir -> do
117 let removeTree' fp = whenM (isDirectory fp) (removeTree fp)
125 let removeTree' fp = whenM (isDirectory fp) (removeTree fp)
118 mapM_ removeTree' [pbInstallDest, pbLogDir]
126 mapM_ removeTree' [pbInstallDest, pbLogDir]
119
127
128+ createTree $ parent $ pbDatabase pb
120 withCheckedProcess (proc "ghc-pkg" ["init", fpToString (pbDatabase pb)])
129 withCheckedProcess (proc "ghc-pkg" ["init", fpToString (pbDatabase pb)])
121 $ \ClosedStream Inherited Inherited -> return ()
130 $ \ClosedStream Inherited Inherited -> return ()
122 pbLog $ encodeUtf8 "Copying built-in Haddocks\n"
131 pbLog $ encodeUtf8 "Copying built-in Haddocks\n"