Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-yaml for openSUSE:Factory 
checked in at 2021-10-12 21:49:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-yaml (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-yaml.new.2443 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-yaml"

Tue Oct 12 21:49:04 2021 rev:37 rq:921712 version:0.11.6.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-yaml/ghc-yaml.changes        2020-12-22 
11:49:37.186015446 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-yaml.new.2443/ghc-yaml.changes      
2021-10-12 21:50:19.811955627 +0200
@@ -1,0 +2,10 @@
+Mon Sep 20 07:10:48 UTC 2021 - psim...@suse.com
+
+- Update yaml to version 0.11.6.0.
+  ## 0.11.6.0
+
+  * `yaml2json`: add `--help` and `--version` options 
[#197](https://github.com/snoyberg/yaml/pull/197)
+  * `json2yaml`: add `--help` and `--version` options 
[#198](https://github.com/snoyberg/yaml/pull/198)
+  * Add the `-o` options to both `yaml2json` and `json2yaml` 
[#200](https://github.com/snoyberg/yaml/pull/200)
+
+-------------------------------------------------------------------

Old:
----
  yaml-0.11.5.0.tar.gz

New:
----
  yaml-0.11.6.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc-yaml.spec ++++++
--- /var/tmp/diff_new_pack.yePQ6M/_old  2021-10-12 21:50:20.387956452 +0200
+++ /var/tmp/diff_new_pack.yePQ6M/_new  2021-10-12 21:50:20.391956457 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-yaml
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # 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 yaml
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.11.5.0
+Version:        0.11.6.0
 Release:        0
 Summary:        Support for parsing and rendering YAML documents
 License:        BSD-3-Clause

++++++ yaml-0.11.5.0.tar.gz -> yaml-0.11.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/ChangeLog.md 
new/yaml-0.11.6.0/ChangeLog.md
--- old/yaml-0.11.5.0/ChangeLog.md      2020-08-19 14:30:53.000000000 +0200
+++ new/yaml-0.11.6.0/ChangeLog.md      2021-09-18 18:41:45.000000000 +0200
@@ -1,5 +1,11 @@
 # ChangeLog for yaml
 
+## 0.11.6.0
+
+* `yaml2json`: add `--help` and `--version` options 
[#197](https://github.com/snoyberg/yaml/pull/197)
+* `json2yaml`: add `--help` and `--version` options 
[#198](https://github.com/snoyberg/yaml/pull/198)
+* Add the `-o` options to both `yaml2json` and `json2yaml` 
[#200](https://github.com/snoyberg/yaml/pull/200)
+
 ## 0.11.5.0
 
 * New functions capable of parsing YAML streams containing multiple documents 
into a list of results:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/README.md new/yaml-0.11.6.0/README.md
--- old/yaml-0.11.5.0/README.md 2020-08-19 14:30:30.000000000 +0200
+++ new/yaml-0.11.6.0/README.md 2021-09-18 18:40:42.000000000 +0200
@@ -1,7 +1,7 @@
 ## yaml
 
-[![Build 
Status](https://travis-ci.org/snoyberg/yaml.svg?branch=master)](https://travis-ci.org/snoyberg/yaml)
-[![Build 
status](https://ci.appveyor.com/api/projects/status/hqy2jketp8m502so/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/yaml/branch/master)
+[![GitHub build and test 
status](https://github.com/snoyberg/yaml/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/snoyberg/yaml/actions/workflows/tests.yml)
+[![Appveyor build 
status](https://ci.appveyor.com/api/projects/status/hqy2jketp8m502so/branch/master?svg=true)](https://ci.appveyor.com/project/snoyberg/yaml/branch/master)
 
 Provides support for parsing and emitting Yaml documents.
 
@@ -16,3 +16,11 @@
 * `Data.Yaml.Include` supports adding `!include` directives to your YAML files.
 * `Data.Yaml.Builder` and `Data.Yaml.Parser` allow more fine-grained control 
of parsing an rendering, as opposed to just using the aeson typeclass and 
datatype system for parsing and rendering.
 * `Data.Yaml.Aeson` is currently a re-export of `Data.Yaml` to explicitly 
choose to use the aeson-compatible API.
+
+### Executables
+
+Converters `json2yaml` and `yaml2json` can be built by disabling flag 
`no-exe`, e.g., one of:
+```
+cabal install yaml -f-no-exe
+stack install yaml --flag yaml:-no-exe
+```
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/exe/Common.hs 
new/yaml-0.11.6.0/exe/Common.hs
--- old/yaml-0.11.5.0/exe/Common.hs     1970-01-01 01:00:00.000000000 +0100
+++ new/yaml-0.11.6.0/exe/Common.hs     2021-09-18 18:40:42.000000000 +0200
@@ -0,0 +1,68 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE LambdaCase #-}
+
+-- | Code shared between @yaml2json@ and @json2yaml@.
+
+module Common where
+
+import Data.List            ( intercalate )
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup       ( Semigroup(..) )
+#endif
+import Data.Version         ( Version(versionBranch) )
+
+import Options.Applicative  ( Parser, help, hidden, infoOption, long, short )
+
+import qualified Paths_yaml as Paths
+
+-- * Version info and option
+---------------------------------------------------------------------------
+
+-- | Homepage for @yaml2json@ and @json2yaml@.
+
+homepage :: String
+homepage = "https://github.com/snoyberg/yaml/";
+
+-- | Version in @x.y.z@ format.
+
+version :: String
+version = intercalate "." $ map show $ versionBranch Paths.version
+
+-- | The version header including given program name and 'homepage'.
+
+versionText :: String -> String
+versionText self = unwords
+  [ self
+  , "version"
+  , version
+  , homepage  -- concat [ "<", homepage, ">" ]
+  ]
+
+-- | Option @--numeric-version@.
+
+numericVersionOption :: Parser (a -> a)
+numericVersionOption =
+  infoOption version
+    $  long "numeric-version"
+    <> hidden
+    <> help "Show just version number."
+
+-- | Option @--version@.
+
+versionOption :: String -> Parser (a -> a)
+versionOption self =
+  infoOption (versionText self)
+    $  long "version"
+    <> short 'V'
+    <> hidden
+    <> help "Show version info."
+
+-- * Misc
+---------------------------------------------------------------------------
+
+-- | @Just@ unless argument is @"-"@ (denoting @stdin@ or @stdout@).
+
+dashToNothing :: FilePath -> Maybe FilePath
+dashToNothing = \case
+  "-"  -> Nothing
+  file -> Just file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/exe/json2yaml.hs 
new/yaml-0.11.6.0/exe/json2yaml.hs
--- old/yaml-0.11.5.0/exe/json2yaml.hs  2020-08-19 14:30:30.000000000 +0200
+++ new/yaml-0.11.6.0/exe/json2yaml.hs  2021-09-18 18:40:42.000000000 +0200
@@ -1,22 +1,106 @@
-import qualified Data.Aeson as J
-import qualified Data.ByteString as S
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE NamedFieldPuns #-}
+
+import qualified Data.Aeson           as J
+import qualified Data.ByteString      as S
 import qualified Data.ByteString.Lazy as L
-import System.Environment (getArgs)
+import qualified Data.Yaml            as Y
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup ( Semigroup(..) )
+#endif
+
+import Options.Applicative
+  ( Parser, (<|>)
+  , action, execParser, footerDoc, headerDoc, help, helper, hidden, info
+  , long, metavar, short, strArgument, strOption, value
+  )
+import Options.Applicative.Help.Pretty
+  ( vcat, text )
+
+import System.Exit    ( die )
+
+import Common         ( dashToNothing, versionText, versionOption, 
numericVersionOption )
+
+data Options = Options
+  { optInput  :: Maybe FilePath
+      -- ^ 'Nothing' means @stdin@.
+  , optOutput :: Maybe FilePath
+      -- ^ 'Nothing' means @stdout@.
+  }
+
+-- | Name of the executable.
+
+self :: String
+self = "json2yaml"
+
+-- | Parse options; handle parse errors, @--help@, @--version@.
+
+options :: IO Options
+options =
+  execParser $
+    info (helper <*> versionOption self <*> numericVersionOption <*> 
programOptions)
+      $  headerDoc hdoc
+      <> footerDoc fdoc
 
-import qualified Data.Yaml as Y
+  where
+  hdoc = Just $ vcat $ map text
+    [ versionText self
+    , "Convert JSON to YAML."
+    ]
+  fdoc = Just $ text $ concat
+    [ "The old call pattern '"
+    , self
+    , " IN OUT' is also accepted, but deprecated."
+    ]
+
+  programOptions :: Parser Options
+  programOptions = Options <$> oInput <*> oOutput
+
+  oInput :: Parser (Maybe FilePath)
+  oInput = dashToNothing <$> do
+    strArgument
+      $  metavar "IN"
+      <> value "-"
+      <> action "file"
+      <> help "The input file containing the JSON document; use '-' for stdin 
(default)."
+
+  oOutput :: Parser (Maybe FilePath)
+  oOutput = dashToNothing <$> do
+    oOutputExplicit <|> oOutputImplicit
+
+  oOutputExplicit :: Parser FilePath
+  oOutputExplicit =
+    strOption
+      $  long "output"
+      <> short 'o'
+      <> metavar "OUT"
+      <> action "file"
+      -- <> help "The file to hold the produced YAML document; use '-' for 
stdout (default)."
+
+  oOutputImplicit :: Parser FilePath
+  oOutputImplicit =
+    strArgument
+      $  metavar "OUT"
+      <> value "-"
+      <> action "file"
+      <> hidden
+      <> help "The file to hold the produced YAML document; use '-' for stdout 
(default)."
+
+-- | Exit with 'self'-stamped error message.
+
+abort :: String -> IO a
+abort msg = die $ concat [ self, ": ", msg ]
 
 main :: IO ()
 main = do
-    args <- getArgs
-    (input, output) <- case args ++ replicate (2 - length args) "-" of
-        [i, o] -> return (i, o)
-        _ -> fail "Usage: json2yaml [in] [out]"
-    mval <- fmap J.decode $
-        case input of
-            "-" -> L.getContents
-            _ -> L.readFile input
-    case mval of
-        Nothing -> error "Invalid input JSON"
-        Just val -> case output of
-            "-" -> S.putStr $ Y.encode (val :: Y.Value)
-            _ -> Y.encodeFile output val
+  Options{ optInput, optOutput } <- options
+
+  -- Read JSON.
+  mval <- J.decode <$> maybe L.getContents L.readFile optInput
+
+  -- Write YAML.
+  case mval of
+    Nothing  -> abort "Invalid input JSON"
+    Just val -> case optOutput of
+      Nothing -> S.putStr $ Y.encode (val :: Y.Value)
+      Just f  -> Y.encodeFile f val
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/exe/yaml2json.hs 
new/yaml-0.11.6.0/exe/yaml2json.hs
--- old/yaml-0.11.5.0/exe/yaml2json.hs  2020-08-19 14:30:30.000000000 +0200
+++ new/yaml-0.11.6.0/exe/yaml2json.hs  2021-09-18 18:40:42.000000000 +0200
@@ -1,31 +1,87 @@
-import Prelude hiding (putStr, getContents)
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE LambdaCase #-}
+{-# LANGUAGE NamedFieldPuns #-}
+
+import Data.Aeson           (encode, Value)
+import qualified Data.ByteString      as S (getContents)
+import qualified Data.ByteString.Lazy as L (putStr, writeFile)
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup       (Semigroup(..))
+#endif
+import Data.Yaml            (decodeFileEither, decodeEither')
+import System.Exit          (die)
+
+import Options.Applicative
+  ( Parser
+  , action, execParser, headerDoc, help, helper, info
+  , long, metavar, short, strArgument, strOption, value
+  )
+import Options.Applicative.Help.Pretty
+  ( vcat, text )
+
+import Common
+  ( versionText, versionOption, numericVersionOption, dashToNothing )
+
+data Options = Options
+  { optInput :: Maybe FilePath
+      -- ^ 'Nothing' means @stdin@.
+  , optOutput :: Maybe FilePath
+      -- ^ 'Nothing' means @stdout@.
+  }
+
+-- | Name of the executable.
+
+self :: String
+self = "yaml2json"
+
+-- | Parse options; handle parse errors, @--help@, @--version@.
+
+options :: IO Options
+options =
+  execParser $
+    info (helper <*> versionOption self <*> numericVersionOption <*> 
programOptions)
+         (headerDoc hdoc)
+
+  where
+  hdoc = Just $ vcat $ map text
+    [ versionText self
+    , "Convert YAML to JSON."
+    ]
+
+  programOptions = Options <$> oInput <*> oOutput
+
+  oInput :: Parser (Maybe FilePath)
+  oInput = dashToNothing <$> do
+    strArgument
+      $  metavar "IN"
+      <> value "-"
+      <> action "file"
+      <> help "The input file containing the YAML document; use '-' for stdin 
(default)."
+
+  oOutput :: Parser (Maybe FilePath)
+  oOutput = dashToNothing <$> do
+    strOption
+      $  long "output"
+      <> short 'o'
+      <> value "-"
+      <> metavar "OUT"
+      <> action "file"
+      <> help "The file to hold the produced JSON document; use '-' for stdout 
(default)."
 
-import Data.Aeson (encode, Value)
-import Data.ByteString (getContents)
-import Data.ByteString.Lazy (putStr)
-import System.Environment (getArgs)
-import System.Exit
-import System.IO (stderr, hPutStrLn)
-
-import Data.Yaml (decodeFileEither, decodeEither')
-
-helpMessage :: IO ()
-helpMessage = putStrLn "Usage: yaml2json FILE\n\nuse '-' as FILE to indicate 
stdin" >> exitFailure
-
-showJSON :: Show a => Either a Value -> IO b
-showJSON ejson =
-    case ejson of
-       Left err -> hPutStrLn stderr (show err) >> exitFailure
-       Right res -> putStr (encode (res :: Value)) >> exitSuccess
 
 main :: IO ()
 main = do
-    args <- getArgs
-    case args of
-       -- strict getContents will read in all of stdin at once
-       (["-h"]) -> helpMessage
-       (["--help"]) -> helpMessage
-       (["-"]) -> getContents >>= showJSON . decodeEither'
-       ([f])   -> decodeFileEither f >>= showJSON
-       _ -> helpMessage
+  Options{ optInput, optOutput } <- options
 
+  -- Input YAML.
+  result <- case optInput of
+    -- strict getContents will read in all of stdin at once
+    Nothing -> decodeEither' <$> S.getContents
+    Just f  -> decodeFileEither f
+
+  -- Output JSON.
+  case result of
+    Left  err -> die $ show err
+    Right val -> do
+      let json = encode (val :: Value)
+      maybe L.putStr L.writeFile optOutput json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.11.5.0/yaml.cabal new/yaml-0.11.6.0/yaml.cabal
--- old/yaml-0.11.5.0/yaml.cabal        2020-08-19 14:30:53.000000000 +0200
+++ new/yaml-0.11.6.0/yaml.cabal        2021-09-18 18:40:42.000000000 +0200
@@ -1,13 +1,11 @@
 cabal-version: 1.12
 
--- This file has been generated from package.yaml by hpack version 0.33.0.
+-- This file has been generated from package.yaml by hpack version 0.34.4.
 --
 -- see: https://github.com/sol/hpack
---
--- hash: 55c85c8d4d3074a558a82e30a2592ecff9db2e6f1571547c73d26ba44bfc1c20
 
 name:           yaml
-version:        0.11.5.0
+version:        0.11.6.0
 synopsis:       Support for parsing and rendering YAML documents.
 description:    README and API documentation are available at 
<https://www.stackage.org/package/yaml>
 category:       Data
@@ -62,8 +60,9 @@
       Paths_yaml
   hs-source-dirs:
       src
-  other-extensions: LambdaCase
-  ghc-options: -Wall
+  other-extensions:
+      LambdaCase
+  ghc-options: -Wall -Wcompat
   build-depends:
       aeson >=0.11
     , attoparsec >=0.11.3.0
@@ -73,7 +72,7 @@
     , containers
     , directory
     , filepath
-    , libyaml >=0.1 && <0.2
+    , libyaml ==0.1.*
     , mtl
     , resourcet >=0.3 && <1.3
     , scientific >=0.3
@@ -82,9 +81,6 @@
     , transformers >=0.1
     , unordered-containers
     , vector
-  if !impl(ghc >= 8.0)
-    build-depends:
-        semigroups
   default-language: Haskell2010
 
 executable examples
@@ -95,7 +91,7 @@
       Paths_yaml
   hs-source-dirs:
       examples
-  ghc-options: -Wall
+  ghc-options: -Wall -Wcompat
   build-depends:
       aeson >=0.11
     , attoparsec >=0.11.3.0
@@ -105,7 +101,7 @@
     , containers
     , directory
     , filepath
-    , libyaml >=0.1 && <0.2
+    , libyaml ==0.1.*
     , mtl
     , resourcet >=0.3 && <1.3
     , scientific >=0.3
@@ -114,9 +110,6 @@
     , transformers >=0.1
     , unordered-containers
     , vector
-  if !impl(ghc >= 8.0)
-    build-depends:
-        semigroups
   if flag(no-examples)
     buildable: False
   else
@@ -128,9 +121,11 @@
 executable json2yaml
   main-is: json2yaml.hs
   other-modules:
+      Common
       Paths_yaml
   hs-source-dirs:
       exe
+  ghc-options: -Wall -Wcompat
   build-depends:
       aeson >=0.11
     , attoparsec >=0.11.3.0
@@ -140,8 +135,9 @@
     , containers
     , directory
     , filepath
-    , libyaml >=0.1 && <0.2
+    , libyaml ==0.1.*
     , mtl
+    , optparse-applicative
     , resourcet >=0.3 && <1.3
     , scientific >=0.3
     , template-haskell
@@ -150,9 +146,6 @@
     , unordered-containers
     , vector
     , yaml
-  if !impl(ghc >= 8.0)
-    build-depends:
-        semigroups
   if flag(no-exe)
     buildable: False
   default-language: Haskell2010
@@ -160,9 +153,15 @@
 executable yaml2json
   main-is: yaml2json.hs
   other-modules:
+      Common
       Paths_yaml
   hs-source-dirs:
       exe
+  other-extensions:
+      CPP
+      LambdaCase
+      NamedFieldPuns
+  ghc-options: -Wall -Wcompat
   build-depends:
       aeson >=0.11
     , attoparsec >=0.11.3.0
@@ -172,8 +171,9 @@
     , containers
     , directory
     , filepath
-    , libyaml >=0.1 && <0.2
+    , libyaml ==0.1.*
     , mtl
+    , optparse-applicative
     , resourcet >=0.3 && <1.3
     , scientific >=0.3
     , template-haskell
@@ -182,9 +182,6 @@
     , unordered-containers
     , vector
     , yaml
-  if !impl(ghc >= 8.0)
-    build-depends:
-        semigroups
   if flag(no-exe)
     buildable: False
   default-language: Haskell2010
@@ -199,7 +196,7 @@
       Paths_yaml
   hs-source-dirs:
       test
-  ghc-options: -Wall "-with-rtsopts=-K1K"
+  ghc-options: -Wall -Wcompat -with-rtsopts=-K1K
   cpp-options: -DTEST
   build-depends:
       HUnit
@@ -213,7 +210,7 @@
     , directory
     , filepath
     , hspec >=1.3
-    , libyaml >=0.1 && <0.2
+    , libyaml ==0.1.*
     , mockery
     , mtl
     , raw-strings-qq
@@ -226,7 +223,4 @@
     , unordered-containers
     , vector
     , yaml
-  if !impl(ghc >= 8.0)
-    build-depends:
-        semigroups
   default-language: Haskell2010

Reply via email to