mirror of
https://github.com/aelve/guide.git
synced 2024-11-29 14:35:35 +03:00
Added allupdate command, that updates stackage and hackage alltogether
This commit is contained in:
parent
39f60ec4c3
commit
ee373b4b87
@ -15,10 +15,9 @@ cabal-version: >=1.10
|
|||||||
|
|
||||||
library
|
library
|
||||||
hs-source-dirs: src
|
hs-source-dirs: src
|
||||||
other-modules: Common, FileUtils, HttpDownload, HackageUpdate, REPL
|
other-modules: Common, FileUtils, HttpDownload, HackageUpdate, REPL, StackageUpdate
|
||||||
, HackageCommands, StackageUpdate, StackageCommands, StackageArchive
|
|
||||||
|
|
||||||
exposed-modules: IndexProject, HackageArchive
|
exposed-modules: IndexProject, HackageArchive, StackageArchive, HackageCommands, StackageCommands, AllCommands
|
||||||
build-depends: base >= 4.7 && < 5
|
build-depends: base >= 4.7 && < 5
|
||||||
, directory
|
, directory
|
||||||
, containers
|
, containers
|
||||||
|
42
REPL/src/AllCommands.hs
Normal file
42
REPL/src/AllCommands.hs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
module AllCommands(totalUpdate) where
|
||||||
|
|
||||||
|
import Common
|
||||||
|
import qualified HackageCommands as HC
|
||||||
|
import qualified StackageCommands as SC
|
||||||
|
import qualified HackageArchive as HA
|
||||||
|
|
||||||
|
totalUpdate :: UpdateInfo -> IO()
|
||||||
|
totalUpdate ui = do
|
||||||
|
putStrLn "Total update of a system!"
|
||||||
|
|
||||||
|
putStrLn "Stackage update..."
|
||||||
|
SC.updatePersistentMapFromLTS sud ltsFileDir ltsURL snapshotsURL
|
||||||
|
|
||||||
|
putStrLn "Hackage update..."
|
||||||
|
HC.updateTotalArchive updateCommand unzipCommand persistCommand
|
||||||
|
|
||||||
|
where
|
||||||
|
sud = (getLTSPersistDir.sui) ui
|
||||||
|
ltsFileDir = getLTSFilesDir (sui ui)
|
||||||
|
ltsURL = suiLTSURL (sui ui)
|
||||||
|
snapshotsURL = (getSnapshotURL.sui) ui
|
||||||
|
|
||||||
|
arch = (getArchive.iuh) ui
|
||||||
|
archURL = (iuhArchiveURL.iuh) ui
|
||||||
|
snapURL = (iuhSnapshotURL.iuh) ui
|
||||||
|
trFile = (getTar.iuh) ui
|
||||||
|
ud = (getArchivePersistDir.iuh) ui
|
||||||
|
|
||||||
|
updateCommand = HC.updateArchive snapURL archURL arch
|
||||||
|
unzipCommand = HC.unzipArchive arch trFile
|
||||||
|
persistCommand = HC.updatePersistentFromTar ud trFile
|
||||||
|
{-
|
||||||
|
queryCombinedData :: UpdateInfo -> PackageName -> IO()
|
||||||
|
queryCombinedData ui package = do
|
||||||
|
value <- HA.queryPersistentMap hUpdateDir package
|
||||||
|
return ()
|
||||||
|
where
|
||||||
|
sUpdateDir = (getLTSPersistDir.sui) ui
|
||||||
|
hUpdateDir = (getArchivePersistDir.iuh) ui
|
||||||
|
|
||||||
|
-}
|
@ -148,3 +148,4 @@ showPersistentTarCompare updateDir tarFile = do
|
|||||||
newTar <- loadTar tarFile
|
newTar <- loadTar tarFile
|
||||||
let newMap = buildHackageMap newTar (buildPreHackageMap newTar)
|
let newMap = buildHackageMap newTar (buildPreHackageMap newTar)
|
||||||
printPersistentDiffMap updateDir newMap
|
printPersistentDiffMap updateDir newMap
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import Network.HTTP.Client(HttpException)
|
|||||||
import Common
|
import Common
|
||||||
import qualified HackageCommands as HC
|
import qualified HackageCommands as HC
|
||||||
import qualified StackageCommands as SC
|
import qualified StackageCommands as SC
|
||||||
|
import qualified AllCommands as AC
|
||||||
|
|
||||||
processREPLCycle :: UpdateInfo -> IO ()
|
processREPLCycle :: UpdateInfo -> IO ()
|
||||||
processREPLCycle ui = forever $ do
|
processREPLCycle ui = forever $ do
|
||||||
@ -34,6 +35,8 @@ buildCommand :: UpdateInfo -> (String -> IO())
|
|||||||
buildCommand ui = processCommand
|
buildCommand ui = processCommand
|
||||||
where
|
where
|
||||||
processCommand command
|
processCommand command
|
||||||
|
-- updates all
|
||||||
|
| chk "allupdate" = AC.totalUpdate ui
|
||||||
-- checks the current hackage gzip archive and understands what to download
|
-- checks the current hackage gzip archive and understands what to download
|
||||||
| chk "check" = HC.showUpdateData arch snapURL
|
| chk "check" = HC.showUpdateData arch snapURL
|
||||||
-- updates the gzip archive file, unpacks it to tar and loads in the permanent storage
|
-- updates the gzip archive file, unpacks it to tar and loads in the permanent storage
|
||||||
@ -119,6 +122,7 @@ buildCommand ui = processCommand
|
|||||||
updateCommand = HC.updateArchive snapURL archURL arch
|
updateCommand = HC.updateArchive snapURL archURL arch
|
||||||
unzipCommand = HC.unzipArchive arch trFile
|
unzipCommand = HC.unzipArchive arch trFile
|
||||||
persistCommand = HC.updatePersistentFromTar ud trFile
|
persistCommand = HC.updatePersistentFromTar ud trFile
|
||||||
|
|
||||||
ltsFileDir = getLTSFilesDir (sui ui)
|
ltsFileDir = getLTSFilesDir (sui ui)
|
||||||
ltsURL = suiLTSURL (sui ui)
|
ltsURL = suiLTSURL (sui ui)
|
||||||
sud = (getLTSPersistDir.sui) ui
|
sud = (getLTSPersistDir.sui) ui
|
||||||
|
Loading…
Reference in New Issue
Block a user