Skip to content
This repository has been archived by the owner on Nov 28, 2018. It is now read-only.

Commit

Permalink
Write to original file instead of making duplicate.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdone committed Feb 1, 2013
1 parent ee16fa4 commit 05a24b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cabal-sign.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: cabal-sign
version: 0.3.0.0
version: 0.3.1.0
synopsis: Sign and verify Cabal packages.
description: Sign and verify Cabal packages.
license: BSD3
Expand Down
6 changes: 3 additions & 3 deletions src/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Compression.GZip as Gzip
import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString as S
import qualified Codec.Digest.SHA as Sha2
import Data.List
import Data.Serialize
Expand All @@ -31,7 +32,7 @@ sumAndSign fp = do
exists <- doesFileExist fp
if not exists
then error $ fp ++ " doesn't exist"
else do gzip <- L.readFile fp
else do gzip <- fmap (L.fromChunks . return) (S.readFile fp)
entries <- getGzipEntries gzip
L.writeFile sum (checksum entries)
rawSystem "gpg" ["--detach-sign",sum]
Expand All @@ -47,8 +48,7 @@ addSignature gz sig entries = do
Left err -> error err
Right spath -> do
let sigEntry = Tar.fileEntry spath signature
L.writeFile (translate ".signed.tar.gz" gz)
(Gzip.compress (Tar.write (sigEntry : entries)))
L.writeFile gz (Gzip.compress (Tar.write (sigEntry : entries)))
removeFile sig

projectName = dropWhile (=='-') . translate "" . takeFileName
Expand Down

0 comments on commit 05a24b9

Please sign in to comment.