packages feed

tar 0.4.3.0 → 0.4.4.0

raw patch · 7 files changed

+42/−11 lines, 7 filesdep ~basedep ~deepseq

Dependency ranges changed: base, deepseq

Files

Codec/Archive/Tar/Index.hs view
@@ -39,6 +39,7 @@     -- * Index lookup     lookup,     TarIndexEntry(..),+    toList,      -- ** I\/O operations     TarEntryOffset,@@ -75,6 +76,7 @@  #ifdef TESTS     prop_lookup,+    prop_toList,     prop_valid,     prop_serialise_deserialise,     prop_index_matches_tar,@@ -164,7 +166,8 @@    deriving (Eq, Show, Typeable) -instance NFData TarIndex -- fully strict by construction+instance NFData TarIndex where+  rnf (TarIndex _ _ _) = () -- fully strict by construction  -- | The result of 'lookup' in a 'TarIndex'. It can either be a file directly, -- or a directory entry containing further entries (and all subdirectories@@ -225,7 +228,18 @@ fromComponentId :: StringTable PathComponentId -> PathComponentId -> FilePath fromComponentId table = BS.Char8.unpack . StringTable.index table +-- | All the files in the index with their corresponding 'TarEntryOffset's.+--+-- Note that the files are in no special order. If you intend to read all or+-- most files then is is recommended to sort by the 'TarEntryOffset'.+--+toList :: TarIndex -> [(FilePath, TarEntryOffset)]+toList (TarIndex pathTable pathTrie _) =+    [ (path, off)+    | (cids, off) <- IntTrie.toList pathTrie+    , let path = FilePath.joinPath (map (fromComponentId pathTable) cids) ] + -- | Build a 'TarIndex' from a sequence of tar 'Entries'. The 'Entries' are -- assumed to start at offset @0@ within a file. --@@ -263,7 +277,8 @@    {-# UNPACK #-} !TarEntryOffset   deriving (Eq, Show) -instance NFData IndexBuilder -- fully strict by construction+instance NFData IndexBuilder where+  rnf (IndexBuilder _ _ _) = () -- fully strict by construction  -- | The initial empty 'IndexBuilder'. --@@ -582,6 +597,13 @@     completions = [ head (FilePath.splitDirectories completion)                   | (path,_) <- paths                   , completion <- maybeToList $ stripPrefix (p ++ "/") path ]++prop_toList :: ValidPaths -> Bool+prop_toList (ValidPaths paths) =+    sort (toList index)+ == sort [ (path, off) | (path, (_sz, off)) <- paths ]+  where+    index = construct paths  prop_valid :: ValidPaths -> Bool prop_valid (ValidPaths paths)
Codec/Archive/Tar/Index/IntTrie.hs view
@@ -362,7 +362,7 @@         -> IntTrieBuilder k v -> IntTrieBuilder k v inserts kvs t = foldl' (\t' (ks, v) -> insert ks v t') t kvs -finalise :: (Enum k, Enum v) => IntTrieBuilder k v -> IntTrie k v+finalise :: IntTrieBuilder k v -> IntTrie k v finalise trie =     IntTrie $       A.listArray (0, fromIntegral (flatTrieLength trie) - 1)
Codec/Archive/Tar/Read.hs view
@@ -19,7 +19,7 @@ import Data.Char     (ord) import Data.Int      (Int64) import Data.Bits     (Bits(shiftL))-import Control.Exception (Exception)+import Control.Exception (Exception(..)) import Data.Typeable (Typeable) import Control.Applicative import Control.Monad@@ -71,8 +71,8 @@ instance Exception FormatError #endif -instance NFData    FormatError-+instance NFData    FormatError where+  rnf !_ = () -- enumerations are fully strict by construction  -- | Convert a data stream in the tar file format into an internal data -- structure. Decoding errors are reported by the 'Fail' constructor of the
Codec/Archive/Tar/Types.hs view
@@ -184,7 +184,8 @@   rnf (OtherEntryType _ c _) = rnf c   rnf  x                     = seq x () -instance NFData Ownership+instance NFData Ownership where+  rnf (Ownership _ _ _ _) = () -- fully strict by construction  -- | @rw-r--r--@ for normal files ordinaryFilePermissions :: Permissions@@ -269,7 +270,8 @@                        {-# UNPACK #-} !BS.ByteString -- path prefix, 155 characters max.   deriving (Eq, Ord) -instance NFData TarPath+instance NFData TarPath where+  rnf (TarPath _ _) = () -- fully strict by construction  instance Show TarPath where   show = show . fromTarPath
changelog.md view
@@ -1,3 +1,8 @@+0.4.4.0 Duncan Coutts <duncan@community.haskell.org> January 2016++  * Build and warning fixes for GHC 7.10 and 8.0+  * New Index module function `toList` to get all index entries+ 0.4.3.0 Duncan Coutts <duncan@community.haskell.org> January 2016    * New Index function `unfinalise` to extend existing index
tar.cabal view
@@ -1,5 +1,5 @@ name:            tar-version:         0.4.3.0+version:         0.4.4.0 license:         BSD3 license-file:    LICENSE author:          Duncan Coutts <duncan@community.haskell.org>@@ -27,6 +27,7 @@   location: https://github.com/haskell/tar.git  flag old-time+  default: False  library   build-depends: base == 4.*,@@ -35,7 +36,7 @@                  directory,                  array,                  containers >= 0.4.2,-                 deepseq+                 deepseq >= 1.1 && < 1.5   if flag(old-time)     build-depends: directory < 1.2, old-time   else
test/Properties.hs view
@@ -42,9 +42,10 @@     , testGroup "index" [         testProperty "lookup"      Index.prop_lookup,         testProperty "valid"       Index.prop_valid,+        testProperty "toList"      Index.prop_toList,         testProperty "serialise"   Index.prop_serialise_deserialise,         testProperty "matches tar" Index.prop_index_matches_tar,-        testProperty "resume"      Index.prop_finalise_unfinalise+        testProperty "unfinalise"  Index.prop_finalise_unfinalise       ]     ]