codec-rpm 0.1.1 → 0.1.2
raw patch · 6 files changed
+40/−33 lines, 6 filesdep ~conduit-extradep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: conduit-extra, text
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Codec/RPM/Parse.hs +9/−6
- Codec/RPM/Tags.hs +16/−16
- Codec/RPM/Types.hs +2/−2
- Codec/RPM/Version.hs +6/−6
- codec-rpm.cabal +3/−3
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.1.2++* Relax overly strict conduit-extra and text requirements.+ ## 0.1.1 * Relax overly strict attoparsec requirement.
Codec/RPM/Parse.hs view
@@ -110,17 +110,19 @@ headerTags, headerStore } --- | A parser (in the attoparsec sense of the term) that constructs 'RPM' records. The parser--- can be run against a 'ByteString' of RPM data using any of the usual functions. 'parse' and--- 'parseOnly' are especially useful:+-- | A parser (in the attoparsec sense of the term) that constructs 'Codec.RPM.Types.RPM' records.+-- The parser can be run against a 'Data.ByteString.ByteString' of RPM data using any of the usual+-- functions. 'Data.Attoparsec.ByteString.parse' and 'Data.Attoparsec.ByteString.parseOnly' are+-- especially useful: -- -- > import Data.Attoparsec.ByteString(parse) -- > import qualified Data.ByteString as BS -- > s <- BS.readFile "some.rpm" -- > result <- parse parseRPM s ----- The 'Result' can then be examined directly or converted using 'maybeResult' (for converting--- it into a 'Maybe RPM') or 'eitherResult' (for converting it into an 'Either String RPM').+-- The 'Data.Attoparsec.ByteString.Result' can then be examined directly or converted using+-- 'Data.Attoparsec.ByteString.maybeResult' (for converting it into a 'Maybe' 'RPM') or+-- 'Data.Attoparsec.ByteString.eitherResult' (for converting it into an 'Either' 'String' 'RPM'). -- In the latter case, the String contains any parse error that occurred when reading the -- RPM data. parseRPM :: Parser RPM@@ -145,7 +147,8 @@ if remainder > 0 then fromIntegral $ 8 - remainder else 0 -- | Like 'parseRPM', but puts the result into a 'Conduit' as an 'Either', containing either a--- 'ParseError' or an 'RPM'. The result can be extracted with 'runExceptT', like so:+-- 'ParseError' or an 'RPM'. The result can be extracted with 'Control.Monad.Except.runExceptT',+-- like so: -- -- > import Conduit((.|), runConduitRes, sourceFile) -- > import Control.Monad.Except(runExceptT)
Codec/RPM/Tags.hs view
@@ -48,16 +48,16 @@ {-# ANN module "HLint: ignore Use String" #-} -- | A very large data type that holds all the possibilities for the various tags that can--- be contained in an 'RPM' 'Header'. Each tag describes one piece of metadata. Most tags--- include some typed value, such as a 'String' or 'Word32'. Many tags contain lists of--- these values, for instance any tag involving files or changelog entries. Some tags--- contain no useful value at all.+-- be contained in an 'Codec.RPM.Types.RPM' 'Codec.RPM.Types.Header'. Each tag describes+-- one piece of metadata. Most tags include some typed value, such as a 'String' or+-- 'Word32'. Many tags contain lists of these values, for instance any tag involving files+-- or changelog entries. Some tags contain no useful value at all. ----- Because there are so many possibilities for tags and each 'RPM' likely contains dozens--- of tags, it is unwieldy to write functions that pattern match on tags and take some--- action. This module therefore provides a variety of find*Tag functions for searching--- the list of tags by name and returning a 'Maybe' value. The name provided to each should--- be the constructor you are looking for in this data type.+-- Because there are so many possibilities for tags and each 'Codec.RPM.Types.RPM' likely+-- contains dozens of tags, it is unwieldy to write functions that pattern match on tags and+-- take some action. This module therefore provides a variety of find*Tag functions for+-- searching the list of tags by name and returning a 'Maybe' value. The name provided to+-- each should be the constructor you are looking for in this data type. -- -- To find the list of all files in the RPM, you would therefore do: --@@ -388,11 +388,11 @@ -- | Attempt to create a 'Tag' based on various parameters. mkTag :: BS.ByteString -- ^ The 'headerStore' containing the value of the potential 'Tag'. -> Int -- ^ The number of the 'Tag', as read out of the store. Valid numbers- -- may be found in lib/rpmtag.h in the RPM source, though most+ -- may be found in lib\/rpmtag.h in the RPM source, though most -- users will not need to know this since it will be read from the -- store. -> Word32 -- ^ What is the type of this tag's value? Valid numbers may be found- -- in the rpmTagType_e enum in lib/rpmtag.h in the RPM source, though+ -- in the rpmTagType_e enum in lib\/rpmtag.h in the RPM source, though -- most users will not need to know this since it will be read from -- the store. Here, it is used as a simple form of type checking. -> Word32 -- ^ How far into the 'headerStore' is this 'Tag's value stored?@@ -779,10 +779,10 @@ readStrings :: BS.ByteString -> Word32 -> [BS.ByteString] readStrings bytestring count = take (fromIntegral count) $ BS.split 0 bytestring --- | Given the name of a 'Tag' and a list of 'Tag's (say, from the 'Header' of some 'RPM'),--- find the match and return it as a 'Maybe'. This is the most generic of the various finding--- functions - it will return any match regardless of its type. You are expected to know what--- type you are looking for.+-- | Given the name of a 'Tag' and a list of 'Tag's (say, from the 'Codec.RPM.Types.Header' of some+-- 'Codec.RPM.Types.RPM'), find the match and return it as a 'Maybe'. This is the most generic of+-- the various finding functions - it will return any match regardless of its type. You are+-- expected to know what type you are looking for. findTag :: String -> [Tag] -> Maybe Tag findTag name = find (\t -> name == showConstr (toConstr t)) @@ -845,7 +845,7 @@ -- | Given a 'Tag', return its value. This is a helper function to be used with 'findTag', -- essentially as a type-safe way to cast the value into a known type. It is used internally -- in all the type-specific find*Tag functions but can also be used on its own. A function--- to find the "Epoch" tag could be written as follows:+-- to find the Epoch tag could be written as follows: -- -- > epoch = findTag "Epoch" tags >>= \t -> tagValue t :: Maybe Word32 tagValue :: Typeable a => Tag -> Maybe a
Codec/RPM/Types.hs view
@@ -66,13 +66,13 @@ -- may be defined in the future. rpmType :: Word16, -- | What platform was this package built for? x86 is 0x0001. Many other values- -- are defined. See /usr/lib/rpm/rpmrc for the possibilities.+ -- are defined. See \/usr\/lib\/rpm\/rpmrc for the possibilities. rpmArchNum :: Word16, -- | The package name, as a NEVRA. This name is constrained to 66 bytes. Shorter -- names are padded with nulls. rpmName :: String, -- | What operating system was this package built for? Linux is 0x0001. Many other- -- values are defined. See /usr/lib/rpm/rpmrc for the possibilities.+ -- values are defined. See \/usr\/lib\/rpm\/rpmrc for the possibilities. rpmOSNum :: Word16, -- | What type of signature is used in this RPM? For now, this appears to always -- be set to 0x0005.
Codec/RPM/Version.hs view
@@ -40,11 +40,11 @@ -- an earlier version number must upgrade a package with a later version number. The package -- with a larger epoch will always in version comparisons. Most packages do not have an epoch. epoch :: Maybe Word32,- -- | The version number provided by the package's upstream, represented as 'Text'.+ -- | The version number provided by the package's upstream, represented as 'Data.Text.Text'. version :: T.Text,- -- | The release number, represented as 'Text'. The release value is added on by a distribution- -- and allows them to make multiple releases of the same upstream version, fixing bugs and applying- -- distribution-specific tweaks.+ -- | The release number, represented as 'Data.Text.Text'. The release value is added on by a+ -- distribution and allows them to make multiple releases of the same upstream version, fixing+ -- bugs and applying distribution-specific tweaks. release :: T.Text } deriving(Show) @@ -224,11 +224,11 @@ versionChar = digit <|> upper <|> lower <|> oneOf "._+%{}~" --- | Convert a 'Text' representation into an 'EVR' or a 'ParseError' if something goes wrong.+-- | Convert a 'Data.Text.Text' representation into an 'EVR' or a 'ParseError' if something goes wrong. parseEVR :: T.Text -> Either ParseError EVR parseEVR = parse parseEVRParsec "" --- | Convert a 'Text' representation into a 'DepRequirement' or a 'ParseError' if something+-- | Convert a 'Data.Text.Text' representation into a 'DepRequirement' or a 'ParseError' if something -- goes wrong. parseDepRequirement :: T.Text -> Either ParseError DepRequirement parseDepRequirement input = parse parseDepRequirement' "" input
codec-rpm.cabal view
@@ -1,5 +1,5 @@ name: codec-rpm-version: 0.1.1+version: 0.1.2 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@@ -40,12 +40,12 @@ bytestring >= 0.10 && < 0.11, conduit >= 1.2.8 && < 1.3, conduit-combinators >= 1.1.0 && < 1.2,- conduit-extra >= 1.1.16 && < 1.2,+ conduit-extra >= 1.1.15 && < 1.2, mtl >= 2.2.1 && < 2.3, parsec >= 3.1.11 && < 3.2, pretty >= 1.1.2.0, resourcet >= 1.1.9 && < 1.2,- text >= 1.2.2.2 && < 1.3+ text >= 1.2.2.0 && < 1.3 default-language: Haskell2010