Hello community,

here is the log from the commit of package ghc-yaml for openSUSE:Factory 
checked in at 2017-02-22 13:54:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-yaml (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-yaml.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-yaml"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-yaml/ghc-yaml.changes        2017-01-12 
15:53:12.433777668 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-yaml.new/ghc-yaml.changes   2017-02-22 
13:54:03.335868047 +0100
@@ -1,0 +2,5 @@
+Mon Jan 30 09:29:22 UTC 2017 - [email protected]
+
+- Update to version 0.8.21.2 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  yaml-0.8.21.1.tar.gz

New:
----
  yaml-0.8.21.2.tar.gz

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

Other differences:
------------------
++++++ ghc-yaml.spec ++++++
--- /var/tmp/diff_new_pack.C4OvGf/_old  2017-02-22 13:54:04.071763335 +0100
+++ /var/tmp/diff_new_pack.C4OvGf/_new  2017-02-22 13:54:04.075762766 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-yaml
 #
-# 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 yaml
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.8.21.1
+Version:        0.8.21.2
 Release:        0
 Summary:        Support for parsing and rendering YAML documents
 License:        BSD-3-Clause

++++++ yaml-0.8.21.1.tar.gz -> yaml-0.8.21.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.8.21.1/ChangeLog.md 
new/yaml-0.8.21.2/ChangeLog.md
--- old/yaml-0.8.21.1/ChangeLog.md      2016-11-29 10:43:02.000000000 +0100
+++ new/yaml-0.8.21.2/ChangeLog.md      2017-01-25 12:17:27.000000000 +0100
@@ -1,3 +1,7 @@
+## 0.8.21.2
+
+* Fix wrong file not found exception in `Data.Yaml.Include` with pre-1.2.3.0 
`directory` [#104](https://github.com/snoyberg/yaml/pull/104)
+
 ## 0.8.21.1
 
 * Add missing test files [#102](https://github.com/snoyberg/yaml/pull/102)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.8.21.1/Data/Yaml/Include.hs 
new/yaml-0.8.21.2/Data/Yaml/Include.hs
--- old/yaml-0.8.21.1/Data/Yaml/Include.hs      2016-11-29 10:43:02.000000000 
+0100
+++ new/yaml-0.8.21.2/Data/Yaml/Include.hs      2017-01-25 12:17:27.000000000 
+0100
@@ -1,6 +1,13 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE RankNTypes #-}
 module Data.Yaml.Include (decodeFile, decodeFileEither) where
 
+#if !MIN_VERSION_directory(1, 2, 3)
+import Control.Exception (handleJust)
+import Control.Monad (guard)
+import System.IO.Error (ioeGetFileName, ioeGetLocation, isDoesNotExistError)
+#endif
+
 import Control.Exception (throwIO)
 import Control.Monad (when)
 import Control.Monad.IO.Class (liftIO)
@@ -25,7 +32,7 @@
   where
     go :: MonadResource m => [FilePath] -> FilePath -> Producer m Event
     go seen fp = do
-        cfp <- liftIO $ canonicalizePath fp
+        cfp <- liftIO $ handleNotFound $ canonicalizePath fp
         when (cfp `elem` seen) $ do
             liftIO $ throwIO CyclicIncludes
         Y.decodeFile cfp $= do
@@ -37,6 +44,17 @@
 
     irrelevantEvents = [EventStreamStart, EventDocumentStart, 
EventDocumentEnd, EventStreamEnd]
 
+#if !MIN_VERSION_directory(1, 2, 3)
+    handleNotFound = handleJust
+        (\e -> do
+            guard (isDoesNotExistError e)
+            guard (ioeGetLocation e == "canonicalizePath")
+            ioeGetFileName e)
+        (throwIO . YamlException . ("Yaml file not found: " ++))
+#else
+    handleNotFound = id
+#endif
+
 -- | Like `Data.Yaml.decodeFile` but with support for relative and absolute
 -- includes.
 --
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.8.21.1/test/Data/Yaml/IncludeSpec.hs 
new/yaml-0.8.21.2/test/Data/Yaml/IncludeSpec.hs
--- old/yaml-0.8.21.1/test/Data/Yaml/IncludeSpec.hs     2016-11-29 
10:43:02.000000000 +0100
+++ new/yaml-0.8.21.2/test/Data/Yaml/IncludeSpec.hs     2017-01-25 
12:17:27.000000000 +0100
@@ -2,12 +2,12 @@
 module Data.Yaml.IncludeSpec (main, spec) where
 
 import           Test.Hspec
-import           Data.Either.Compat
+import           Data.List (isPrefixOf)
 import           Data.Aeson
 import           Data.Aeson.QQ
-import           Data.Yaml (ParseException)
-
+import           Data.Yaml (ParseException(InvalidYaml))
 import           Data.Yaml.Include
+import           Text.Libyaml (YamlException(YamlException))
 
 main :: IO ()
 main = hspec spec
@@ -38,7 +38,17 @@
     it "aborts on cyclic includes" $ do
       (decodeFile "test/resources/loop/foo.yaml" :: IO (Maybe Value)) 
`shouldThrow` anyException
 
+    context "when file does not exist" $ do
+      it "throws Left (InvalidYaml (Just (YamlException \"Yaml file not found: 
...\")))" $ do
+        (decodeFile "./does_not_exist.yaml" :: IO (Maybe Value)) `shouldThrow` 
isYamlFileNotFoundException
+
   describe "decodeFileEither" $ do
     context "when file does not exist" $ do
-      it "returns Left" $ do
-        (decodeFileEither "./does_not_exist.yaml" :: IO (Either ParseException 
Value)) >>= (`shouldSatisfy` isLeft)
+      it "returns Left (InvalidYaml (Just (YamlException \"Yaml file not 
found: ...\")))" $ do
+        (decodeFileEither "./does_not_exist.yaml" :: IO (Either ParseException 
Value)) >>=
+          (`shouldSatisfy` either isYamlFileNotFoundException (const False))
+
+isYamlFileNotFoundException :: ParseException -> Bool
+isYamlFileNotFoundException (InvalidYaml (Just (YamlException msg)))
+  | "Yaml file not found: " `isPrefixOf` msg = True
+isYamlFileNotFoundException _ = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yaml-0.8.21.1/yaml.cabal new/yaml-0.8.21.2/yaml.cabal
--- old/yaml-0.8.21.1/yaml.cabal        2016-11-29 10:43:02.000000000 +0100
+++ new/yaml-0.8.21.2/yaml.cabal        2017-01-25 12:17:27.000000000 +0100
@@ -1,5 +1,5 @@
 name:            yaml
-version:         0.8.21.1
+version:         0.8.21.2
 license:         BSD3
 license-file:    LICENSE
 author:          Michael Snoyman <[email protected]>, Anton Ageev 
<[email protected]>,Kirill Simonov


Reply via email to