commit ghc-versions for openSUSE:Factory

Hello community, here is the log from the commit of package ghc-versions for openSUSE:Factory checked in at 2017-08-31 21:01:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-versions (Old) and /work/SRC/openSUSE:Factory/.ghc-versions.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-versions" Thu Aug 31 21:01:19 2017 rev:4 rq:513529 version:3.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-versions/ghc-versions.changes 2017-06-22 10:39:39.319862855 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-versions.new/ghc-versions.changes 2017-08-31 21:01:21.230190140 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:05:59 UTC 2017 - psimons@suse.com + +- Update to version 3.1.1. + +------------------------------------------------------------------- Old: ---- versions-3.0.2.1.tar.gz New: ---- versions-3.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-versions.spec ++++++ --- /var/tmp/diff_new_pack.hkdtpc/_old 2017-08-31 21:01:22.773973234 +0200 +++ /var/tmp/diff_new_pack.hkdtpc/_new 2017-08-31 21:01:22.793970425 +0200 @@ -19,7 +19,7 @@ %global pkg_name versions %bcond_with tests Name: ghc-%{pkg_name} -Version: 3.0.2.1 +Version: 3.1.1 Release: 0 Summary: Types and parsers for software version numbers License: BSD-3-Clause @@ -27,6 +27,8 @@ Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRequires: ghc-Cabal-devel +BuildRequires: ghc-deepseq-devel +BuildRequires: ghc-hashable-devel BuildRequires: ghc-megaparsec-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-text-devel ++++++ versions-3.0.2.1.tar.gz -> versions-3.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versions-3.0.2.1/CHANGELOG.md new/versions-3.1.1/CHANGELOG.md --- old/versions-3.0.2.1/CHANGELOG.md 2017-05-26 03:38:35.000000000 +0200 +++ new/versions-3.1.1/CHANGELOG.md 2017-06-14 04:39:25.000000000 +0200 @@ -1,9 +1,23 @@ Changelog ========= -3.0.2 +3.1.1 +----- +- Added instances for common typeclasses: `Generic`, `NFData`, and + `Hashable`. This is to avoid having users define these instances themselves + as orphans. If there are more instances you want added, please let me know. + `Data` was left out on purpose. + +3.1.0 ----- +- Added support for *epoch* numbers in the `Version` type. These are numbers + like the `1:` in `1:2.3.4`. These are used in Arch Linux in rare cases where + packages change their versioning scheme, but need a reliable integer prefix + to establish ordering. The `Version` type has been given a new field, + `_vEpoch :: Maybe Int`, and a corresponding lens, `vEpoch`. +3.0.2 +----- - Expose internal parsers so that they could be used in other parser programs that parse version numbers in larger files. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versions-3.0.2.1/Data/Versions.hs new/versions-3.1.1/Data/Versions.hs --- old/versions-3.0.2.1/Data/Versions.hs 2017-05-31 00:30:49.000000000 +0200 +++ new/versions-3.1.1/Data/Versions.hs 2017-06-14 04:39:25.000000000 +0200 @@ -1,4 +1,5 @@ {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} -- | -- Module : Data.Versions @@ -79,15 +80,19 @@ , svPreRel , svMeta -- ** (General) Version Lenses + , vEpoch , vChunks , vRel -- ** Misc. Lenses / Traversals , _Digits , _Str ) where +import Control.DeepSeq +import Data.Hashable import Data.List (intersperse) import Data.Monoid import Data.Text (Text,pack,snoc) +import GHC.Generics import Text.Megaparsec import Text.Megaparsec.Text @@ -97,7 +102,8 @@ -- types. This allows each subtype to have its own parser, and for said -- parsers to be composed. This is useful for specifying custom behaviour -- for when a certain parser fails. -data Versioning = Ideal SemVer | General Version | Complex Mess deriving (Eq,Show) +data Versioning = Ideal SemVer | General Version | Complex Mess + deriving (Eq,Show,Generic,NFData,Hashable) -- | Comparison of @Ideal@s is always well defined. -- @@ -121,11 +127,12 @@ -- | Convert a `SemVer` to a `Version`. vFromS :: SemVer -> Version -vFromS (SemVer m i p r _) = Version [[Digits m], [Digits i], [Digits p]] r +vFromS (SemVer m i p r _) = Version Nothing [[Digits m], [Digits i], [Digits p]] r -- | Convert a `Version` to a `Mess`. mFromV :: Version -> Mess -mFromV (Version v r) = VNode (chunksAsT v) VHyphen $ VLeaf (chunksAsT r) +mFromV (Version e v r) = maybe affix (\a -> VNode [showt a] VColon affix) e + where affix = VNode (chunksAsT v) VHyphen $ VLeaf (chunksAsT r) -- | Traverse some Text for its inner versioning. -- @@ -186,7 +193,7 @@ , _svMinor :: Int , _svPatch :: Int , _svPreRel :: [VChunk] - , _svMeta :: [VChunk] } deriving (Show) + , _svMeta :: [VChunk] } deriving (Show,Generic,NFData,Hashable) -- | Two SemVers are equal if all fields except metadata are equal. instance Eq SemVer where @@ -238,7 +245,7 @@ -- | A single unit of a Version. May be digits or a string of characters. -- Groups of these are called `VChunk`s, and are the identifiers separated -- by periods in the source. -data VUnit = Digits Int | Str Text deriving (Eq,Show,Read,Ord) +data VUnit = Digits Int | Str Text deriving (Eq,Show,Read,Ord,Generic,NFData,Hashable) -- | > _Digits :: Traversal' VUnit Int _Digits :: Applicative f => (Int -> f Int) -> VUnit -> f VUnit @@ -259,31 +266,50 @@ -- | A (General) Version. -- Not quite as ideal as a `SemVer`, but has some internal consistancy -- from version to version. --- Generally conforms to the @x.x.x-x@ pattern. +-- Generally conforms to the @x.x.x-x@ pattern, and may optionally have an /epoch/. +-- These are prefixes marked by a colon, like in @1:2.3.4@. -- --- Examples of @Version@ that are not @SemVer@: 0.25-2, 8.u51-1, 20150826-1 -data Version = Version { _vChunks :: [VChunk] - , _vRel :: [VChunk] } deriving (Eq,Show) +-- Examples of @Version@ that are not @SemVer@: 0.25-2, 8.u51-1, 20150826-1, 1:2.3.4 +data Version = Version { _vEpoch :: Maybe Int + , _vChunks :: [VChunk] + , _vRel :: [VChunk] } deriving (Eq,Show,Generic,NFData,Hashable) + +-- | Set a `Version`'s epoch to `Nothing`. +wipe :: Version -> Version +wipe v = v { _vEpoch = Nothing } -- | Customized. instance Ord Version where -- | The obvious base case. - compare (Version [] []) (Version [] []) = EQ + compare (Version _ [] []) (Version _ [] []) = EQ + + -- | For the purposes of Versions with epochs, `Nothing` is the same as `Just 0`, + -- so we need to compare their actual version numbers. + compare v0@(Version (Just 0) _ _) v1@(Version Nothing _ _) = compare (wipe v0) v1 + compare v0@(Version Nothing _ _) v1@(Version (Just 0) _ _) = compare v0 (wipe v1) + + compare (Version (Just _) _ _) (Version Nothing _ _) = GT + compare (Version Nothing _ _) (Version (Just _) _ _) = LT + + -- | If two epochs are equal, we need to compare their actual version numbers. + -- Otherwise, the comparison of the epochs is the only thing that matters. + compare v0@(Version (Just n) _ _) v1@(Version (Just m) _ _) | n == m = compare (wipe v0) (wipe v1) + | otherwise = compare n m -- | If the two Versions were otherwise equal and recursed down this far, -- we need to compare them by their "release" values. - compare (Version [] rs) (Version [] rs') = compare (Version rs []) (Version rs' []) + compare (Version _ [] rs) (Version _ [] rs') = compare (Version Nothing rs []) (Version Nothing rs' []) -- | If one side has run out of chunks to compare but the other hasn't, -- the other must be newer. - compare (Version _ _) (Version [] _) = GT - compare (Version [] _) (Version _ _) = LT + compare (Version _ _ _) (Version _ [] _) = GT + compare (Version _ [] _) (Version _ _ _) = LT -- | The usual case. If first VChunks of each Version is equal, then we -- keep recursing. Otherwise, we don't need to check further. Consider @1.2@ -- compared to @1.1.3.4.5.6@. - compare (Version (a:as) rs) (Version (b:bs) rs') = case f a b of - EQ -> compare (Version as rs) (Version bs rs') + compare (Version _ (a:as) rs) (Version _ (b:bs) rs') = case f a b of + EQ -> compare (Version Nothing as rs) (Version Nothing bs rs') res -> res where f [] [] = EQ @@ -306,6 +332,10 @@ f (Digits _ :_) (Str _ :_) = GT f (Str _ :_ ) (Digits _ :_) = LT +-- | > vEpoch :: Lens' Version (Maybe Int) +vEpoch :: Functor f => (Maybe Int -> f (Maybe Int)) -> Version -> f Version +vEpoch f v = fmap (\ve -> v { _vEpoch = ve }) (f $ _vEpoch v) + -- | > vChunks :: Lens' Version [VChunk] vChunks :: Functor f => ([VChunk] -> f [VChunk]) -> Version -> f Version vChunks f v = fmap (\vc -> v { _vChunks = vc }) (f $ _vChunks v) @@ -313,7 +343,7 @@ -- | > vRel :: Lens' Version [VChunk] vRel :: Functor f => ([VChunk] -> f [VChunk]) -> Version -> f Version -vRel f v = fmap (\vc -> v { _vRel = vc }) (f $ _vRel v) +vRel f v = fmap (\vr -> v { _vRel = vr }) (f $ _vRel v) {-# INLINE vRel #-} -- | A (Complex) Mess. @@ -328,7 +358,7 @@ -- -- Not guaranteed to have well-defined ordering (@Ord@) behaviour, -- but so far internal tests show consistency. -data Mess = VLeaf [Text] | VNode [Text] VSep Mess deriving (Eq,Show) +data Mess = VLeaf [Text] | VNode [Text] VSep Mess deriving (Eq,Show,Generic,NFData,Hashable) instance Ord Mess where compare (VLeaf l1) (VLeaf l2) = compare l1 l2 @@ -345,7 +375,7 @@ -- * A hyphen (-). -- * A plus (+). Stop using this outside of metadata if you are. Example: @10.2+0.93+1-1@ -- * An underscore (_). Stop using this if you are. -data VSep = VColon | VHyphen | VPlus | VUnder deriving (Eq,Show) +data VSep = VColon | VHyphen | VPlus | VUnder deriving (Eq,Show,Generic,NFData,Hashable) -- | A synonym for the more verbose `megaparsec` error type. type ParsingError = ParseError (Token Text) Dec @@ -429,7 +459,10 @@ -- | Internal megaparsec parser of 'versionP'. version' :: Parser Version -version' = Version <$> chunks <*> preRel +version' = Version <$> optional (try epoch) <*> chunks <*> preRel + +epoch :: Parser Int +epoch = read <$> (some digitChar <* char ':') -- | A wrapped `Mess` parser. Can be composed with other parsers. messP :: VParser @@ -479,9 +512,10 @@ -- | Convert a `Version` back to its textual representation. prettyVer :: Version -> Text -prettyVer (Version cs pr) = mconcat $ ver <> pr' +prettyVer (Version ep cs pr) = ep' <> mconcat (ver <> pr') where ver = intersperse "." $ chunksAsT cs pr' = foldable [] ("-" :) $ intersperse "." (chunksAsT pr) + ep' = maybe "" (\e -> showt e <> ":") ep -- | Convert a `Mess` back to its textual representation. prettyMess :: Mess -> Text diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versions-3.0.2.1/README.md new/versions-3.1.1/README.md --- old/versions-3.0.2.1/README.md 2016-07-04 04:38:50.000000000 +0200 +++ new/versions-3.1.1/README.md 2017-05-31 00:34:22.000000000 +0200 @@ -2,7 +2,6 @@ ======== [](https://travis-ci.org/fosskers/versions) -[](https://coveralls.io/github/aurapm/haskell-versions?branch=master) [](https://hackage.haskell.org/package/versions) [](http://stackage.org/nightly/package/versions) [](http://stackage.org/lts/package/versions) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versions-3.0.2.1/test/Test.hs new/versions-3.1.1/test/Test.hs --- old/versions-3.0.2.1/test/Test.hs 2017-05-31 00:30:49.000000000 +0200 +++ new/versions-3.1.1/test/Test.hs 2017-06-09 15:37:26.000000000 +0200 @@ -14,13 +14,11 @@ -- | These don't need to parse as a SemVer. goodVers :: [Text] goodVers = [ "1", "1.2", "1.0rc0", "1.0rc1", "1.1rc1", "1.58.0-3", "44.0.2403.157-1" - , "0.25-2", "8.u51-1", "21-2", "7.1p1-1", "20150826-1" + , "0.25-2", "8.u51-1", "21-2", "7.1p1-1", "20150826-1", "1:0.10.16-3" ] messes :: [Text] -messes = [ "10.2+0.93+1-1", "003.03-3", "002.000-7", "1:0.10.16-3" - , "20.26.1_0-2" - ] +messes = [ "10.2+0.93+1-1", "003.03-3", "002.000-7", "20.26.1_0-2" ] messComps :: [Text] messComps = [ "10.2+0.93+1-1", "10.2+0.93+1-2", "10.2+0.93+2-1" @@ -74,6 +72,9 @@ , testGroup "Comparisons" $ testCase "1.2-5 < 1.2.3-1" (comp version "1.2-5" "1.2.3-1") : testCase "1.0rc1 < 1.0" (comp version "1.0rc1" "1.0") : + testCase "1.0 < 1:1.0" (comp version "1.0" "1:1.0") : + testCase "1.1 < 1:1.0" (comp version "1.1" "1:1.0") : + testCase "1.1 < 1:1.1" (comp version "1.1" "1:1.1") : map (\(a,b) -> testCase (unpack $ a <> " < " <> b) $ comp version a b) (zip cabalOrd (tail cabalOrd) <> zip versionOrd (tail versionOrd)) ] @@ -91,8 +92,8 @@ , testCase "1.2.3-1+1 is SemVer" $ check $ isSemVer <$> parseV "1.2.3-1+1" , testCase "1.2.3r1 is Version" $ check $ isVersion <$> parseV "1.2.3r1" , testCase "0.25-2 is Version" $ check $ isVersion <$> parseV "0.25-2" + , testCase "1:1.2.3-1 is Version" $ check $ isVersion <$> parseV "1:1.2.3-1" , testCase "1.2.3+1-1 is Mess" $ check $ isMess <$> parseV "1.2.3+1-1" - , testCase "1:1.2.3-1 is Mess" $ check $ isMess <$> parseV "1:1.2.3-1" , testCase "000.007-1 is Mess" $ check $ isMess <$> parseV "000.007-1" , testCase "20.26.1_0-2 is Mess" $ check $ isMess <$> parseV "20.26.1_0-2" ] @@ -155,7 +156,7 @@ -- | Nothing should happen. noInc :: Assertion noInc = (v & _Ideal . svPatch %~ (+ 1)) @?= v - where v = General $ Version [] [] + where v = General $ Version Nothing [] [] incFromT :: Assertion incFromT = ("1.2.3" & _Versioning . _Ideal . svPatch %~ (+ 1)) @?= "1.2.4" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/versions-3.0.2.1/versions.cabal new/versions-3.1.1/versions.cabal --- old/versions-3.0.2.1/versions.cabal 2017-05-31 00:31:10.000000000 +0200 +++ new/versions-3.1.1/versions.cabal 2017-06-14 04:39:25.000000000 +0200 @@ -1,9 +1,9 @@ --- This file has been generated from package.yaml by hpack version 0.17.0. +-- This file has been generated from package.yaml by hpack version 0.17.1. -- -- see: https://github.com/sol/hpack name: versions -version: 3.0.2.1 +version: 3.1.1 synopsis: Types and parsers for software version numbers. description: A library for parsing and comparing software version numbers. We like to give version numbers to our software in a myriad of @@ -41,12 +41,12 @@ library exposed-modules: Data.Versions - other-modules: - Paths_versions build-depends: base >=4.8 && <4.10 , text >=1.2 && <1.3 , megaparsec >=4 && <6 + , deepseq >= 1.4 && < 1.5 + , hashable >= 1.2 && < 1.3 default-language: Haskell2010 ghc-options: -fwarn-unused-imports -fwarn-unused-binds -fwarn-name-shadowing -fwarn-unused-matches
participants (1)
-
root@hilbert.suse.de