Hello community, here is the log from the commit of package ghc-bower-json for openSUSE:Factory checked in at 2017-03-03 17:48:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-bower-json (Old) and /work/SRC/openSUSE:Factory/.ghc-bower-json.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-bower-json" Fri Mar 3 17:48:17 2017 rev:3 rq:461606 version:1.0.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-bower-json/ghc-bower-json.changes 2017-01-12 15:47:29.470225314 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-bower-json.new/ghc-bower-json.changes 2017-03-03 17:48:18.337163601 +0100 @@ -1,0 +2,5 @@ +Sun Feb 12 14:18:12 UTC 2017 - [email protected] + +- Update to version 1.0.0.1 with cabal2obs. + +------------------------------------------------------------------- Old: ---- bower-json-0.8.1.tar.gz New: ---- bower-json-1.0.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-bower-json.spec ++++++ --- /var/tmp/diff_new_pack.8pWPaK/_old 2017-03-03 17:48:18.949077183 +0100 +++ /var/tmp/diff_new_pack.8pWPaK/_new 2017-03-03 17:48:18.949077183 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-bower-json # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %global pkg_name bower-json %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.8.1 +Version: 1.0.0.1 Release: 0 Summary: Read bower.json from Haskell License: MIT ++++++ bower-json-0.8.1.tar.gz -> bower-json-1.0.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bower-json-0.8.1/bower-json.cabal new/bower-json-1.0.0.1/bower-json.cabal --- old/bower-json-0.8.1/bower-json.cabal 2016-12-06 18:31:12.000000000 +0100 +++ new/bower-json-1.0.0.1/bower-json.cabal 2016-12-25 01:06:09.000000000 +0100 @@ -1,5 +1,5 @@ name: bower-json -version: 0.8.1 +version: 1.0.0.1 synopsis: Read bower.json from Haskell license: MIT license-file: LICENSE @@ -27,6 +27,7 @@ exposed-modules: Web.Bower.PackageMeta other-modules: Web.Bower.PackageMeta.Internal build-depends: base >=4 && <5 + , ghc-prim , aeson >=0.6.1.0 , deepseq , aeson-better-errors >= 0.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/bower-json-0.8.1/src/Web/Bower/PackageMeta/Internal.hs new/bower-json-1.0.0.1/src/Web/Bower/PackageMeta/Internal.hs --- old/bower-json-0.8.1/src/Web/Bower/PackageMeta/Internal.hs 2016-12-06 18:27:50.000000000 +0100 +++ new/bower-json-1.0.0.1/src/Web/Bower/PackageMeta/Internal.hs 2016-12-25 01:06:09.000000000 +0100 @@ -21,7 +21,6 @@ import Control.DeepSeq import GHC.Generics import Data.Monoid -import Data.List import Data.Char import Data.Text (Text) import qualified Data.Text as T @@ -30,7 +29,7 @@ import Data.Aeson ((.=)) import qualified Data.Aeson as A import qualified Data.Aeson.Types as Aeson -import Data.Aeson.BetterErrors +import Data.Aeson.BetterErrors (Parse, ParseError, asText, asString, asBool, eachInArray, eachInObjectWithKey, withText, key, keyMay, keyOrDefault, toAesonParser', toAesonParser, displayError, parse) --------------------- -- Data types @@ -45,14 +44,14 @@ -- should always get the same value back. data PackageMeta = PackageMeta { bowerName :: PackageName - , bowerDescription :: Maybe String + , bowerDescription :: Maybe Text , bowerMain :: [FilePath] , bowerModuleType :: [ModuleType] - , bowerLicense :: [String] - , bowerIgnore :: [String] - , bowerKeywords :: [String] + , bowerLicense :: [Text] + , bowerIgnore :: [Text] + , bowerKeywords :: [Text] , bowerAuthors :: [Author] - , bowerHomepage :: Maybe String + , bowerHomepage :: Maybe Text , bowerRepository :: Maybe Repository , bowerDependencies :: [(PackageName, VersionRange)] , bowerDevDependencies :: [(PackageName, VersionRange)] @@ -65,18 +64,18 @@ -- | A valid package name for a Bower package. newtype PackageName - = PackageName String + = PackageName Text deriving (Show, Eq, Ord, Generic) instance NFData PackageName -runPackageName :: PackageName -> String +runPackageName :: PackageName -> Text runPackageName (PackageName s) = s -- | A smart constructor for a PackageName. It ensures that the package name -- satisfies the restrictions described at -- <https://github.com/bower/bower.json-spec#name>. -mkPackageName :: String -> Either PackageNameError PackageName +mkPackageName :: Text -> Either PackageNameError PackageName mkPackageName = fmap PackageName . validateAll validators where dashOrDot = ['-', '.'] @@ -86,29 +85,21 @@ | otherwise = Left (err x) validChar c = isAscii c && (isLower c || isDigit c || c `elem` dashOrDot) validators = - [ (not . null, const NotEmpty) - , (all validChar, InvalidChars . filter (not . validChar)) - , (headMay >>> isJustAnd (`notElem` dashOrDot), const MustNotBeginSeparator) - , (lastMay >>> isJustAnd (`notElem` dashOrDot), const MustNotEndSeparator) - , (not . isInfixOf "--", const RepeatedSeparators) - , (not . isInfixOf "..", const RepeatedSeparators) - , (length >>> (<= 50), TooLong . length) + [ (not . T.null, const NotEmpty) + , (T.all validChar, InvalidChars . T.unpack . T.filter (not . validChar)) + , (firstChar (`notElem` dashOrDot), const MustNotBeginSeparator) + , (lastChar (`notElem` dashOrDot), const MustNotEndSeparator) + , (not . T.isInfixOf "--", const RepeatedSeparators) + , (not . T.isInfixOf "..", const RepeatedSeparators) + , (T.length >>> (<= 50), TooLong . T.length) ] - isJustAnd = maybe False - -headMay :: [a] -> Maybe a -headMay [] = Nothing -headMay (x:_) = Just x - -lastMay :: [a] -> Maybe a -lastMay [] = Nothing -lastMay [x] = Just x -lastMay (_:xs) = lastMay xs + firstChar p str = not (T.null str) && p (T.index str 0) + lastChar p = firstChar p . T.reverse data Author = Author - { authorName :: String - , authorEmail :: Maybe String - , authorHomepage :: Maybe String + { authorName :: Text + , authorEmail :: Maybe Text + , authorHomepage :: Maybe Text } deriving (Show, Eq, Ord, Generic) @@ -125,32 +116,32 @@ instance NFData ModuleType -moduleTypes :: [(String, ModuleType)] -moduleTypes = map (\t -> (map toLower (show t), t)) [minBound .. maxBound] +moduleTypes :: [(Text, ModuleType)] +moduleTypes = map (\t -> (T.toLower (T.pack (show t)), t)) [minBound .. maxBound] data Repository = Repository - { repositoryUrl :: String - , repositoryType :: String + { repositoryUrl :: Text + , repositoryType :: Text } deriving (Show, Eq, Ord, Generic) instance NFData Repository newtype Version - = Version { runVersion :: String } + = Version { runVersion :: Text } deriving (Show, Eq, Ord, Generic) instance NFData Version newtype VersionRange - = VersionRange { runVersionRange :: String } + = VersionRange { runVersionRange :: Text } deriving (Show, Eq, Ord, Generic) instance NFData VersionRange data BowerError = InvalidPackageName PackageNameError - | InvalidModuleType String + | InvalidModuleType Text deriving (Show, Eq, Ord, Generic) instance NFData BowerError @@ -159,7 +150,7 @@ showBowerError (InvalidPackageName err) = "Invalid package name: " <> showPackageNameError err showBowerError (InvalidModuleType str) = - "Invalid module type: " <> T.pack str <> + "Invalid module type: " <> str <> ". Must be one of: " <> renderList moduleTypes where renderList = @@ -169,7 +160,7 @@ data PackageNameError = NotEmpty | TooLong Int - | InvalidChars String + | InvalidChars [Char] | RepeatedSeparators | MustNotBeginSeparator | MustNotEndSeparator @@ -184,9 +175,9 @@ TooLong x -> "Package names must be no more than 50 characters, yours was " <> T.pack (show x) - InvalidChars str -> + InvalidChars chars -> "The following characters are not permitted in package names: " <> - T.intercalate " " (map T.singleton str) + T.intercalate " " (map T.singleton chars) RepeatedSeparators -> "The substrings \"--\" and \"..\" may not appear in "<> "package names" @@ -208,15 +199,15 @@ -- | A parser for bower.json files, using the aeson-better-errors package. asPackageMeta :: Parse BowerError PackageMeta asPackageMeta = - PackageMeta <$> key "name" (withString parsePackageName) - <*> keyMay "description" asString + PackageMeta <$> key "name" (withText parsePackageName) + <*> keyMay "description" asText <*> keyOrDefault "main" [] (arrayOrSingle asString) - <*> keyOrDefault "moduleType" [] (arrayOrSingle (withString parseModuleType)) - <*> keyOrDefault "license" [] (arrayOrSingle asString) - <*> keyOrDefault "ignore" [] (eachInArray asString) - <*> keyOrDefault "keywords" [] (eachInArray asString) + <*> keyOrDefault "moduleType" [] (arrayOrSingle (withText parseModuleType)) + <*> keyOrDefault "license" [] (arrayOrSingle asText) + <*> keyOrDefault "ignore" [] (eachInArray asText) + <*> keyOrDefault "keywords" [] (eachInArray asText) <*> keyOrDefault "authors" [] (eachInArray asAuthor) - <*> keyMay "homepage" asString + <*> keyMay "homepage" asText <*> keyMay "repository" asRepository <*> keyOrDefault "dependencies" [] (asAssocListOf VersionRange) <*> keyOrDefault "devDependencies" [] (asAssocListOf VersionRange) @@ -229,17 +220,17 @@ where (<|>) p q = catchError p (const q) - asAssocListOf :: (String -> a) -> Parse BowerError [(PackageName, a)] + asAssocListOf :: (Text -> a) -> Parse BowerError [(PackageName, a)] asAssocListOf g = - eachInObjectWithKey (parsePackageName . T.unpack) (g <$> asString) + eachInObjectWithKey parsePackageName (g <$> asText) -parseModuleType :: String -> Either BowerError ModuleType +parseModuleType :: Text -> Either BowerError ModuleType parseModuleType str = case lookup str moduleTypes of Nothing -> Left (InvalidModuleType str) Just mt -> Right mt -parsePackageName :: String -> Either BowerError PackageName +parsePackageName :: Text -> Either BowerError PackageName parsePackageName str = case mkPackageName str of Left err -> Left (InvalidPackageName err) @@ -249,16 +240,16 @@ asAuthor = catchError asAuthorString (const asAuthorObject) asAuthorString :: Parse e Author -asAuthorString = withString $ \s -> - let (email, s1) = takeDelim "<" ">" (words s) +asAuthorString = withText $ \s -> + let (email, s1) = takeDelim "<" ">" (T.words s) (homepage, s2) = takeDelim "(" ")" s1 - in pure (Author (unwords s2) email homepage) + in pure (Author (T.unwords s2) email homepage) -- | Given a prefix and a suffix, go through the supplied list, attempting -- to extract one string from the list which has the given prefix and suffix, -- All other strings in the list are returned as the second component of the -- tuple. -takeDelim :: String -> String -> [String] -> (Maybe String, [String]) +takeDelim :: Text -> Text -> [Text] -> (Maybe Text, [Text]) takeDelim start end = foldr go (Nothing, []) where go str (Just x, strs) = @@ -269,23 +260,23 @@ Nothing -> (Nothing, str : strs) -- | Like stripPrefix, but strips a suffix as well. -stripWrapper :: String -> String -> String -> Maybe String +stripWrapper :: Text -> Text -> Text -> Maybe Text stripWrapper start end = - stripPrefix start - >>> fmap reverse - >=> stripPrefix (reverse end) - >>> fmap reverse + T.stripPrefix start + >>> fmap T.reverse + >=> T.stripPrefix (T.reverse end) + >>> fmap T.reverse asAuthorObject :: Parse e Author asAuthorObject = - Author <$> key "name" asString - <*> keyMay "email" asString - <*> keyMay "homepage" asString + Author <$> key "name" asText + <*> keyMay "email" asText + <*> keyMay "homepage" asText asRepository :: Parse e Repository asRepository = - Repository <$> key "url" asString - <*> key "type" asString + Repository <$> key "url" asText + <*> key "type" asText ------------------------ -- Serializing @@ -310,10 +301,8 @@ ] where - toText = T.pack . runPackageName - assoc :: A.ToJSON a => Text -> [(PackageName, a)] -> [Aeson.Pair] - assoc = maybeArrayAssocPair toText + assoc = maybeArrayAssocPair runPackageName instance A.ToJSON PackageName where toJSON = A.toJSON . runPackageName @@ -358,10 +347,10 @@ parseJSON = toAesonParser showBowerError asPackageMeta instance A.FromJSON PackageName where - parseJSON = toAesonParser showBowerError (withString parsePackageName) + parseJSON = toAesonParser showBowerError (withText parsePackageName) instance A.FromJSON ModuleType where - parseJSON = toAesonParser showBowerError (withString parseModuleType) + parseJSON = toAesonParser showBowerError (withText parseModuleType) instance A.FromJSON Repository where parseJSON = toAesonParser' asRepository @@ -370,7 +359,7 @@ parseJSON = toAesonParser' asAuthor instance A.FromJSON Version where - parseJSON = toAesonParser' (Version <$> asString) + parseJSON = toAesonParser' (Version <$> asText) instance A.FromJSON VersionRange where - parseJSON = toAesonParser' (VersionRange <$> asString) + parseJSON = toAesonParser' (VersionRange <$> asText)
