packages feed

tmp-postgres 1.19.0.0 → 1.19.0.1

raw patch · 4 files changed

+24/−18 lines, 4 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ Changelog for tmp-postgres +1.19.0.1+  #146 Better version hashing for making cache directories+  Documentation fixes+ 1.19.0.0   #154 Change 'createDefaultCacheConfig` to `defaultCacheConfig` 
src/Database/Postgres/Temp/Internal.hs view
@@ -450,11 +450,11 @@   -- 'Temporary'. @\/tmp@ is a good default.   , cacheDirectoryType      :: DirectoryType   -- ^ Used to specify is a 'Permanent' or 'Temporary' directory should be-  --   used. 'createDefaultCacheConfig' uses 'Permanent' @~\/.tmp-postgres@+  --   used. 'defaultCacheConfig' uses 'Permanent' @~\/.tmp-postgres@   --   by default.   , cacheUseCopyOnWrite     :: Bool   -- ^ Some operatoring system versions support flags for @cp@ that allow-  --   \"copy on write\" which is about 2x faster. 'createDefaultCacheConfig'+  --   \"copy on write\" which is about 2x faster. 'defaultCacheConfig'   --   attempts to determine if the @cp@ on the path supports copy on write   --   and sets this to 'True' if it does.   }
src/Database/Postgres/Temp/Internal/Config.hs view
@@ -608,18 +608,20 @@     , copyDirectoryCommandCow = useCopyOnWrite     } -getInitDbVersion :: IO String-getInitDbVersion = readProcessWithExitCode "initdb" ["--version"] "" >>= \case+getInitDbVersion :: String+getInitDbVersion = unsafePerformIO $ readProcessWithExitCode "initdb" ["--version"] "" >>= \case   (ExitSuccess, outputString, _) -> do     let       theLastPart = last $ words outputString       versionPart = takeWhile (\x -> isDigit x || x == '.' || x == '-') theLastPart-    pure $ if last versionPart == '.'-             then init versionPart-             else versionPart+      humanReadable = if last versionPart == '.'+        then init versionPart+        else versionPart+    pure $ humanReadable <> take 8 (makeArgumentHash outputString)    (startErrorExitCode, startErrorStdOut, startErrorStdErr) ->     throwIO InitDbFailed {..}+{-# NOINLINE getInitDbVersion #-}  makeCommandLine :: String -> CompleteProcessConfig -> String makeCommandLine command CompleteProcessConfig {..} =@@ -633,11 +635,12 @@ makeArgumentHash :: String -> String makeArgumentHash = BSC.unpack . Base64.encode . hash . BSC.pack -makeCachePath :: FilePath -> String -> IO String-makeCachePath cacheFolder cmdLine = do-  version <- getInitDbVersion-  let theHash = makeArgumentHash cmdLine-  pure $ cacheFolder <> "/" <> version <> "/" <> theHash+makeCachePath :: FilePath -> String -> String+makeCachePath cacheFolder cmdLine =+  let+    version = getInitDbVersion+    theHash = makeArgumentHash cmdLine+  in cacheFolder <> "/" <> version <> "/" <> theHash  splitDataDirectory :: CompleteProcessConfig -> (Maybe String, CompleteProcessConfig) splitDataDirectory old =@@ -677,11 +680,10 @@       pure       mtheDataDirectory -    let theCommandLine = makeInitDbCommandLine clearedConfig--    cachePath <- makeCachePath cacheDirectory theCommandLine--    let cachedDataDirectory = cachePath <> "/data"+    let+      theCommandLine = makeInitDbCommandLine clearedConfig+      cachePath = makeCachePath cacheDirectory theCommandLine+      cachedDataDirectory = cachePath <> "/data"      theInitDbPlan <- doesDirectoryExist cachePath >>= \case       True -> pure $ Nothing
tmp-postgres.cabal view
@@ -1,5 +1,5 @@ name:                tmp-postgres-version:             1.19.0.0+version:             1.19.0.1 synopsis: Start and stop a temporary postgres description: Start and stop a temporary postgres. See README.md homepage:            https://github.com/jfischoff/tmp-postgres#readme