Skip to content

Commit e22d3e5

Browse files
committed
Remove cabal flag use-old-time, commit to directory >= 1.2
1 parent a513156 commit e22d3e5

File tree

5 files changed

+4
-45
lines changed

5 files changed

+4
-45
lines changed

example-client/example-client.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ executable example-client
4040

4141
build-depends: base >= 4.8 && < 4.20,
4242
bytestring >= 0.9,
43-
directory >= 1.1,
43+
directory >= 1.2,
4444
filepath >= 1.2,
4545
optparse-applicative >= 0.11,
4646
time >= 1.2,

hackage-repo-tool/hackage-repo-tool.cabal

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ flag use-network-uri
4848
description: Are we using @network-uri@?
4949
manual: False
5050

51-
flag use-old-time
52-
description: Are we using @old-time@?
53-
manual: False
54-
5551
flag Cabal-syntax
5652
description: Are we using Cabal-syntax?
5753
manual: False
@@ -70,18 +66,12 @@ executable hackage-repo-tool
7066
-- the respective GHC release
7167
build-depends: base >= 4.8 && < 4.20,
7268
bytestring >= 0.9 && < 0.13,
73-
directory >= 1.1 && < 1.4,
69+
directory >= 1.2 && < 1.4,
7470
filepath >= 1.3 && < 1.5,
7571
time >= 1.4 && < 1.13
7672
if !os(windows)
7773
build-depends: unix >= 2.5 && < 2.9
7874

79-
if flag(use-old-time)
80-
build-depends: directory < 1.2
81-
, old-time == 1.1.*
82-
else
83-
build-depends: directory >= 1.2
84-
8575
-- For non-boot libraries we try to support single major versions
8676
-- to reduce the risk of semantic differences
8777
build-depends: microlens >= 0.4.11.2 && < 0.5,

hackage-repo-tool/src/Hackage/Security/RepoTool/Util/IO.hs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ import System.Posix.Types (EpochTime)
3434
import qualified System.Posix.Files as Posix
3535
#endif
3636

37-
#if MIN_VERSION_directory(1,2,0)
3837
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
39-
#else
40-
import System.Time (ClockTime (TOD))
41-
#endif
4238

4339
-- | Get the modification time of the specified file
4440
--
@@ -50,13 +46,8 @@ getFileModTime opts repoLoc targetPath =
5046
-- from POSIX seconds, so there shouldn't be loss of precision.
5147
-- NB: Apparently, this has low clock resolution on GHC < 7.8.
5248
-- I don't think we care.
53-
#if MIN_VERSION_directory(1,2,0)
5449
fromInteger . floor . utcTimeToPOSIXSeconds
5550
<$> Directory.getModificationTime (toFilePath fp)
56-
#else
57-
Directory.getModificationTime (toFilePath fp) >>= \(TOD s _) ->
58-
return (fromInteger s)
59-
#endif
6051
where
6152
fp :: Path Absolute
6253
fp = anchorTargetPath' opts repoLoc targetPath

hackage-security/hackage-security.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ library
118118
bytestring >= 0.9 && < 0.13,
119119
containers >= 0.4 && < 0.8,
120120
cryptohash-sha256 >= 0.11 && < 0.12,
121-
directory >= 1.2 && < 1.4,
121+
directory >= 1.2.2 && < 1.4,
122122
ed25519 >= 0.0 && < 0.1,
123123
filepath >= 1.2 && < 1.5,
124124
mtl >= 2.2 && < 2.4,

hackage-security/src/Hackage/Security/Util/Path.hs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,7 @@ import Control.Monad
8888
import Data.List (isPrefixOf)
8989
import System.IO (IOMode(..), BufferMode(..), Handle, SeekMode(..))
9090
import System.IO.Unsafe (unsafeInterleaveIO)
91-
#if MIN_VERSION_directory(1,2,0)
9291
import Data.Time (UTCTime)
93-
#else
94-
import System.Time (ClockTime)
95-
#endif
9692
import qualified Data.ByteString as BS
9793
import qualified Data.ByteString.Lazy as BS.L
9894
import qualified System.FilePath as FP.Native
@@ -239,21 +235,7 @@ class FsRoot root where
239235
toAbsoluteFilePath :: Path root -> IO FilePath
240236

241237
instance FsRoot Relative where
242-
toAbsoluteFilePath p = go (unPathNative p)
243-
where
244-
go :: FilePath -> IO FilePath
245-
#if MIN_VERSION_directory(1,2,2)
246-
go = Dir.makeAbsolute
247-
#else
248-
-- copied implementation from the directory package
249-
go = (FP.Native.normalise <$>) . absolutize
250-
absolutize path -- avoid the call to `getCurrentDirectory` if we can
251-
| FP.Native.isRelative path
252-
= (FP.Native.</> path)
253-
. FP.Native.addTrailingPathSeparator <$>
254-
Dir.getCurrentDirectory
255-
| otherwise = return path
256-
#endif
238+
toAbsoluteFilePath p = Dir.makeAbsolute (unPathNative p)
257239

258240
instance FsRoot Absolute where
259241
toAbsoluteFilePath = return . unPathNative
@@ -371,11 +353,7 @@ doesDirectoryExist path = do
371353
filePath <- toAbsoluteFilePath path
372354
Dir.doesDirectoryExist filePath
373355

374-
#if MIN_VERSION_directory(1,2,0)
375356
getModificationTime :: FsRoot root => Path root -> IO UTCTime
376-
#else
377-
getModificationTime :: FsRoot root => Path root -> IO ClockTime
378-
#endif
379357
getModificationTime path = do
380358
filePath <- toAbsoluteFilePath path
381359
Dir.getModificationTime filePath

0 commit comments

Comments
 (0)