packages feed

packdeps 0.4.0.1 → 0.4.0.2

raw patch · 2 files changed

+18/−8 lines, 2 filesdep ~Cabal

Dependency ranges changed: Cabal

Files

Distribution/PackDeps.hs view
@@ -40,7 +40,7 @@ import Distribution.Version import Distribution.Text -import Data.Char (toLower)+import Data.Char (toLower, isSpace) import qualified Data.Text.Lazy as T import qualified Data.Text.Lazy.Encoding as T import qualified Data.Text.Encoding.Error as T@@ -61,14 +61,24 @@     c <- getAppUserDataDirectory "cabal"     cfg <- readFile (c </> "config")     let repos        = reposFromConfig cfg-        tarName repo = c </> "packages" </> repo </> "00-index.tar"+        repoCache    = case lookupInConfig "remote-repo-cache" cfg of+            []        -> c </> "packages"  -- Default+            (rrc : _) -> rrc               -- User-specified+        tarName repo = repoCache </> repo </> "00-index.tar"     fmap (Map.unionsWith maxVersion) . mapM (loadNewestFrom . tarName) $ repos  reposFromConfig :: String -> [String]-reposFromConfig = map (takeWhile (/= ':'))-                . catMaybes-                . map (dropPrefix "remote-repo: ")-                . lines+reposFromConfig = map (takeWhile (/= ':')) . lookupInConfig "remote-repo"++-- | Looks up the given key in the cabal configuration file+lookupInConfig :: String -> String -> [String]+lookupInConfig key = map trim . catMaybes . map (dropPrefix prefix) . lines+  where+    prefix = key ++ ":"++-- | Utility: drop leading and trailing spaces from a string+trim :: String -> String+trim = reverse . dropWhile isSpace . reverse . dropWhile isSpace  dropPrefix :: (Eq a) => [a] -> [a] -> Maybe [a] dropPrefix prefix s =
packdeps.cabal view
@@ -1,5 +1,5 @@ name:            packdeps-version:         0.4.0.1+version:         0.4.0.2 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -21,7 +21,7 @@                    , split                     >= 0.1.2.3                    , bytestring                >= 0.9                    , text                      >= 0.7-                   , Cabal                     >= 1.8      && < 1.17+                   , Cabal                     >= 1.8                    , time                      >= 1.1.4                    , containers                >= 0.2                    , directory                 >= 1.0