Commit 6ac98b96 authored by alson's avatar alson
Browse files

Complete move of cabal-get to cabal-install + some fixups

parent 3307d93d
......@@ -53,21 +53,5 @@ Exposed-Modules:
Distribution.Compat.Exception,
Distribution.Compat.FilePath,
Distribution.Compat.RawSystem
-- Network.Hackage.CabalGet.BuildDep,
-- Network.Hackage.CabalGet.Clean,
-- Network.Hackage.CabalGet.Config,
-- Network.Hackage.CabalGet.Configure,
-- Network.Hackage.CabalGet.Dependency,
-- Network.Hackage.CabalGet.Fetch,
-- Network.Hackage.CabalGet.Info,
-- Network.Hackage.CabalGet.Install,
-- Network.Hackage.CabalGet.Main,
-- Network.Hackage.CabalGet.Setup,
-- Network.Hackage.CabalGet.TarUtils,
-- Network.Hackage.CabalGet.Types,
-- Network.Hackage.CabalGet.Update,
-- Network.Hackage.Client,
-- Network.Hackage.Interface,
-- Network.Hackage.Version
Extensions: CPP, OverlappingInstances, TypeSynonymInstances, TemplateHaskell
GHC-options: -idependencies/hackage-client-0.1.0 -idependencies/XmlRpc-2005.5.5 -idependencies/Crypto-2.0.0 -idependencies/GnuPG-0.1.1 -idependencies/HaXml-1.2/src -idependencies/HTTP-2005.5.5 -idependencies/NewBinary-0.1
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.BuildDep
-- Module : Network.Hackage.CabalInstall.BuildDep
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,16 +10,16 @@
--
-- High level interface to a specialized instance of package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.BuildDep where
module Network.Hackage.CabalInstall.BuildDep where
import Network.Hackage.CabalGet.Dependency (getPackages, getBuildDeps, resolveDependenciesAux)
import Network.Hackage.CabalGet.Install (installPkg)
import Network.Hackage.CabalGet.Types (ConfigFlags (..), UnresolvedDependency)
import Network.Hackage.CabalInstall.Dependency (getPackages, getBuildDeps, resolveDependenciesAux)
import Network.Hackage.CabalInstall.Install (installPkg)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), UnresolvedDependency)
import Distribution.Simple.Configure (getInstalledPackages)
{-|
This function behaves exactly like 'Network.Hackage.CabalGet.Install.install' except
This function behaves exactly like 'Network.Hackage.CabalInstall.Install.install' except
that it only builds the dependencies for packages.
-}
buildDep :: ConfigFlags -> [String] -> [UnresolvedDependency] -> IO ()
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Clean
-- Module : Network.Hackage.CabalInstall.Clean
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,12 +10,12 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Clean
module Network.Hackage.CabalInstall.Clean
( clean
) where
import Network.Hackage.CabalGet.Types (ConfigFlags)
import Network.Hackage.CabalGet.Fetch (packagesDirectory)
import Network.Hackage.CabalInstall.Types (ConfigFlags)
import Network.Hackage.CabalInstall.Fetch (packagesDirectory)
import System.Directory (removeDirectoryRecursive)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Config
-- Module : Network.Hackage.CabalInstall.Config
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- Utilities for handling saved state such as known packages, known servers and downloaded packages.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Config
module Network.Hackage.CabalInstall.Config
( packagesDirectoryName
, getKnownServers
, getKnownPackages
......@@ -25,7 +25,7 @@ import Distribution.Package (PackageIdentifier)
import Distribution.Version (Dependency)
import Distribution.Compat.FilePath (joinFileName)
import Network.Hackage.CabalGet.Types (ConfigFlags (..))
import Network.Hackage.CabalInstall.Types (ConfigFlags (..))
pkgListFile :: FilePath
pkgListFile = "pkg.list"
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Configure
-- Module : Network.Hackage.CabalInstall.Configure
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,16 +10,16 @@
--
-- Functions used to generate ConfigFlags.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Configure
module Network.Hackage.CabalInstall.Configure
( defaultOutputGen
, mkConfigFlags
) where
import Control.Monad (guard, mplus, when)
import Network.Hackage.CabalGet.Types (ConfigFlags (..), OutputGen (..)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), OutputGen (..)
, TempFlags (..), ResolvedPackage (..))
import Network.Hackage.CabalGet.Config (getKnownServers, selectValidConfigDir)
import Network.Hackage.CabalInstall.Config (getKnownServers, selectValidConfigDir)
import qualified Distribution.Simple.Configure as Configure (findProgram, configCompiler)
import Distribution.ParseUtils (showDependency)
......@@ -92,10 +92,10 @@ localPrefix
= do home <- getHomeDirectory
return (home `joinFileName` "usr")
-- |Compute the local config directory ('~/.cabal-get' on Linux).
-- |Compute the local config directory ('~/.cabal-install' on Linux).
localConfigDir :: IO FilePath
localConfigDir
= getAppUserDataDirectory "cabal-get"
= getAppUserDataDirectory "cabal-install"
{-|
Give concrete answers to questions like:
......@@ -118,7 +118,7 @@ mkConfigFlags cfg
then fmap Just (maybe localPrefix return (tempPrefix cfg))
else return Nothing
confPath <- selectValidConfigDir ( maybe id (:) (tempConfPath cfg)
["/etc/cabal-get"
["/etc/cabal-install"
,localConfig] )
printf "Using config dir: %s\n" confPath
outputGen <- defaultOutputGen (tempVerbose cfg)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Dependency
-- Module : Network.Hackage.CabalInstall.Dependency
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- Various kinds of dependency resolution and utilities.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Dependency
module Network.Hackage.CabalInstall.Dependency
(
-- * Dependency resolution
resolveDependencies
......@@ -31,8 +31,8 @@ import Data.List (nub, maximumBy)
import Data.Maybe (mapMaybe)
import Control.Monad (guard)
import Network.Hackage.CabalGet.Config (getKnownPackages)
import Network.Hackage.CabalGet.Types ( ResolvedPackage(..), UnresolvedDependency(..)
import Network.Hackage.CabalInstall.Config (getKnownPackages)
import Network.Hackage.CabalInstall.Types ( ResolvedPackage(..), UnresolvedDependency(..)
, ConfigFlags (..))
import Text.Printf (printf)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Fetch
-- Module : Network.Hackage.CabalInstall.Fetch
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Fetch
module Network.Hackage.CabalInstall.Fetch
(
-- * Commands
fetch
......@@ -29,9 +29,9 @@ import Control.Monad (filterM)
import Text.Printf (printf)
import System.Directory (doesFileExist, createDirectoryIfMissing)
import Network.Hackage.CabalGet.Types (ConfigFlags (..), OutputGen (..), UnresolvedDependency (..))
import Network.Hackage.CabalGet.Config (packagesDirectoryName)
import Network.Hackage.CabalGet.Dependency (filterFetchables, resolveDependencies)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), OutputGen (..), UnresolvedDependency (..))
import Network.Hackage.CabalInstall.Config (packagesDirectoryName)
import Network.Hackage.CabalInstall.Dependency (filterFetchables, resolveDependencies)
import Distribution.Package (PackageIdentifier, showPackageId)
import Distribution.Compat.FilePath (joinFileName)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Info
-- Module : Network.Hackage.CabalInstall.Info
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,11 +10,11 @@
--
-- High level interface to a dry-run package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Info where
module Network.Hackage.CabalInstall.Info where
import Network.Hackage.CabalGet.Dependency (resolveDependencies, fulfillDependency)
import Network.Hackage.CabalGet.Fetch (isFetched, packageFile)
import Network.Hackage.CabalGet.Types (ConfigFlags(..), ResolvedPackage(..)
import Network.Hackage.CabalInstall.Dependency (resolveDependencies, fulfillDependency)
import Network.Hackage.CabalInstall.Fetch (isFetched, packageFile)
import Network.Hackage.CabalInstall.Types (ConfigFlags(..), ResolvedPackage(..)
,UnresolvedDependency(..), OutputGen(..))
import Distribution.Package (PackageIdentifier)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Install
-- Module : Network.Hackage.CabalInstall.Install
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- High level interface to package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Install
module Network.Hackage.CabalInstall.Install
( install -- :: ConfigFlags -> [UnresolvedDependency] -> IO ()
, installPkg -- :: ConfigFlags -> (PackageIdentifier,[String],String) -> IO ()
) where
......@@ -18,11 +18,11 @@ module Network.Hackage.CabalGet.Install
import Control.Exception (bracket_)
import Network.Hackage.CabalGet.Dependency (getPackages, resolveDependencies)
import Network.Hackage.CabalGet.Fetch (isFetched, packageFile, fetchPackage)
import Network.Hackage.CabalGet.Types (ConfigFlags(..), UnresolvedDependency(..)
import Network.Hackage.CabalInstall.Dependency (getPackages, resolveDependencies)
import Network.Hackage.CabalInstall.Fetch (isFetched, packageFile, fetchPackage)
import Network.Hackage.CabalInstall.Types (ConfigFlags(..), UnresolvedDependency(..)
,OutputGen(..))
import Network.Hackage.CabalGet.TarUtils
import Network.Hackage.CabalInstall.TarUtils
import Distribution.Simple.Configure (getInstalledPackages)
import Distribution.Package (showPackageId, PackageIdentifier)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Main
-- Module : Network.Hackage.CabalInstall.Main
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -8,21 +8,21 @@
-- Stability : provisional
-- Portability : portable
--
-- Entry point to the default cabal-get front-end.
-- Entry point to the default cabal-install front-end.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Main where
module Network.Hackage.CabalInstall.Main where
import System.Environment (getArgs)
import Network.Hackage.CabalGet.Types (Action (..))
import Network.Hackage.CabalGet.Setup (parseGlobalArgs, parseInstallArgs)
import Network.Hackage.CabalGet.Configure (mkConfigFlags)
import Network.Hackage.CabalInstall.Types (Action (..))
import Network.Hackage.CabalInstall.Setup (parseGlobalArgs, parseInstallArgs)
import Network.Hackage.CabalInstall.Configure (mkConfigFlags)
import Network.Hackage.CabalGet.Install (install)
import Network.Hackage.CabalGet.Info (info)
import Network.Hackage.CabalGet.Update (update)
import Network.Hackage.CabalGet.Fetch (fetch)
import Network.Hackage.CabalGet.Clean (clean)
import Network.Hackage.CabalGet.BuildDep (buildDep)
import Network.Hackage.CabalInstall.Install (install)
import Network.Hackage.CabalInstall.Info (info)
import Network.Hackage.CabalInstall.Update (update)
import Network.Hackage.CabalInstall.Fetch (fetch)
import Network.Hackage.CabalInstall.Clean (clean)
import Network.Hackage.CabalInstall.BuildDep (buildDep)
main :: IO ()
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Setup
-- Module : Network.Hackage.CabalInstall.Setup
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Setup
module Network.Hackage.CabalInstall.Setup
( emptyTempFlags
, parseInstallArgs
, parseGlobalArgs
......@@ -24,7 +24,7 @@ import System.Console.GetOpt (ArgDescr (..), ArgOrder (..), OptDescr (..), usage
import System.Exit (exitWith, ExitCode (..))
import System.Environment (getProgName)
import Network.Hackage.CabalGet.Types (TempFlags (..), Flag (..), Action (..)
import Network.Hackage.CabalInstall.Types (TempFlags (..), Flag (..), Action (..)
, UnresolvedDependency (..))
emptyTempFlags :: TempFlags
......@@ -59,7 +59,7 @@ globalOptions =
, Option "s" ["with-server"] (ReqArg WithServer "URL")
"give the URL to a Hackage server"
, Option "c" ["config-path"] (ReqArg WithConfPath "PATH")
"give the path to the config dir. Default is /etc/cabal-get"
"give the path to the config dir. Default is /etc/cabal-install"
, Option "" ["tar-path"] (ReqArg WithTarPath "PATH")
"give the path to tar"
, Option "w" ["with-compiler"] (ReqArg WithCompiler "PATH")
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.TarUtils
-- Module : Network.Hackage.CabalInstall.TarUtils
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- Utility functions for manipulating tar archives.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.TarUtils
module Network.Hackage.CabalInstall.TarUtils
( tarballGetFiles
, locateFile
, locateFileExt
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Types
-- Module : Network.Hackage.CabalInstall.Types
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -8,9 +8,9 @@
-- Stability : provisional
-- Portability : portable
--
-- All data types for the entire cabal-get system gathered here to avoid some .hs-boot files.
-- All data types for the entire cabal-install system gathered here to avoid some .hs-boot files.
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Types where
module Network.Hackage.CabalInstall.Types where
import Distribution.Setup (CompilerFlavor(..),Compiler)
import Distribution.Package (PackageIdentifier)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalGet.Update
-- Module : Network.Hackage.CabalInstall.Update
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,12 +10,12 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalGet.Update
module Network.Hackage.CabalInstall.Update
( update
) where
import Network.Hackage.CabalGet.Types (ConfigFlags (..), OutputGen(..))
import Network.Hackage.CabalGet.Config (writeKnownPackages)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), OutputGen(..))
import Network.Hackage.CabalInstall.Config (writeKnownPackages)
import Network.Hackage.Client (listPackages)
......
module Main where
import qualified Network.Hackage.CabalGet.Main as CabalGet
import qualified Network.Hackage.CabalInstall.Main as CabalInstall
main :: IO ()
main = CabalGet.main
main = CabalInstall.main
After building and installing with cabal, copy etc-cabal-get to
/etc/cabal-get.
After building and installing with cabal, copy etc-cabal-install to
/etc/cabal-install.
CabalGet, what happens under the hood.
CabalInstall, what happens under the hood.
FetchCmd:
cabal-get stores packages in [config-dir]/packages/ by their package id.
cabal-install stores packages in [config-dir]/packages/ by their package id.
This can lead to clashes if there's two identical (same name, same version)
packages from two servers with different functionality.
CleanCmd:
......@@ -13,17 +13,17 @@
Installed packages are determined, and dependencies of the to-be-installed packages
are resolved and fetched.
The fetched tarballs are moved to a temporary directory (usually /tmp) and extracted.
Then cabal-get finds any files with a ".cabal" extension and picks the shortest (eg.
Then cabal-install finds any files with a ".cabal" extension and picks the shortest (eg.
"myPkg/pkg.cabal" will be chosen over "myPkg/subdir/somefile.cabal"). Cabal-get looks
for "Setup.lhs" and "Setup.hs" (in that order) in the directory where the .cabal file
was found. Runhaskell is then called with user specified arguments. The user can
only pass arguments to the 'configure' phase of the installation. '--user' is only passed
to 'runhaskell install' when the '--user' flag is given to cabal-get.
to 'runhaskell install' when the '--user' flag is given to cabal-install.
InfoCmd:
To be written.
Files used by cabal-get:
Files used by cabal-install:
[cfg-dir]/serv.list list of servers in the format of :: [String]
[cfg-dir]/pkg.list list of packages available from the servers.
Format: [(ServerURL,[(PackageIdentifier,[Dependency])])] where ServerURL = String
......
......@@ -3,7 +3,7 @@ Version: 0.3.0
License: BSD4
License-File: ../LICENSE
Author: Lemmih <lemmih@gmail.com>
data-files: etc-cabal-get/serv.list
data-files: etc-cabal-install/serv.list
Maintainer: Lemmih <lemmih@gmail.com>
Copyright: 2005 Lemmih <lemmih@gmail.com>
Stability: Experimental
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment