Changed to use IO Exceptions
This commit is contained in:
parent
5d43168370
commit
3fd9fae66a
@ -888,17 +888,18 @@ applyPatches :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m)
|
|||||||
-> FilePath -- ^ dir to apply patches in
|
-> FilePath -- ^ dir to apply patches in
|
||||||
-> Excepts '[PatchFailed] m ()
|
-> Excepts '[PatchFailed] m ()
|
||||||
applyPatches pdir ddir = do
|
applyPatches pdir ddir = do
|
||||||
seriesExists <- liftIO (doesFileExist (pdir </> "series"))
|
let lexicographical = (fmap . fmap) (pdir </>) $ sort <$> findFiles
|
||||||
patches <- if seriesExists
|
|
||||||
then
|
|
||||||
liftIO $ map (pdir </>) . lines <$> readFile (pdir </> "series")
|
|
||||||
else
|
|
||||||
(fmap . fmap) (pdir </>) $ liftIO $ sort <$> findFiles
|
|
||||||
pdir
|
pdir
|
||||||
(makeRegexOpts compExtended
|
(makeRegexOpts compExtended
|
||||||
execBlank
|
execBlank
|
||||||
([s|.+\.(patch|diff)$|] :: ByteString)
|
([s|.+\.(patch|diff)$|] :: ByteString)
|
||||||
)
|
)
|
||||||
|
let quilt = map (pdir </>) . lines <$> readFile (pdir </> "series")
|
||||||
|
|
||||||
|
patches <- liftIO $ quilt `catchIO` (\e ->
|
||||||
|
if isDoesNotExistError e || isPermissionError e then
|
||||||
|
lexicographical
|
||||||
|
else throwIO e)
|
||||||
forM_ patches $ \patch' -> applyPatch patch' ddir
|
forM_ patches $ \patch' -> applyPatch patch' ddir
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user