zip-archive 0.3.2.5 → 0.3.3
raw patch · 3 files changed
+39/−35 lines, 3 filesdep −old-timedep ~basedep ~directory
Dependencies removed: old-time
Dependency ranges changed: base, directory
Files
- changelog +5/−0
- src/Codec/Archive/Zip.hs +16/−22
- zip-archive.cabal +18/−13
changelog view
@@ -1,3 +1,8 @@+zip-archive 0.3.3++ * Remove dependency on old-time (typedrat).+ * Drop splitBase flag and support for base versions < 3.+ zip-archive 0.3.2.5 * Move 'build-tools: unzip' from library stanza to test stanza.
src/Codec/Archive/Zip.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE ViewPatterns #-} ------------------------------------------------------------------------ -- | -- Module : Codec.Archive.Zip@@ -65,10 +66,10 @@ ) where -import System.Time ( toUTCTime, addToClockTime, CalendarTime (..), ClockTime (..), TimeDiff (..) )-#if MIN_VERSION_directory(1,2,0)-import Data.Time.Clock.POSIX ( utcTimeToPOSIXSeconds )-#endif+import Data.Time.Calendar ( toGregorian, fromGregorian )+import Data.Time.Clock ( UTCTime(..) )+import Data.Time.Clock.POSIX ( posixSecondsToUTCTime, utcTimeToPOSIXSeconds )+import Data.Time.LocalTime ( TimeOfDay(..), timeToTimeOfDay ) import Data.Bits ( shiftL, shiftR, (.&.) ) import Data.Binary import Data.Binary.Get@@ -292,12 +293,8 @@ return B.empty else B.fromStrict <$> S.readFile path-#if MIN_VERSION_directory(1,2,0) modEpochTime <- fmap (floor . utcTimeToPOSIXSeconds) $ getModificationTime path-#else- (TOD modEpochTime _) <- getModificationTime path-#endif let entry = toEntry path' modEpochTime contents entryE <-@@ -485,9 +482,14 @@ epochTimeToMSDOSDateTime minMSDOSDateTime -- if time is earlier than minimum DOS datetime, return minimum epochTimeToMSDOSDateTime epochtime =- let ut = toUTCTime (TOD epochtime 0)- dosTime = toEnum $ (ctSec ut `div` 2) + shiftL (ctMin ut) 5 + shiftL (ctHour ut) 11- dosDate = toEnum $ ctDay ut + shiftL (fromEnum (ctMonth ut) + 1) 5 + shiftL (ctYear ut - 1980) 9+ let + UTCTime+ (toGregorian -> (fromInteger -> year, month, day))+ (timeToTimeOfDay -> (TimeOfDay hour minutes (floor -> sec))) + = posixSecondsToUTCTime (fromIntegral epochtime)++ dosTime = toEnum $ (sec `div` 2) + shiftL minutes 5 + shiftL hour 11+ dosDate = toEnum $ day + shiftL month 5 + shiftL (year - 1980) 9 in MSDOSDateTime { msDOSDate = dosDate, msDOSTime = dosTime } -- | Convert a MSDOS datetime to a 'ClockTime'.@@ -497,18 +499,10 @@ minutes = fromIntegral $ (shiftR dosTime 5) .&. 0O77 hour = fromIntegral $ shiftR dosTime 11 day = fromIntegral $ dosDate .&. 0O37- month = fromIntegral $ ((shiftR dosDate 5) .&. 0O17) - 1+ month = fromIntegral $ ((shiftR dosDate 5) .&. 0O17) year = fromIntegral $ shiftR dosDate 9- timeSinceEpoch = TimeDiff- { tdYear = year + 10, -- dos times since 1980, unix epoch starts 1970- tdMonth = month,- tdDay = day - 1, -- dos days start from 1- tdHour = hour,- tdMin = minutes,- tdSec = seconds,- tdPicosec = 0 }- (TOD epochsecs _) = addToClockTime timeSinceEpoch (TOD 0 0)- in epochsecs+ utc = UTCTime (fromGregorian (1980 + year) month day) (3600 * hour + 60 * minutes + seconds)+ in floor (utcTimeToPOSIXSeconds utc) #ifndef _WINDOWS getDirectoryContentsRecursive' :: [ZipOption] -> FilePath -> IO [FilePath]
zip-archive.cabal view
@@ -1,5 +1,5 @@ Name: zip-archive-Version: 0.3.2.5+Version: 0.3.3 Cabal-Version: >= 1.10 Build-type: Custom Synopsis: Library for creating and modifying zip archives.@@ -24,21 +24,24 @@ type: git location: git://github.com/jgm/zip-archive.git -flag splitBase- Description: Choose the new, smaller, split-up base package.- Default: True flag executable Description: Build the Zip executable. Default: False Library- if flag(splitBase)- Build-depends: base >= 3 && < 5, pretty, containers- else- Build-depends: base < 3- Build-depends: binary >= 0.6, zlib, filepath, bytestring >= 0.10.0,- array, mtl, text >= 0.11, old-time, digest >= 0.0.0.1,- directory, time+ Build-depends: base >= 3 && < 5,+ pretty,+ containers,+ binary >= 0.6,+ zlib,+ filepath,+ bytestring >= 0.10.0,+ array,+ mtl,+ text >= 0.11,+ digest >= 0.0.0.1,+ directory >= 1.2.0,+ time Exposed-modules: Codec.Archive.Zip Default-Language: Haskell98 Hs-Source-Dirs: src@@ -58,7 +61,9 @@ Buildable: False Main-is: Main.hs Hs-Source-Dirs: .- Build-Depends: base >= 4.2 && < 5, directory >= 1.1, bytestring >= 0.9.0,+ Build-Depends: base >= 4.2 && < 5,+ directory >= 1.1,+ bytestring >= 0.9.0, zip-archive Other-Modules: Paths_zip_archive Ghc-Options: -Wall@@ -69,7 +74,7 @@ Main-Is: test-zip-archive.hs Hs-Source-Dirs: tests Build-Depends: base >= 4.2 && < 5,- directory >= 1.3, bytestring >= 0.9.0, process, time, old-time, + directory >= 1.3, bytestring >= 0.9.0, process, time, HUnit, zip-archive, temporary, filepath Default-Language: Haskell98 Ghc-Options: -Wall