Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Codec/RPM/Conduit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Control.Monad.Except(MonadError, throwError)
import Control.Monad.Trans.Resource(MonadResource)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as C
import Data.Conduit((.|), Conduit, awaitForever, yield)
import Data.Conduit((.|), ConduitT, awaitForever, yield)
import Data.Conduit.Attoparsec(ParseError, conduitParserEither)
import Data.Conduit.Lzma(decompress)
import Data.CPIO(Entry, readCPIO)
Expand All @@ -40,19 +40,19 @@ import Codec.RPM.Types(RPM(..))
-- On success, the 'RPM' record will be passed down the conduit for futher processing or
-- consumption. On error, the rest of the conduit will be skipped and the 'ParseError' will
-- be returned as the result to be dealt with.
parseRPMC :: MonadError ParseError m => Conduit C.ByteString m RPM
parseRPMC :: MonadError ParseError m => ConduitT C.ByteString RPM m ()
parseRPMC =
conduitParserEither parseRPM .| consumer
where
consumer = awaitForever $ either throwError (yield . snd)

-- | Extract the package payload from an 'RPM', returning it in the conduit.
payloadC :: Monad m => Conduit RPM m BS.ByteString
payloadC :: Monad m => ConduitT RPM BS.ByteString m ()
payloadC = awaitForever (yield . rpmArchive)

-- | Extract the package payload from an 'RPM', decompress it, and return each element of
-- the payload as a 'Data.CPIO.Entry'.
payloadContentsC :: (MonadResource m, MonadThrow m) => Conduit RPM m Entry
payloadContentsC :: (MonadResource m, MonadThrow m) => ConduitT RPM Entry m ()
payloadContentsC = payloadC
.| decompress Nothing
.| readCPIO
7 changes: 7 additions & 0 deletions Codec/RPM/Version.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
-- |
-- Module: Codec.RPM.Parse
-- Copyright: (c) 2017 Red Hat, Inc.
Expand All @@ -23,7 +24,13 @@ module Codec.RPM.Version(

import Data.Char(digitToInt, isAsciiLower, isAsciiUpper, isDigit, isSpace)
import Data.Maybe(fromMaybe)

#if MIN_VERSION_base(4,11,0)
import Data.Semigroup ()
#else
import Data.Monoid((<>))
#endif

import qualified Data.Ord as Ord
import qualified Data.Text as T
import Data.Word(Word32)
Expand Down
10 changes: 10 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
packages: .

-- cpio-conduit-0.7.2 on hackage has an incompatibility with newer versions of
-- base16-bytestring. A PR was merged to fix this, but
-- a new release was never cut to hackage.
-- Remove this when version 0.7.3 is released to hackage.
source-repository-package
type: git
location: https://github.com/da-x/cpio-conduit
tag: 30d92919e82c5033fffac7b34288f5a7fd28e9be
20 changes: 11 additions & 9 deletions codec-rpm.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: codec-rpm
version: 0.2.2
version: 0.2.3
synopsis: A library for manipulating RPM files
description: This module provides a library for reading RPM files and converting them
into useful data structures. There is currently no way to operate in
Expand All @@ -10,7 +10,7 @@ author: Chris Lumens
maintainer: clumens@redhat.com
license: LGPL-2.1
license-file: LICENSE
cabal-version: >= 1.18
cabal-version: 1.18
build-type: Simple

extra-source-files: ChangeLog.md,
Expand All @@ -36,10 +36,10 @@ library

other-modules: Codec.RPM.Internal.Numbers

build-depends: attoparsec >= 0.12.1.4 && < 0.14,
build-depends: attoparsec >= 0.12.1.4 && < 0.15,
attoparsec-binary >= 0.2 && < 0.3,
base >= 4.7 && < 5.0,
bytestring >= 0.10 && < 0.11,
bytestring >= 0.10 && < 0.12,
conduit >= 1.2.8 && < 1.4,
conduit-extra >= 1.1.15 && < 1.4,
cpio-conduit >= 0.7.0 && < 0.8.0,
Expand All @@ -49,7 +49,7 @@ library
parsec >= 3.1.11 && < 3.2,
pretty >= 1.1.2.0,
resourcet >= 1.1.9 && < 1.3,
text >= 1.2.2.0 && < 1.3
text >= 1.2.2.0 && < 2.1

default-language: Haskell2010

Expand Down Expand Up @@ -82,16 +82,18 @@ test-suite tests
Codec.RPM.Version,
Codec.RPM.VersionSpec

build-tool-depends: hspec-discover:hspec-discover >=2.10.0.0 && < 2.11

build-depends: HUnit >= 1.5.0.0 && < 1.7,
hspec >= 2.4.4 && < 2.6,
hspec >= 2.4.4 && < 2.11,
hspec-attoparsec >= 0.1.0.2 && < 0.2,
base >= 4.7 && < 5.0,
bytestring >= 0.10 && < 0.11,
attoparsec >= 0.12.1.4 && < 0.14,
bytestring >= 0.10 && < 0.12,
attoparsec >= 0.12.1.4 && < 0.15,
attoparsec-binary >= 0.2 && < 0.3,
parsec >= 3.1.11 && < 3.2,
pretty >= 1.1.2.0,
text >= 1.2.2.0 && < 1.3
text >= 1.2.2.0 && < 2.1

default-language: Haskell2010

Expand Down