mirror of
https://github.com/Start9Labs/registry.git
synced 2026-03-26 02:11:53 +00:00
unzipped in wrong fn; cleanup
This commit is contained in:
@@ -597,13 +597,14 @@ upload (Upload name mpkg shouldIndex) = do
|
|||||||
-- stream zip file
|
-- stream zip file
|
||||||
-- stream zip into request body
|
-- stream zip into request body
|
||||||
-- store on server uncomressed?
|
-- store on server uncomressed?
|
||||||
|
-- nice to have: progress for hashing
|
||||||
eosUpload :: EosUpload -> IO ()
|
eosUpload :: EosUpload -> IO ()
|
||||||
eosUpload (EosUpload name img version) = do
|
eosUpload (EosUpload name img version) = do
|
||||||
PublishCfgRepo{..} <- findNameInCfg name
|
PublishCfgRepo{..} <- findNameInCfg name
|
||||||
noBody <-
|
noBody <-
|
||||||
parseRequest ("POST " <> show publishCfgRepoLocation <> "/admin/v0/eos-upload")
|
parseRequest ("POST " <> show publishCfgRepoLocation <> "/admin/v0/eos-upload")
|
||||||
<&> setRequestHeaders [("accept", "text/plain")]
|
<&> setRequestHeaders [("accept", "text/plain")]
|
||||||
<&> setRequestHeaders [("Content-Type", "application/octet-stream")]
|
-- <&> setRequestHeaders [("Content-Type", "application/octet-stream")]
|
||||||
<&> setRequestHeaders [("Content-Encoding", "gzip")]
|
<&> setRequestHeaders [("Content-Encoding", "gzip")]
|
||||||
<&> applyBasicAuth (B8.pack publishCfgRepoUser) (B8.pack publishCfgRepoPass)
|
<&> applyBasicAuth (B8.pack publishCfgRepoUser) (B8.pack publishCfgRepoPass)
|
||||||
hash <- hashFile @_ @SHA256 img
|
hash <- hashFile @_ @SHA256 img
|
||||||
@@ -623,7 +624,6 @@ eosUpload (EosUpload name img version) = do
|
|||||||
[("version", Just $ show version), ("hash", Just $ convertToBase Base16 hash)]
|
[("version", Just $ show version), ("hash", Just $ convertToBase Base16 hash)]
|
||||||
withBody
|
withBody
|
||||||
-- let withSource = setRequestBodySource (fromIntegral size) _ withQParams
|
-- let withSource = setRequestBodySource (fromIntegral size) _ withQParams
|
||||||
-- let req = setRequestBodyFile compressedFilePath withQParams
|
|
||||||
manager <- newTlsManager
|
manager <- newTlsManager
|
||||||
res <- runReaderT (httpLbs withQParams) manager
|
res <- runReaderT (httpLbs withQParams) manager
|
||||||
removeFile $ compressedFilePath
|
removeFile $ compressedFilePath
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ postPkgUploadR = do
|
|||||||
createDirectoryIfMissing True resourcesTemp
|
createDirectoryIfMissing True resourcesTemp
|
||||||
withTempDirectory resourcesTemp "newpkg" $ \dir -> do
|
withTempDirectory resourcesTemp "newpkg" $ \dir -> do
|
||||||
let path = dir </> "temp" <.> "s9pk"
|
let path = dir </> "temp" <.> "s9pk"
|
||||||
runConduit $ rawRequestBody .| ungzip .| sinkFile path
|
runConduit $ rawRequestBody .| sinkFile path
|
||||||
pool <- getsYesod appConnPool
|
pool <- getsYesod appConnPool
|
||||||
PkgRepo{..} <- ask
|
PkgRepo{..} <- ask
|
||||||
res <- retry $ extractPkg pool path
|
res <- retry $ extractPkg pool path
|
||||||
@@ -193,7 +193,7 @@ postEosUploadR = do
|
|||||||
createDirectoryIfMissing True resourcesTemp
|
createDirectoryIfMissing True resourcesTemp
|
||||||
withTempDirectory resourcesTemp "neweos" $ \dir -> do
|
withTempDirectory resourcesTemp "neweos" $ \dir -> do
|
||||||
let path = dir </> "eos" <.> "img"
|
let path = dir </> "eos" <.> "img"
|
||||||
runConduit $ rawRequestBody .| sinkFile path
|
runConduit $ rawRequestBody .| ungzip .| sinkFile path
|
||||||
void . runDB $ upsert (EosHash version hash) [EosHashHash =. hash]
|
void . runDB $ upsert (EosHash version hash) [EosHashHash =. hash]
|
||||||
let targetPath = root </> show version
|
let targetPath = root </> show version
|
||||||
removePathForcibly targetPath
|
removePathForcibly targetPath
|
||||||
|
|||||||
Reference in New Issue
Block a user