Commit c4ed6f2d authored by Don Stewart's avatar Don Stewart
Browse files

-Wall police

parent 070b1109
......@@ -40,16 +40,16 @@ import Text.PrettyPrint.HughesPJ (text)
import Distribution.Compat.ReadP (ReadP, char, munch1, readS_to_P)
import Distribution.Compiler (CompilerFlavor(..), defaultCompilerFlavor)
import Distribution.Package (PackageIdentifier(..), showPackageId)
import Distribution.PackageDescription (GenericPackageDescription(..)
, PackageDescription(..)
, parsePackageDescription, ParseResult(..))
import Distribution.PackageDescription ({- GenericPackageDescription(..), -}
{-PackageDescription(..), -}
parsePackageDescription, ParseResult(..))
import Distribution.ParseUtils (FieldDescr, simpleField, listField, liftField, field)
import Distribution.Simple.Compiler (Compiler, PackageDB(..))
import Distribution.Simple.Configure (getInstalledPackages)
import qualified Distribution.Simple.Configure as Configure (configCompiler)
import Distribution.Simple.InstallDirs (InstallDirTemplates(..), PathTemplate, toPathTemplate, defaultInstallDirs)
import Distribution.Simple.Program (ProgramConfiguration, defaultProgramConfiguration)
import Distribution.Version (Dependency, showVersion)
import Distribution.Version (showVersion)
import Distribution.Verbosity (Verbosity, normal)
import Hackage.Tar (readTarArchive, tarFileName)
......@@ -187,6 +187,7 @@ loadConfig configFile =
let conf = defaultConf { configInstallDirs = installDirs }
case parseBasicStanza configFieldDescrs conf inp of
ParseOk _ conf' -> return conf'
ParseFailed err -> error $ "LoadConfig: can't happen: " ++ show err
ParseFailed err ->
do hPutStrLn stderr $ "Error parsing config file "
++ configFile ++ ": " ++ showPError err
......
......@@ -22,21 +22,21 @@ module Hackage.Dependency
, fulfillDependency -- :: Dependency -> PackageIdentifier -> Bool
) where
import Distribution.Version (Version, Dependency(..), withinRange)
import Distribution.Version (Dependency(..), withinRange)
import Distribution.Package (PackageIdentifier(..))
import Distribution.PackageDescription
(PackageDescription(package, buildDepends)
, GenericPackageDescription(packageDescription)
, finalizePackageDescription)
import Distribution.ParseUtils (showDependency)
import Distribution.Simple.Compiler (PackageDB(..), Compiler, showCompilerId, compilerVersion)
import Distribution.Simple.Compiler (Compiler, showCompilerId, compilerVersion)
import Distribution.Simple.Program (ProgramConfiguration)
import Data.Char (toLower)
import Data.List (nub, maximumBy, isPrefixOf)
import qualified System.Info (arch,os)
import Hackage.Config (listInstalledPackages, getKnownPackages, findCompiler)
import Hackage.Config (listInstalledPackages, getKnownPackages)
import Hackage.Types ( ResolvedPackage(..), UnresolvedDependency(..)
, ConfigFlags (..), PkgInfo (..), ResolvedDependency(..), Repo(..))
import Text.Printf (printf)
......@@ -153,7 +153,7 @@ finalizePackage :: Compiler
finalizePackage comp installed available flags desc
= case e of
Left missing -> error $ "Can't resolve dependencies: " ++ show missing
Right (d,flags) -> d
Right (d,_flags) -> d
where
e = finalizePackageDescription
flags
......
......@@ -12,15 +12,14 @@
-----------------------------------------------------------------------------
module Hackage.Info where
import Hackage.Config (pkgURL, findCompiler, listInstalledPackages)
import Hackage.Config
import Hackage.Dependency
(resolveDependencies, fulfillDependency)
import Hackage.Fetch (isFetched, packageFile)
import Hackage.Types (ConfigFlags(..), ResolvedPackage(..)
,UnresolvedDependency(..))
import Hackage.Fetch
import Hackage.Types
import Distribution.Package (PackageIdentifier, showPackageId)
import Distribution.ParseUtils (showDependency)
import Distribution.Version (Dependency)
import Data.Maybe (listToMaybe, fromMaybe)
import Text.Printf (printf)
......@@ -38,33 +37,37 @@ info cfg globalArgs deps
and what options will be parsed to them.
-}
infoPkg :: ConfigFlags -> [PackageIdentifier] -> [String] -> ResolvedPackage -> IO ()
infoPkg cfg ipkgs _ (ResolvedPackage { fulfilling = dep
infoPkg _cfg ipkgs _ (ResolvedPackage { fulfilling = dep
, resolvedData = Nothing })
= showOtherPkg installedPkg dep
where installedPkg = listToMaybe (filter (fulfillDependency dep) ipkgs)
where installedPkg = listToMaybe (filter (fulfillDependency dep) ipkgs)
infoPkg cfg ipkgs globalArgs (ResolvedPackage { fulfilling = dep
, pkgOptions = ops
, resolvedData = (Just (pkg,repo,deps)) })
= do fetched <- isFetched cfg pkg repo
let pkgFile = if fetched then Just (packageFile cfg pkg repo) else Nothing
showPkgInfo pkgFile isInstalled (globalArgs ++ ops) dep (pkg,repo,deps)
where isInstalled = pkg `elem` ipkgs
where isInstalled = pkg `elem` ipkgs
showPkgInfo :: Maybe [Char] -> Bool -> [String] -> Dependency -> (PackageIdentifier, Repo, [ResolvedPackage]) -> IO ()
showPkgInfo mbPath installed ops dep (pkg,repo,deps)
= do printf " Package: '%s'\n" (show $ showDependency dep)
printf " Using: %s\n" (showPackageId pkg)
printf " Installed: %s\n" (if installed then "Yes" else "No")
printf " Depends: %s\n" (showDeps deps)
printf " Options: %s\n" (unwords ops)
printf " Location: %s\n" (pkgURL pkg repo)
printf " Local: %s\n\n" (fromMaybe "*Not downloaded" mbPath)
= do printf " Package: '%s'\n" (show $ showDependency dep)
printf " Using: %s\n" (showPackageId pkg)
printf " Installed: %s\n" (if installed then "Yes" else "No")
printf " Depends: %s\n" (showDeps deps)
printf " Options: %s\n" (unwords ops)
printf " Location: %s\n" (pkgURL pkg repo)
printf " Local: %s\n\n" (fromMaybe "*Not downloaded" mbPath)
where
showDeps = show . map showDep
showDep dep = show (showDependency (fulfilling dep))
showDeps = show . map showDep
showDep = show . showDependency . fulfilling
showOtherPkg :: Maybe PackageIdentifier -> Dependency -> IO ()
showOtherPkg mbPkg dep
= do printf " Package: '%s'\n" (show $ showDependency dep)
case mbPkg of
Nothing -> printf " Not available!\n\n"
Just pkg -> do printf " Using: %s\n" (showPackageId pkg)
printf " Installed: Yes\n\n"
= do printf " Package: '%s'\n" (show $ showDependency dep)
case mbPkg of
Nothing -> printf " Not available!\n\n"
Just pkg -> do printf " Using: %s\n" (showPackageId pkg)
printf " Installed: Yes\n\n"
......@@ -141,7 +141,7 @@ installPkg cfg comp globalArgs (pkg,ops,repo)
installUnpackedPkg :: ConfigFlags -> PackageIdentifier
-> (String -> IO ()) -> IO ()
installUnpackedPkg cfg pkgId setup
installUnpackedPkg _cfg pkgId setup
= do printf "Building '%s'\n" (showPackageId pkgId)
printf " Configuring...\n"
setup "configure"
......
......@@ -22,7 +22,7 @@ import Data.Ord (comparing)
import Distribution.Package
import Distribution.PackageDescription
import Hackage.Config (getKnownPackages)
import Hackage.Types (PkgInfo(..), ConfigFlags(..), UnresolvedDependency(..))
import Hackage.Types (PkgInfo(..), ConfigFlags(..), {- UnresolvedDependency(..)-} )
-- |Show information about packages
list :: ConfigFlags -> [String] -> IO ()
......
......@@ -81,8 +81,8 @@ configFromOptions :: ConfigFlags -> [Option] -> ConfigFlags
configFromOptions = foldr f
where f o cfg = case o of
OptCompilerFlavor c -> cfg { configCompiler = c}
OptCompiler p -> cfg -- FIXME: where do we store this?
OptHcPkg p -> cfg -- FIXME: where do we store this?
OptCompiler _ -> cfg -- FIXME: where do we store this?
OptHcPkg _ -> cfg -- FIXME: where do we store this?
OptConfigFile _ -> cfg
OptCacheDir d -> cfg { configCacheDir = d }
OptPrefix d -> lib (\ds x -> ds { prefixDirTemplate = x }) d
......@@ -199,9 +199,9 @@ parsePackageArgs _ args
Just x -> x
parsePkgArgs [] = []
parsePkgArgs (x:xs)
= let (args,rest) = break (not.(==) '-'.head) xs
= let (args',rest) = break (not.(==) '-'.head) xs
in (UnresolvedDependency
{ dependency = parseDep x
, depOptions = args }
, depOptions = args' }
):parsePkgArgs rest
......@@ -14,10 +14,9 @@ module Hackage.Update
( update
) where
import Hackage.Types (ConfigFlags (..), PkgInfo(..), Repo(..))
import Hackage.Fetch (downloadIndex)
import Hackage.Tar (gunzip)
import Hackage.Types
import Hackage.Fetch
import Hackage.Tar
import qualified Data.ByteString.Lazy.Char8 as BS
import System.FilePath (dropExtension)
......
module Hackage.Version where
import Data.Version
import Paths_cabal_install (version)
clientVersion :: Version
clientVersion = Paths_cabal_install.version
......@@ -23,15 +23,14 @@ import Hackage.Update (update)
import Hackage.Fetch (fetch)
import Hackage.Clean (clean)
import Data.List (isSuffixOf)
import System.Environment (getArgs)
-- | Entry point
--
main :: IO ()
main = do
args <- getArgs
(action, flags, args) <- parseGlobalArgs args
rawArgs <- getArgs
(action, flags, args) <- parseGlobalArgs rawArgs
configFile <- case [f | OptConfigFile f <- flags] of
[] -> defaultConfigFile
fs -> return (last fs)
......
......@@ -35,7 +35,6 @@ Executable cabal
Hackage.Types
Hackage.Update
Hackage.Utils
Hackage.Version
build-depends: mtl, network, regex-compat, unix, Cabal>=1.3,
zlib >= 0.4, HTTP >= 3000.0 && < 3000.1, filepath >= 1.0
......
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