Skip to content

Commit

Permalink
Add more logging statements when importing packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri committed Nov 1, 2024
1 parent c8dea1f commit f416c01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/Flora/Import/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,11 @@ persistHashes tarballHashIORef (packageName, namespace, version, target) = do
mRelease <- Query.getReleaseByVersion package.packageId version
case mRelease of
Nothing -> do
Log.logInfo_ "Release does not exist, putting the hash in an ioref"
Log.logAttention_ "Release does not exist, putting the hash in an ioref"
persisHashInMemory tarballHashIORef (namespace, packageName) target.hashes.sha256
Just release -> Update.setArchiveChecksum release.releaseId target.hashes.sha256
Nothing -> do
Log.logInfo_ "Package does not exist, putting the hash in an ioref"
Log.logAttention_ "Package does not exist, putting the hash in an ioref"
persisHashInMemory tarballHashIORef (namespace, packageName) target.hashes.sha256

persisHashInMemory
Expand Down
9 changes: 8 additions & 1 deletion src/core/Flora/Import/Package/Bulk.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import System.Directory
import System.Directory qualified as System
import System.FilePath
import UnliftIO.Exception (finally)
import Data.Aeson

import Data.IORef (IORef)
import Data.IORef qualified as IORef
Expand Down Expand Up @@ -84,6 +85,10 @@ importFromIndex
importFromIndex user (repositoryName, repositoryURL) index = do
entries <- Tar.read . GZip.decompress <$> liftIO (BL.readFile index)
let Right repositoryPackages = buildPackageListFromArchive entries
Log.logInfo "packages" $
object [ "repository" .= repositoryName
, "packages" .= repositoryPackages
]
mPackageIndex <- Query.getPackageIndexByName repositoryName
time <- case mPackageIndex of
Nothing -> pure $ posixSecondsToUTCTime 0
Expand Down Expand Up @@ -171,7 +176,9 @@ importFromStream user (repositoryName, _repositoryURL, repositoryPackages) strea
-> Eff es ()
processFile tarballHashIORef importSubject =
case importSubject of
(CabalFile path, timestamp, content) ->
(CabalFile path, timestamp, content) -> do
Log.logInfo "importing-package" $
object [ "file_path" .= path]
loadContent path content
>>= ( extractPackageDataFromCabal tarballHashIORef user (repositoryName, repositoryPackages) timestamp
>=> \importedPackage -> persistImportOutput importedPackage
Expand Down

0 comments on commit f416c01

Please sign in to comment.