packages feed

hackage-db 2.1.2 → 2.1.3

raw patch · 4 files changed

+62/−11 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,26 @@ # Revision history for hackage-db +## 2.1.3++* `hackageTarball` / `cabalStateDir` now support overriding the cabal directory+  location by setting the `CABAL_DIR` environment variable. This is useful if+  `hackage-db` doesn't detect the correct location on its own:++  - A matching cabal state directory may exist, but should not be used for some+    reason.++  - A non-standard cabal state directory may be used, but `hackage-db` can't+    find it (as it doesn't check the `cabal-install` configuration file).++* `hackageTarball` now supports all state dir location(s) (newly) supported by+  `cabal-install`. If `CABAL_DIR` is not set, it will look in the following+  locations in that order:++  1. `$HOME/.cabal`, the classic location, will be preferred if it exists.+  2. `$XDG_CACHE_HOME/cabal` (usually `$HOME/.cache/cabal`) is used otherwise.+     `cabal-install` 3.10.1.0 and newer will default to this location for+     fresh installations.+ ## 2.1.2  Fix a bug which lead to `parsePackageData` always failing if the package had
README.md view
@@ -4,4 +4,4 @@ [![hackage release](https://img.shields.io/hackage/v/hackage-db.svg?label=hackage)](http://hackage.haskell.org/package/hackage-db) [![stackage LTS package](http://stackage.org/package/hackage-db/badge/lts)](http://stackage.org/lts/package/hackage-db) [![stackage Nightly package](http://stackage.org/package/hackage-db/badge/nightly)](http://stackage.org/nightly/package/hackage-db)-![Continous Integration](https://github.com/NixOS/hackage-db/workflows/Haskell-CI/badge.svg)+![Continous Integration](https://github.com/NixOS/cabal2nix/workflows/Haskell-CI/badge.svg)
hackage-db.cabal view
@@ -1,5 +1,5 @@ name:          hackage-db-version:       2.1.2+version:       2.1.3 synopsis:      Access cabal-install's Hackage database via Data.Map description:   This library provides convenient access to the local copy of the Hackage                database that \"cabal update\" creates. Check out@@ -8,11 +8,11 @@ license:       BSD3 license-file:  LICENSE author:        Peter Simons, Alexander Altman, Ben James, Kevin Quick-maintainer:    Peter Simons <simons@cryp.to>-tested-with:   GHC == 8.8.4 || == 8.10.4 || == 9.0.1+maintainer:    sternenseemann <sternenseemann@systemli.org>+tested-with:   GHC == 8.8.4 || == 8.10.7 || == 9.0.2 || == 9.2.7 || == 9.4.4 category:      Distribution-homepage:      https://github.com/NixOS/hackage-db#readme-bug-reports:   https://github.com/NixOS/hackage-db/issues+homepage:      https://github.com/NixOS/cabal2nix/tree/master/hackage-db#readme+bug-reports:   https://github.com/NixOS/cabal2nix/issues build-type:    Simple cabal-version: >= 1.10 extra-source-files: README.md@@ -20,7 +20,8 @@  source-repository head   type:     git-  location: git://github.com/NixOS/hackage-db.git+  location: git://github.com/NixOS/cabal2nix.git+  subdir:   hackage-db  flag install-examples   default:     False
src/Distribution/Hackage/DB/Path.hs view
@@ -15,10 +15,37 @@  import Control.Exception import System.Directory+import System.Environment (lookupEnv) import System.FilePath +-- |+-- Determines the /state/ directory (which e.g. holds the hackage tarball)+-- cabal-install uses via the following logic:+--+-- 1. If the @CABAL_DIR@ environment variable is set, its content is used as the+--    cabal state directory+-- 2. If @~/.cabal@ (see 'getAppUserDataDirectory') exists, use that.+-- 3. Otherwise, use @${XDG_CACHE_HOME}/cabal@ (see @'getXdgDirectory' 'XdgCache'@)+--    which is the new directory cabal-install can use starting with+--    version @3.10.*@.+--+-- This logic is mostly equivalent to what upstream cabal-install is+-- [doing](https://github.com/haskell/cabal/blob/0ed12188525335ac9759dc957d49979ab09382a1/cabal-install/src/Distribution/Client/Config.hs#L594-L610)+-- with the following exception:+-- The state directory can freely be configured to use a different location+-- in the cabal-install configuration file. hackage-db doesn't parse this+-- configuration file, so differing state directories are ignored. cabalStateDir :: IO FilePath-cabalStateDir = getAppUserDataDirectory "cabal"+cabalStateDir = do+  envCabal <- lookupEnv "CABAL_DIR"+  dotCabal <- getAppUserDataDirectory "cabal"+  dotCabalExists <- doesDirectoryExist dotCabal+  case envCabal of+    Just dir -> pure dir+    Nothing ->+      if dotCabalExists+      then pure dotCabal+      else getXdgDirectory XdgCache "cabal"  cabalTarballDir :: String -> IO FilePath cabalTarballDir repo = do@@ -29,9 +56,11 @@ hackageTarballDir = cabalTarballDir "hackage.haskell.org"  -- | Determine the default path of the Hackage database, which typically--- resides at @"$HOME\/.cabal\/packages\/hackage.haskell.org\/00-index.tar"@.--- Running the command @"cabal update"@ will keep that file up-to-date.-+-- resides in @$HOME\/.cabal\/packages\/hackage.haskell.org\/@.+-- Running the command @cabal update@ or @cabal v2-update@ will keep the index+-- up-to-date.+--+-- See 'cabalStateDir' on how @hackage-db@ searches for the cabal state directory. hackageTarball :: IO FilePath hackageTarball = do   htd <- hackageTarballDir