Hello community, here is the log from the commit of package ghc-fsnotify for openSUSE:Factory checked in at 2018-05-30 12:07:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-fsnotify (Old) and /work/SRC/openSUSE:Factory/.ghc-fsnotify.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-fsnotify" Wed May 30 12:07:55 2018 rev:3 rq:607801 version:0.2.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-fsnotify/ghc-fsnotify.changes 2016-07-21 08:12:34.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-fsnotify.new/ghc-fsnotify.changes 2018-05-30 12:25:44.545465729 +0200 @@ -1,0 +2,7 @@ +Mon May 14 17:02:11 UTC 2018 - psim...@suse.com + +- Update fsnotify to version 0.2.1.2. + * Update to the new hinotify API (v0.3.10) + * Catch IO exceptions when initialising inotify on Linux + +------------------------------------------------------------------- Old: ---- fsnotify-0.2.1.tar.gz New: ---- fsnotify-0.2.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-fsnotify.spec ++++++ --- /var/tmp/diff_new_pack.I3iWRE/_old 2018-05-30 12:25:45.253442231 +0200 +++ /var/tmp/diff_new_pack.I3iWRE/_new 2018-05-30 12:25:45.257442099 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-fsnotify # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 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,16 +19,16 @@ %global pkg_name fsnotify %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.2.1 +Version: 0.2.1.2 Release: 0 Summary: Cross platform library for file change notification License: BSD-3-Clause -Group: System/Libraries -Url: https://hackage.haskell.org/package/%{pkg_name} +Group: Development/Libraries/Haskell +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 -# Begin cabal-rpm deps: BuildRequires: ghc-async-devel +BuildRequires: ghc-bytestring-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-directory-devel BuildRequires: ghc-filepath-devel @@ -37,13 +37,11 @@ BuildRequires: ghc-text-devel BuildRequires: ghc-time-devel BuildRequires: ghc-unix-compat-devel -BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with tests} BuildRequires: ghc-tasty-devel BuildRequires: ghc-tasty-hunit-devel -BuildRequires: ghc-temporary-rc-devel +BuildRequires: ghc-temporary-devel %endif -# End cabal-rpm deps %description Cross platform library for file creation, modification, and deletion @@ -52,7 +50,7 @@ %package devel Summary: Haskell %{pkg_name} library development files -Group: Development/Libraries/Other +Group: Development/Libraries/Haskell Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} Requires(post): ghc-compiler = %{ghc_version} @@ -64,20 +62,14 @@ %prep %setup -q -n %{pkg_name}-%{version} - %build %ghc_lib_build - %install %ghc_lib_install - %check -%if %{with tests} -%{cabal} test -%endif - +%cabal_test %post devel %ghc_pkg_recache @@ -86,11 +78,9 @@ %ghc_pkg_recache %files -f %{name}.files -%defattr(-,root,root,-) -%doc LICENSE +%license LICENSE %files devel -f %{name}-devel.files -%defattr(-,root,root,-) %doc CHANGELOG.md README.md %changelog ++++++ fsnotify-0.2.1.tar.gz -> fsnotify-0.2.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fsnotify-0.2.1/CHANGELOG.md new/fsnotify-0.2.1.2/CHANGELOG.md --- old/fsnotify-0.2.1/CHANGELOG.md 2015-07-25 22:37:11.000000000 +0200 +++ new/fsnotify-0.2.1.2/CHANGELOG.md 2018-04-23 20:05:50.000000000 +0200 @@ -1,6 +1,21 @@ Changes ======= +Version 0.2.1.2 +--------------- + +Update to the new hinotify API (v0.3.10) + +Version 0.2.1.1 +--------------- + +Catch IO exceptions when initialising inotify on Linux + +Version 0.2.1 +------------- + +Don't use `system-filepath` + Version 0.2 ----------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fsnotify-0.2.1/fsnotify.cabal new/fsnotify-0.2.1.2/fsnotify.cabal --- old/fsnotify-0.2.1/fsnotify.cabal 2015-07-30 08:11:47.000000000 +0200 +++ new/fsnotify-0.2.1.2/fsnotify.cabal 2018-04-23 20:06:00.000000000 +0200 @@ -1,5 +1,5 @@ Name: fsnotify -Version: 0.2.1 +Version: 0.2.1.2 Author: Mark Dittmer <mark.s.ditt...@gmail.com> Maintainer: Greg Weber <g...@gregweber.info>, Roman Cheplyaka <r...@ro-che.info> License: BSD3 @@ -22,6 +22,7 @@ Library Build-Depends: base >= 4.3.1 && < 5 + , bytestring >= 0.10.2 , containers >= 0.4 , directory >= 1.1.0.0 , filepath >= 1.3.0.0 @@ -40,7 +41,7 @@ if os(linux) CPP-Options: -DOS_Linux Other-Modules: System.FSNotify.Linux - Build-Depends: hinotify >= 0.3.7 + Build-Depends: hinotify >= 0.3.10 else if os(windows) CPP-Options: -DOS_Win32 @@ -66,7 +67,7 @@ , unix-compat , fsnotify , async >= 2 - , temporary-rc + , temporary Source-Repository head Type: git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fsnotify-0.2.1/src/System/FSNotify/Linux.hs new/fsnotify-0.2.1.2/src/System/FSNotify/Linux.hs --- old/fsnotify-0.2.1/src/System/FSNotify/Linux.hs 2015-07-25 22:33:31.000000000 +0200 +++ new/fsnotify-0.2.1.2/src/System/FSNotify/Linux.hs 2018-04-23 20:02:36.000000000 +0200 @@ -3,6 +3,7 @@ -- Developed for a Google Summer of Code project - http://gsoc2012.markdittmer.org -- {-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module System.FSNotify.Linux @@ -12,14 +13,18 @@ import Prelude hiding (FilePath) + import Control.Concurrent.Chan import Control.Concurrent.MVar -import Control.Exception +import Control.Exception as E import Control.Monad (when) +import qualified Data.ByteString as BS import Data.IORef (atomicModifyIORef, readIORef) import Data.Time.Clock (UTCTime, getCurrentTime) import Data.Typeable -- import Debug.Trace (trace) +import qualified GHC.Foreign as F +import GHC.IO.Encoding (getFileSystemEncoding) import System.FilePath import System.FSNotify.Listener import System.FSNotify.Path (findDirs, canonicalizeDirPath) @@ -31,21 +36,43 @@ data EventVarietyMismatchException = EventVarietyMismatchException deriving (Show, Typeable) instance Exception EventVarietyMismatchException +toRawFilePath :: FilePath -> IO BS.ByteString +toRawFilePath fp = do + enc <- getFileSystemEncoding + F.withCString enc fp BS.packCString + +fromRawFilePath :: BS.ByteString -> IO FilePath +fromRawFilePath bs = do + enc <- getFileSystemEncoding + BS.useAsCString bs (F.peekCString enc) + -- Note that INo.Closed in this context is "modified" because we listen to -- CloseWrite events. -fsnEvent :: FilePath -> UTCTime -> INo.Event -> Maybe Event -fsnEvent basePath timestamp (INo.Created False name ) = Just (Added (basePath </> name) timestamp) -fsnEvent basePath timestamp (INo.Closed False (Just name) _) = Just (Modified (basePath </> name) timestamp) -fsnEvent basePath timestamp (INo.MovedOut False name _) = Just (Removed (basePath </> name) timestamp) -fsnEvent basePath timestamp (INo.MovedIn False name _) = Just (Added (basePath </> name) timestamp) -fsnEvent basePath timestamp (INo.Deleted False name ) = Just (Removed (basePath </> name) timestamp) -fsnEvent _ _ _ = Nothing +fsnEvent :: FilePath -> UTCTime -> INo.Event -> IO (Maybe Event) +fsnEvent basePath timestamp event = case event of + INo.Created False raw -> do + name <- fromRawFilePath raw + return $ Just (Added (basePath </> name) timestamp) + INo.Closed False (Just raw) _ -> do + name <- fromRawFilePath raw + return $ Just (Modified (basePath </> name) timestamp) + INo.MovedOut False raw _ -> do + name <- fromRawFilePath raw + return $ Just (Removed (basePath </> name) timestamp) + INo.MovedIn False raw _ -> do + name <- fromRawFilePath raw + return $ Just (Added (basePath </> name) timestamp) + INo.Deleted False raw -> do + name <- fromRawFilePath raw + return $ Just (Removed (basePath </> name) timestamp) + _ -> + return Nothing handleInoEvent :: ActionPredicate -> EventChannel -> FilePath -> DebouncePayload -> INo.Event -> IO () -- handleInoEvent _ _ basePath _ inoEvent | trace ("Linux: handleInoEvent " ++ show basePath ++ " " ++ show inoEvent) False = undefined handleInoEvent actPred chan basePath dbp inoEvent = do currentTime <- getCurrentTime - let maybeFsnEvent = fsnEvent basePath currentTime inoEvent + maybeFsnEvent <- fsnEvent basePath currentTime inoEvent handleEvent actPred chan dbp maybeFsnEvent handleEvent :: ActionPredicate -> EventChannel -> DebouncePayload -> Maybe Event -> IO () @@ -66,14 +93,15 @@ varieties = [INo.Create, INo.Delete, INo.MoveIn, INo.MoveOut, INo.CloseWrite] instance FileListener INo.INotify where - initSession = fmap Just INo.initINotify + initSession = E.catch (fmap Just INo.initINotify) (\(_ :: IOException) -> return Nothing) killSession = INo.killINotify listen conf iNotify path actPred chan = do path' <- canonicalizeDirPath path dbp <- newDebouncePayload $ confDebounce conf - wd <- INo.addWatch iNotify varieties path' (handler path' dbp) + rawPath <- toRawFilePath path' + wd <- INo.addWatch iNotify varieties rawPath (handler path' dbp) return $ INo.removeWatch wd where handler :: FilePath -> DebouncePayload -> INo.Event -> IO () @@ -110,17 +138,19 @@ pathHandler :: MVar (Maybe [INo.WatchDescriptor]) -> FilePath -> IO () pathHandler wdVar filePath = do dbp <- newDebouncePayload $ confDebounce conf + rawFilePath <- toRawFilePath filePath modifyMVar_ wdVar $ \mbWds -> -- Atomically add a watch and record its descriptor. Also, check -- if the listening task is cancelled, in which case do nothing. case mbWds of Nothing -> return mbWds Just wds -> do - wd <- INo.addWatch iNotify varieties filePath (handler filePath dbp) + wd <- INo.addWatch iNotify varieties rawFilePath (handler filePath dbp) return $ Just (wd:wds) where handler :: FilePath -> DebouncePayload -> INo.Event -> IO () - handler baseDir _ (INo.Created True dirPath) = do + handler baseDir _ (INo.Created True rawDirPath) = do + dirPath <- fromRawFilePath rawDirPath listenRec (baseDir </> dirPath) wdVar handler baseDir dbp event = handleInoEvent actPred chan baseDir dbp event