Commit 181c3e6f authored by Don Stewart's avatar Don Stewart
Browse files

Use Cabal.* namespace, not CabalInstall.* (since its the 'cabal' executable in the end)

parent a64f6884
--------------------------------------------------------------------
-- |
-- Module : Cabal
-- Copyright : (c)
-- License : BSD3
--
-- Maintainer: cabal-devel@haskell.org
-- Stability : provisional
-- Portability:
--
--------------------------------------------------------------------
module Main where
import qualified Network.Hackage.Cabal.Main as Cabal
main :: IO ()
main = Cabal.main
module Main where
import qualified Network.Hackage.CabalInstall.Main as CabalInstall
main :: IO ()
main = CabalInstall.main
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Clean
-- Module : Network.Hackage.Cabal.Clean
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,11 +10,11 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Clean
module Network.Hackage.Cabal.Clean
( clean
) where
import Network.Hackage.CabalInstall.Types (ConfigFlags(..))
import Network.Hackage.Cabal.Types (ConfigFlags(..))
import System.Directory (removeDirectoryRecursive)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Config
-- Module : Network.Hackage.Cabal.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.CabalInstall.Config
module Network.Hackage.Cabal.Config
( repoCacheDir
, packageFile
, packageDir
......@@ -52,9 +52,9 @@ import Distribution.Simple.Program (ProgramConfiguration, defaultProgramConfigur
import Distribution.Version (Dependency, showVersion)
import Distribution.Verbosity (Verbosity, normal)
import Network.Hackage.CabalInstall.Tar (readTarArchive, tarFileName)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), PkgInfo (..), Repo(..))
import Network.Hackage.CabalInstall.Utils
import Network.Hackage.Cabal.Tar (readTarArchive, tarFileName)
import Network.Hackage.Cabal.Types (ConfigFlags (..), PkgInfo (..), Repo(..))
import Network.Hackage.Cabal.Utils
-- | Full path to the local cache directory for a repository.
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Dependency
-- Module : Network.Hackage.Cabal.Dependency
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- Various kinds of dependency resolution and utilities.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Dependency
module Network.Hackage.Cabal.Dependency
(
-- * Dependency resolution
resolveDependencies
......@@ -36,8 +36,8 @@ import Data.Char (toLower)
import Data.List (nub, maximumBy, isPrefixOf)
import qualified System.Info (arch,os)
import Network.Hackage.CabalInstall.Config (listInstalledPackages, getKnownPackages, findCompiler)
import Network.Hackage.CabalInstall.Types ( ResolvedPackage(..), UnresolvedDependency(..)
import Network.Hackage.Cabal.Config (listInstalledPackages, getKnownPackages, findCompiler)
import Network.Hackage.Cabal.Types ( ResolvedPackage(..), UnresolvedDependency(..)
, ConfigFlags (..), PkgInfo (..), ResolvedDependency(..), Repo(..))
import Text.Printf (printf)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Fetch
-- Module : Network.Hackage.Cabal.Fetch
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Fetch
module Network.Hackage.Cabal.Fetch
(
-- * Commands
fetch
......@@ -31,9 +31,9 @@ import Control.Monad (filterM)
import Text.Printf (printf)
import System.Directory (doesFileExist, createDirectoryIfMissing)
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), UnresolvedDependency (..), Repo(..))
import Network.Hackage.CabalInstall.Config (repoCacheDir, packageFile, packageDir, pkgURL, message, findCompiler)
import Network.Hackage.CabalInstall.Dependency (filterFetchables, resolveDependencies)
import Network.Hackage.Cabal.Types (ConfigFlags (..), UnresolvedDependency (..), Repo(..))
import Network.Hackage.Cabal.Config (repoCacheDir, packageFile, packageDir, pkgURL, message, findCompiler)
import Network.Hackage.Cabal.Dependency (filterFetchables, resolveDependencies)
import Distribution.Package (PackageIdentifier(..), showPackageId)
import Distribution.Verbosity
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Info
-- Module : Network.Hackage.Cabal.Info
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,13 +10,13 @@
--
-- High level interface to a dry-run package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Info where
module Network.Hackage.Cabal.Info where
import Network.Hackage.CabalInstall.Config (pkgURL, findCompiler, listInstalledPackages)
import Network.Hackage.CabalInstall.Dependency
import Network.Hackage.Cabal.Config (pkgURL, findCompiler, listInstalledPackages)
import Network.Hackage.Cabal.Dependency
(resolveDependencies, fulfillDependency)
import Network.Hackage.CabalInstall.Fetch (isFetched, packageFile)
import Network.Hackage.CabalInstall.Types (ConfigFlags(..), ResolvedPackage(..)
import Network.Hackage.Cabal.Fetch (isFetched, packageFile)
import Network.Hackage.Cabal.Types (ConfigFlags(..), ResolvedPackage(..)
,UnresolvedDependency(..))
import Distribution.Package (PackageIdentifier, showPackageId)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Install
-- Module : Network.Hackage.Cabal.Install
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- High level interface to package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Install
module Network.Hackage.Cabal.Install
( install -- :: ConfigFlags -> [UnresolvedDependency] -> IO ()
, installPackages
, installPkg -- :: ConfigFlags -> (PackageIdentifier,[String],String) -> IO ()
......@@ -25,11 +25,11 @@ import System.FilePath ((</>),(<.>))
import Text.Printf (printf)
import Network.Hackage.CabalInstall.Config (findCompiler, message)
import Network.Hackage.CabalInstall.Dependency (getPackages, resolveDependencies)
import Network.Hackage.CabalInstall.Fetch (isFetched, packageFile, fetchPackage)
import Network.Hackage.CabalInstall.Tar (extractTarGzFile)
import Network.Hackage.CabalInstall.Types (ConfigFlags(..), UnresolvedDependency(..)
import Network.Hackage.Cabal.Config (findCompiler, message)
import Network.Hackage.Cabal.Dependency (getPackages, resolveDependencies)
import Network.Hackage.Cabal.Fetch (isFetched, packageFile, fetchPackage)
import Network.Hackage.Cabal.Tar (extractTarGzFile)
import Network.Hackage.Cabal.Types (ConfigFlags(..), UnresolvedDependency(..)
, Repo(..))
import Distribution.Simple.Compiler (Compiler(..))
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Install
-- Module : Network.Hackage.Cabal.Install
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- High level interface to package installation.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.List
module Network.Hackage.Cabal.List
( list -- :: ConfigFlags -> [UnresolvedDependency] -> IO ()
) where
......@@ -21,8 +21,8 @@ import Data.Char as Char (toLower)
import Data.Ord (comparing)
import Distribution.Package
import Distribution.PackageDescription
import Network.Hackage.CabalInstall.Config (getKnownPackages)
import Network.Hackage.CabalInstall.Types (PkgInfo(..), ConfigFlags(..), UnresolvedDependency(..))
import Network.Hackage.Cabal.Config (getKnownPackages)
import Network.Hackage.Cabal.Types (PkgInfo(..), ConfigFlags(..), UnresolvedDependency(..))
-- |Show information about packages
list :: ConfigFlags -> [String] -> IO ()
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Main
-- Module : Network.Hackage.Cabal.Main
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,20 +10,20 @@
--
-- Entry point to the default cabal-install front-end.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Main where
module Network.Hackage.Cabal.Main where
import Data.List (isSuffixOf)
import System.Environment (getArgs)
import Network.Hackage.CabalInstall.Types (Action (..), Option(..))
import Network.Hackage.CabalInstall.Setup (parseGlobalArgs, parsePackageArgs, configFromOptions)
import Network.Hackage.CabalInstall.Config (defaultConfigFile, loadConfig)
import Network.Hackage.Cabal.Types (Action (..), Option(..))
import Network.Hackage.Cabal.Setup (parseGlobalArgs, parsePackageArgs, configFromOptions)
import Network.Hackage.Cabal.Config (defaultConfigFile, loadConfig)
import Network.Hackage.CabalInstall.List (list)
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.Cabal.List (list)
import Network.Hackage.Cabal.Install (install)
import Network.Hackage.Cabal.Info (info)
import Network.Hackage.Cabal.Update (update)
import Network.Hackage.Cabal.Fetch (fetch)
import Network.Hackage.Cabal.Clean (clean)
main :: IO ()
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Setup
-- Module : Network.Hackage.Cabal.Setup
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Setup
module Network.Hackage.Cabal.Setup
( parsePackageArgs
, parseGlobalArgs
, configFromOptions
......@@ -26,9 +26,9 @@ import System.Console.GetOpt (ArgDescr (..), ArgOrder (..), OptDescr (..), usage
import System.Exit (exitWith, ExitCode (..))
import System.Environment (getProgName)
import Network.Hackage.CabalInstall.Types (Action (..), Option(..), ConfigFlags(..)
import Network.Hackage.Cabal.Types (Action (..), Option(..), ConfigFlags(..)
, UnresolvedDependency (..))
import Network.Hackage.CabalInstall.Utils (readPToMaybe)
import Network.Hackage.Cabal.Utils (readPToMaybe)
globalOptions :: [OptDescr Option]
......
-- | Simplistic TAR archive reading. Only gets the file names and file contents.
module Network.Hackage.CabalInstall.Tar (TarHeader(..), TarFileType(..),
module Network.Hackage.Cabal.Tar (TarHeader(..), TarFileType(..),
readTarArchive, extractTarArchive,
extractTarGzFile, gunzip) where
......@@ -15,24 +15,28 @@ import System.Directory (Permissions(..), setPermissions, createDirectoryIfMissi
import System.FilePath ((</>), isValid, isAbsolute)
import System.Posix.Types (FileMode)
--import Codec.Compression.GZip (decompress)
import Codec.Compression.GZip.GUnZip (gunzip)
-- GNU gzip
import Codec.Compression.GZip (decompress)
-- Or use Ian's gunzip:
-- import Codec.Compression.GZip.GUnZip (gunzip)
gunzip :: ByteString -> ByteString
gunzip = decompress
data TarHeader = TarHeader {
tarFileName :: FilePath,
tarFileMode :: FileMode,
tarFileType :: TarFileType,
tarLinkTarget :: FilePath
}
deriving (Show)
data TarFileType =
TarNormalFile
| TarHardLink
| TarSymbolicLink
| TarDirectory
| TarOther Char
deriving (Eq,Show)
tarFileName :: FilePath,
tarFileMode :: FileMode,
tarFileType :: TarFileType,
tarLinkTarget :: FilePath
} deriving Show
data TarFileType = TarNormalFile
| TarHardLink
| TarSymbolicLink
| TarDirectory
| TarOther Char
deriving (Eq,Show)
readTarArchive :: ByteString -> [(TarHeader,ByteString)]
readTarArchive = catMaybes . unfoldr getTarEntry
......@@ -44,7 +48,7 @@ extractTarGzFile :: Maybe FilePath -- ^ Destination directory
-> FilePath -- ^ Tarball
-> IO ()
extractTarGzFile mdir file =
BS.readFile file >>= extractTarArchive mdir . readTarArchive . gunzip
BS.readFile file >>= extractTarArchive mdir . readTarArchive . decompress {- gunzip -}
--
-- * Extracting
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Types
-- Module : Network.Hackage.Cabal.Types
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,7 +10,7 @@
--
-- All data types for the entire cabal-install system gathered here to avoid some .hs-boot files.
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Types where
module Network.Hackage.Cabal.Types where
import Distribution.Simple.Compiler (CompilerFlavor)
import Distribution.Simple.InstallDirs (InstallDirTemplates)
......
-----------------------------------------------------------------------------
-- |
-- Module : Network.Hackage.CabalInstall.Update
-- Module : Network.Hackage.Cabal.Update
-- Copyright : (c) David Himmelstrup 2005
-- License : BSD-like
--
......@@ -10,13 +10,13 @@
--
--
-----------------------------------------------------------------------------
module Network.Hackage.CabalInstall.Update
module Network.Hackage.Cabal.Update
( update
) where
import Network.Hackage.CabalInstall.Types (ConfigFlags (..), PkgInfo(..), Repo(..))
import Network.Hackage.CabalInstall.Fetch (downloadIndex)
import Network.Hackage.CabalInstall.Tar (gunzip)
import Network.Hackage.Cabal.Types (ConfigFlags (..), PkgInfo(..), Repo(..))
import Network.Hackage.Cabal.Fetch (downloadIndex)
import Network.Hackage.Cabal.Tar (gunzip)
import qualified Data.ByteString.Lazy.Char8 as BS
......
module Network.Hackage.CabalInstall.Utils where
module Network.Hackage.Cabal.Utils where
import Distribution.Compat.ReadP (ReadP, readP_to_S, pfail, get, look, choice)
import Distribution.ParseUtils
......
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