[commit: Cabal] master: Follow directory layout of HackageDB data also when calculating URLs to download from, not just the local paths. (c765484)
Ian Lynagh
igloo at earth.li
Fri Jun 24 01:44:44 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/c76548409209cb2b3c8eafe7ec3d90e879a18efa
>---------------------------------------------------------------
commit c76548409209cb2b3c8eafe7ec3d90e879a18efa
Author: bjorn <bjorn at bringert.net>
Date: Sun May 20 22:16:11 2007 +0000
Follow directory layout of HackageDB data also when calculating URLs to download from, not just the local paths.
>---------------------------------------------------------------
.../src/Network/Hackage/CabalInstall/Fetch.hs | 3 ++-
.../src/Network/Hackage/CabalInstall/Update.hs | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs b/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
index 83f4d0a..025bc2c 100644
--- a/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
+++ b/cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
@@ -105,7 +105,8 @@ downloadIndex cfg serv
where url = serv ++ "/" ++ "00-index.tar.gz"
path = packagesDirectory cfg </> "00-index" <.> "tar.gz"
--- |Generate the full path to a given @PackageIdentifer at .
+-- |Generate the full path to the locally cached copy of
+-- the tarball for a given @PackageIdentifer at .
packageFile :: ConfigFlags -> PackageIdentifier -> FilePath
packageFile cfg pkg = packagesDirectory cfg
</> pkgName pkg
diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Update.hs b/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
index e13917f..ccf6436 100644
--- a/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
+++ b/cabal-install/src/Network/Hackage/CabalInstall/Update.hs
@@ -25,6 +25,7 @@ import System.FilePath ((</>), joinPath, addExtension)
import Control.Monad (liftM)
import Data.List (isSuffixOf)
+import Data.Version (showVersion)
-- | 'update' downloads the package list from all known servers
update :: ConfigFlags -> IO ()
@@ -54,8 +55,9 @@ parsePkg server description =
, infoURL = pkgURL (package description) server
}
+-- | Generate the URL of the tarball for a given package.
pkgURL :: PackageIdentifier -> String -> String
-pkgURL identifier base = joinPath [base, pkgName identifier, showPackageId identifier] `addExtension` ".tar.gz"
+pkgURL pkg base = joinPath [base, pkgName pkg, showVersion (pkgVersion pkg), showPackageId pkg] `addExtension` ".tar.gz"
concatMapM :: (Monad m) => [a] -> (a -> m [b]) -> m [b]
concatMapM amb f = liftM concat (mapM f amb)
More information about the Cvs-libraries
mailing list