debian 3.93.3 → 3.93.5
raw patch · 4 files changed
+62/−23 lines, 4 files
Files
- Debian/URI.hs +31/−22
- changelog +18/−0
- debian.cabal +1/−1
- debian/changelog +12/−0
Debian/URI.hs view
@@ -1,5 +1,6 @@-{-# LANGUAGE PackageImports #-}-{-# OPTIONS -fno-warn-orphans #-}+{-# LANGUAGE CPP, PackageImports #-}+{-# OPTIONS -Wall -fno-warn-orphans #-}+ module Debian.URI ( module Network.URI , URI'@@ -12,14 +13,22 @@ , dirFromURI ) where -import Control.Exception (SomeException, try)+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<$>))+#endif+import Control.Exception (SomeException, throw, try) import Data.ByteString.Lazy.UTF8 as L import qualified Data.ByteString.Lazy.Char8 as L import Data.Maybe (catMaybes, fromJust)+import Data.Text as T (unpack)+import Data.Text.Encoding (decodeUtf8) import Network.URI (URI(..), URIAuth(..), parseURI, uriToString) import System.Directory (getDirectoryContents)+import System.Exit (ExitCode(..)) -- import System.Process.ByteString (readProcessWithExitCode)-import System.Process.ByteString.Lazy (readProcessWithExitCode)+import System.Process (CreateProcess, proc)+import System.Process.Common (showCreateProcessForUser)+import System.Process.ByteString.Lazy (readCreateProcessWithExitCode) import Text.Regex (mkRegex, matchRegex) -- | A wrapper around a String containing a known parsable URI. Not@@ -50,16 +59,10 @@ case (uriScheme uri, uriAuthority uri) of ("file:", Nothing) -> L.readFile (uriPath uri) -- ("ssh:", Just auth) -> cmdOutputStrict ("ssh " ++ uriUserInfo auth ++ uriRegName auth ++ uriPort auth ++ " cat " ++ show (uriPath uri))- ("ssh:", Just auth) -> do- let cmd = "ssh"- args = [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "cat", uriPath uri]- (_code, out, _err) <- readProcessWithExitCode cmd args L.empty- return out- _ -> do- let cmd = "curl"- args = ["-s", "-g", uriToString' uri]- (_code, out, _err) <- readProcessWithExitCode cmd args L.empty- return out+ ("ssh:", Just auth) ->+ run (proc "ssh" [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "cat", uriPath uri])+ _ ->+ run (proc "curl" ["-s", "-g", uriToString' uri]) -- | Parse the text returned when a directory is listed by a web -- server. This is currently only known to work with Apache.@@ -79,12 +82,18 @@ case (uriScheme uri, uriAuthority uri) of ("file:", Nothing) -> getDirectoryContents (uriPath uri) ("ssh:", Just auth) ->- do let cmd = "ssh"- args = [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "ls", "-1", uriPath uri]- (_code, out, _err) <- readProcessWithExitCode cmd args L.empty- return . Prelude.lines . L.toString $ out+ (Prelude.lines . L.toString) <$>+ run (proc "ssh" [uriUserInfo auth ++ uriRegName auth ++ uriPort auth, "ls", "-1", uriPath uri]) _ ->- do let cmd = "curl"- args = ["-s", "-g", uriToString' uri]- (_code, out, _err) <- readProcessWithExitCode cmd args L.empty- return . webServerDirectoryContents $ out+ webServerDirectoryContents <$>+ run (proc "curl" ["-s", "-g", uriToString' uri])++run :: CreateProcess -> IO L.ByteString+run cp = do+ (code, out, err) <- readCreateProcessWithExitCode cp L.empty+ case code of+ ExitSuccess -> return out+ ExitFailure _ -> throw (userError (show code ++ "\n" +++ " command: " ++ showCreateProcessForUser cp ++ "\n" +++ " stderr: " ++ unpack (decodeUtf8 (L.toStrict err)) ++ "\n" +++ " stdout: " ++ unpack (decodeUtf8 (L.toStrict out))))
changelog view
@@ -1,3 +1,21 @@+haskell-debian (3.93.5) unstable; urgency=medium++ * Restore import of <$> for older versions of base.++ -- David Fox <dsf@x1> Fri, 18 Jan 2019 19:04:40 -0800++haskell-debian (3.93.4) unstable; urgency=medium++ * Handle errors in the shell commands run by functions in Debian.URI++ -- David Fox <dsf@seereason.com> Fri, 18 Jan 2019 06:25:22 -0800++haskell-debian (3.93.3) unstable; urgency=medium++ * Changes for ghc-8.6++ -- David Fox <dsf@seereason.com> Tue, 01 Jan 2019 15:57:16 -0800+ haskell-debian (3.93.2) unstable; urgency=low * Put SHA256 checksums into package info rather than obsolete md5
debian.cabal view
@@ -1,5 +1,5 @@ Name: debian-Version: 3.93.3+Version: 3.93.5 License: BSD3 License-File: debian/copyright Author: David Fox <dsf@seereason.com>, Jeremy Shaw <jeremy@seereason.com>, Clifford Beshers <beshers@seereason.com>
debian/changelog view
@@ -1,3 +1,15 @@+haskell-debian (3.93.5) unstable; urgency=medium++ * Restore import of <$> for older versions of base.++ -- David Fox <dsf@x1> Fri, 18 Jan 2019 19:04:40 -0800++haskell-debian (3.93.4) unstable; urgency=medium++ * Handle errors in the shell commands run by functions in Debian.URI++ -- David Fox <dsf@seereason.com> Fri, 18 Jan 2019 06:25:22 -0800+ haskell-debian (3.93.3) unstable; urgency=medium * Changes for ghc-8.6