aur 6.0.0.1 → 6.1.0
raw patch · 6 files changed
+102/−78 lines, 6 filesdep +errorsdep ~aesondep ~basedep ~servantPVP ok
version bump matches the API change (PVP)
Dependencies added: errors
Dependency ranges changed: aeson, base, servant, servant-client, tasty, tasty-hunit, text
API changes (from Hackage documentation)
+ Linux.Arch.Aur.Types: instance Data.Aeson.Types.ToJSON.ToJSON Linux.Arch.Aur.Types.AurInfo
- Linux.Arch.Aur.Rpc: info :: MonadIO m => Manager -> [Text] -> m [AurInfo]
+ Linux.Arch.Aur.Rpc: info :: Manager -> [Text] -> IO (Maybe [AurInfo])
- Linux.Arch.Aur.Rpc: search :: MonadIO m => Manager -> Text -> m [AurInfo]
+ Linux.Arch.Aur.Rpc: search :: Manager -> Text -> IO (Maybe [AurInfo])
Files
- CHANGELOG.md +8/−0
- Linux/Arch/Aur/Rpc.hs +11/−12
- Linux/Arch/Aur/Types.hs +26/−2
- README.md +3/−0
- aur.cabal +51/−61
- tests/Test.hs +3/−3
+ CHANGELOG.md view
@@ -0,0 +1,8 @@+# Changelog++## 6.1.0++- RPC functions now return in `Maybe`, for occasions where connection to the AUR+ was impossible. Previously, that case would result in an empty list.+- RPC functions now return in a monomorphized `IO`, instead of the previous+ polymorphic `MonadIO`.
Linux/Arch/Aur/Rpc.hs view
@@ -1,19 +1,16 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TypeOperators #-}-{-# LANGUAGE DataKinds #-}+{-# LANGUAGE OverloadedStrings, TypeOperators, DataKinds #-} -- | -- Module : Linux.Arch.Aur.Rpc--- Copyright : (c) Colin Woodbury, 2014, 2015, 2016+-- Copyright : (c) Colin Woodbury, 2014 - 2018 -- License : GPL3--- Maintainer: Colin Woodbury <colingw@gmail.com>+-- Maintainer: Colin Woodbury <colin@fosskers.ca> -- -- See https://aur.archlinux.org/rpc for details. -module Linux.Arch.Aur.Rpc- ( info, search ) where+module Linux.Arch.Aur.Rpc ( info, search ) where -import Control.Monad.IO.Class (MonadIO, liftIO)+import Control.Error.Util (hush) import Data.Proxy import Data.Text (Text) import Linux.Arch.Aur.Types@@ -45,12 +42,14 @@ rpcI :<|> rpcS = client api -- | Perform an @info@ call on one or more package names.-info :: MonadIO m => Manager -> [Text] -> m [AurInfo]+-- Will fail with a `Nothing` if there was a connection/decoding error.+info :: Manager -> [Text] -> IO (Maybe [AurInfo]) info m ps = unwrap m $ rpcI (Just "5") (Just "info") ps -- | Perform a @search@ call on a package name or description text.-search :: MonadIO m => Manager -> Text -> m [AurInfo]+-- Will fail with a `Nothing` if there was a connection/decoding error.+search :: Manager -> Text -> IO (Maybe [AurInfo]) search m p = unwrap m $ rpcS (Just "5") (Just "search") (Just p) -unwrap :: MonadIO m => Manager -> ClientM RPCResp -> m [AurInfo]-unwrap m r = liftIO . fmap (either (const []) _results) $ runClientM r (ClientEnv m url)+unwrap :: Manager -> ClientM RPCResp -> IO (Maybe [AurInfo])+unwrap m r = fmap _results . hush <$> runClientM r (ClientEnv m url Nothing)
Linux/Arch/Aur/Types.hs view
@@ -2,9 +2,9 @@ -- | -- Module : Linux.Arch.Aur.Types--- Copyright : (c) Colin Woodbury, 2014, 2015, 2016+-- Copyright : (c) Colin Woodbury, 2014 - 2018 -- License : GPL3--- Maintainer: Colin Woodbury <colingw@gmail.com>+-- Maintainer: Colin Woodbury <colin@fosskers.ca> module Linux.Arch.Aur.Types ( RPCResp(..)@@ -79,3 +79,27 @@ v .:? "Keywords" .!= [] parseJSON _ = mzero++instance ToJSON AurInfo where+ toJSON ai = object+ [ "ID" .= aurIdOf ai+ , "Name" .= aurNameOf ai+ , "PackageBaseID" .= pkgBaseIdOf ai+ , "PackageBase" .= pkgBaseOf ai+ , "Version" .= aurVersionOf ai+ , "Description" .= aurDescriptionOf ai+ , "URL" .= urlOf ai+ , "NumVotes" .= aurVotesOf ai+ , "Popularity" .= popularityOf ai+ , "OutOfDate" .= dateObsoleteOf ai+ , "Maintainer" .= aurMaintainerOf ai+ , "FirstSubmitted" .= submissionDateOf ai+ , "LastModified" .= modifiedDateOf ai+ , "URLPath" .= urlPathOf ai+ , "Depends" .= dependsOf ai+ , "MakeDepends" .= makeDepsOf ai+ , "OptDepends" .= optDepsOf ai+ , "Conflicts" .= conflictsOf ai+ , "Provides" .= providesOf ai+ , "License" .= licenseOf ai+ , "Keywords" .= keywordsOf ai ]
+ README.md view
@@ -0,0 +1,3 @@+# haskell-aur++Access metadata from the Arch Linux User Repository.
aur.cabal view
@@ -1,68 +1,58 @@-name: aur--version: 6.0.0.1--synopsis: Access metadata from the Arch Linux User Repository.--homepage: https://github.com/fosskers/haskell-aur--license: GPL-3--license-file: LICENSE--author: Colin Woodbury--maintainer: colingw@gmail.com--category: Linux--build-type: Simple--cabal-version: >=1.10+cabal-version: 1.12 -description: Access package information from Arch Linux's AUR via its- RPC interface. The main exposed functions reflect- those of the RPC:- .- * info: Get metadata for one package.- .- * search: Get limited metadata for packages that- match a given regex.- .- By default this library supports version 5 of the RPC,- and hence version 4.2+ of the AUR.+-- This file has been generated from package.yaml by hpack version 0.30.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 9af215c031bd05af2173f07269067c3c3a903e8f9227649fdf2f833699c8f4e8 -source-repository head- type: git- location: git://github.com/aurapm/haskell-aur.git+name: aur+version: 6.1.0+synopsis: Access metadata from the Arch Linux User Repository.+description: Access package information from Arch Linux\'s AUR via its RPC interface. The main exposed functions reflect those of the RPC.+ `info` gets metadata for one package. `search` gets limited metadata for packages that match a given regex.+ By default this library supports version 5 of the RPC, and hence version 4.2+ of the AUR.+category: Linux+homepage: https://github.com/aurapm/aura+author: Colin Woodbury+maintainer: colin@fosskers.ca+copyright: 2018 Colin Woodbury+license: GPL-3+license-file: LICENSE+build-type: Simple+extra-source-files:+ README.md+ CHANGELOG.md library- exposed-modules: Linux.Arch.Aur,- Linux.Arch.Aur.Rpc,- Linux.Arch.Aur.Types-+ exposed-modules:+ Linux.Arch.Aur+ Linux.Arch.Aur.Rpc+ Linux.Arch.Aur.Types+ hs-source-dirs:+ ./.+ ghc-options: -fwarn-unused-imports -fwarn-unused-binds -fwarn-name-shadowing -fwarn-unused-matches -fwarn-incomplete-patterns -fwarn-redundant-constraints -Wincomplete-uni-patterns build-depends:- base >= 4.8 && < 4.10- , aeson >= 0.9 && < 1.2- , http-client >= 0.5 && < 0.6- , servant >= 0.9 && < 0.12- , servant-client >= 0.9 && < 0.12- , text >= 1.2 && < 1.3-- default-language: Haskell2010-- ghc-options: -fwarn-unused-imports+ aeson >=0.9 && <1.4+ , base >=4.10 && <4.12+ , errors >=2.3 && <2.4+ , http-client >=0.5 && <0.6+ , servant >=0.9 && <0.15+ , servant-client >=0.13 && <0.15+ , text+ default-language: Haskell2010 test-suite aur-test- type: exitcode-stdio-1.0-- build-depends: aur- , base >= 4.8 && < 4.10- , tasty >= 0.11 && < 0.12- , tasty-hunit >= 0.9 && < 0.10- , http-client >= 0.5 && < 0.6- , http-client-tls >= 0.3 && < 0.4-- hs-source-dirs: tests- main-is: Test.hs- default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Test.hs+ hs-source-dirs:+ tests+ ghc-options: -fwarn-unused-imports -fwarn-unused-binds -fwarn-name-shadowing -fwarn-unused-matches -fwarn-incomplete-patterns -fwarn-redundant-constraints -Wincomplete-uni-patterns -threaded -with-rtsopts=-N+ build-depends:+ aur+ , base >=4.10 && <4.12+ , http-client >=0.5 && <0.6+ , http-client-tls >=0.3 && <0.4+ , tasty >=0.11 && <2.0+ , tasty-hunit >=0.9 && <0.11+ default-language: Haskell2010
tests/Test.hs view
@@ -18,13 +18,13 @@ ] infoTest :: Manager -> Assertion-infoTest m = info m ["aura"] >>= assert . not . null+infoTest m = info m ["aura"] >>= \x -> (not . null <$> x) @?= Just True infoTest' :: Manager -> Assertion-infoTest' m = info m ["aura1234567"] >>= assert . null+infoTest' m = info m ["aura1234567"] >>= \x -> (null <$> x) @?= Just True searchTest :: Manager -> Assertion-searchTest m = search m "aura" >>= assert . not . null+searchTest m = search m "aura" >>= assertBool "Good search" . not . null main :: IO () main = do