@@ -55,7 +55,7 @@ import Distribution.Text
55
55
import Distribution.Verbosity
56
56
( Verbosity , normal , lessVerbose )
57
57
import Distribution.Simple.Utils
58
- ( die , warn , info , fromUTF8 , findPackageDesc , moreRecentFile )
58
+ ( die , warn , info , fromUTF8 , findPackageDesc )
59
59
60
60
import Data.Char (isAlphaNum )
61
61
import Data.Maybe (mapMaybe , fromMaybe )
@@ -72,6 +72,7 @@ import Distribution.Client.GZipUtils (maybeDecompress)
72
72
import Distribution.Client.Utils (byteStringToFilePath )
73
73
import Distribution.Compat.Exception (catchIO )
74
74
import Distribution.Client.Compat.Time
75
+ import System.Directory (doesFileExist )
75
76
import System.FilePath ((</>) , takeExtension , splitDirectories , normalise )
76
77
import System.FilePath.Posix as FilePath.Posix
77
78
( takeFileName )
@@ -234,9 +235,13 @@ updateRepoIndexCache verbosity repo =
234
235
235
236
whenCacheOutOfDate :: FilePath -> FilePath -> IO () -> IO ()
236
237
whenCacheOutOfDate origFile cacheFile action = do
237
- cacheOutOfDate <- origFile `moreRecentFile` cacheFile
238
- when cacheOutOfDate action
239
-
238
+ exists <- doesFileExist cacheFile
239
+ if not exists
240
+ then action
241
+ else do
242
+ origTime <- getModTime origFile
243
+ cacheTime <- getModTime cacheFile
244
+ when (origTime >= cacheTime) action
240
245
241
246
------------------------------------------------------------------------
242
247
-- Reading the index file
0 commit comments