Commit 215e688e authored by Heather's avatar Heather

cabal-install: minor random improvements

parent 96a8f7b1
......@@ -282,7 +282,7 @@ dontUpgradeNonUpgradeablePackages params =
[ LabeledPackageConstraint
(PackageConstraintInstalled pkgname)
ConstraintSourceNonUpgradeablePackage
| all (/=PackageName "base") (depResolverTargets params)
| notElem (PackageName "base") (depResolverTargets params)
, pkgname <- map PackageName [ "base", "ghc-prim", "integer-gmp"
, "integer-simple" ]
, isInstalled pkgname ]
......@@ -601,8 +601,8 @@ interpretPackagesPreference selected defaultPref prefs =
[ (pkgname, pref)
| PackageInstalledPreference pkgname pref <- prefs ]
installPrefDefault = case defaultPref of
PreferAllLatest -> \_ -> PreferLatest
PreferAllInstalled -> \_ -> PreferInstalled
PreferAllLatest -> const PreferLatest
PreferAllInstalled -> const PreferInstalled
PreferLatestForSelected -> \pkgname ->
-- When you say cabal install foo, what you really mean is, prefer the
-- latest version of foo, but the installed version of everything else
......@@ -637,7 +637,7 @@ validateSolverResult platform comp indepGoals pkgs =
formatPkgProblems = formatProblemMessage . map showPlanPackageProblem
formatPlanProblems = formatProblemMessage . map InstallPlan.showPlanProblem
formatProblemMessage problems =
formatProblemMessage problems =
unlines $
"internal error: could not construct a valid install plan."
: "The proposed (invalid) plan contained the following problems:"
......
......@@ -17,6 +17,7 @@ module Distribution.Client.Haddock
where
import Data.List (maximumBy)
import Data.Foldable (forM_)
import System.Directory (createDirectoryIfMissing, renameFile)
import System.FilePath ((</>), splitFileName)
import Distribution.Package
......@@ -40,9 +41,7 @@ regenerateHaddockIndex :: Verbosity
regenerateHaddockIndex verbosity pkgs conf index = do
(paths, warns) <- haddockPackagePaths pkgs' Nothing
let paths' = [ (interface, html) | (interface, Just html) <- paths]
case warns of
Nothing -> return ()
Just m -> debug verbosity m
forM_ warns (debug verbosity)
(confHaddock, _, _) <-
requireProgramVersion verbosity haddockProgram
......
......@@ -49,7 +49,7 @@ manpage pname commands = unlines $
] ++
concatMap (commandSynopsisLines pname) commands ++
[ ".SH DESCRIPTION"
, "Cabal is the standard package system for Haskell software. It helps people to configure, "
, "Cabal is the standard package system for Haskell software. It helps people to configure, "
, "build and install Haskell software and to distribute it easily to other users and developers."
, ""
, "The command line " ++ pname ++ " tool (also referred to as cabal-install) helps with "
......@@ -84,7 +84,7 @@ commandSynopsisLines _ (CommandSpec _ _ HiddenCommand) = []
commandDetailsLines :: String -> CommandSpec action -> [String]
commandDetailsLines pname (CommandSpec ui _ NormalCommand) =
[ ".B " ++ pname ++ " " ++ (commandName ui)
[ ".B " ++ pname ++ " " ++ (commandName ui)
, ""
, commandUsage ui pname
, ""
......@@ -96,7 +96,7 @@ commandDetailsLines pname (CommandSpec ui _ NormalCommand) =
] ++
optionsLines ui ++
[ ".RE"
, ""
, ""
]
where
optional field =
......@@ -109,10 +109,10 @@ optionsLines :: CommandUI flags -> [String]
optionsLines command = concatMap optionLines (concatMap optionDescr (commandOptions command ParseArgs))
data ArgumentRequired = Optional | Required
type OptionArg = (ArgumentRequired, ArgPlaceHolder)
type OptionArg = (ArgumentRequired, ArgPlaceHolder)
optionLines :: OptDescr flags -> [String]
optionLines (ReqArg description (optionChars, optionStrings) placeHolder _ _) =
optionLines (ReqArg description (optionChars, optionStrings) placeHolder _ _) =
argOptionLines description optionChars optionStrings (Required, placeHolder)
optionLines (OptArg description (optionChars, optionStrings) placeHolder _ _ _) =
argOptionLines description optionChars optionStrings (Optional, placeHolder)
......
......@@ -33,7 +33,7 @@ import Distribution.Verbosity (Verbosity)
import Distribution.Version (Version(..), orLaterVersion)
import System.FilePath ((</>), (<.>))
import Control.Monad (when, unless)
import Control.Monad (when, unless, liftM)
import System.Directory (doesFileExist, removeFile, canonicalizePath)
import System.Process (runProcess, waitForProcess)
import System.Exit (ExitCode(..))
......@@ -41,9 +41,8 @@ import System.Exit (ExitCode(..))
-- |Create a source distribution.
sdist :: SDistFlags -> SDistExFlags -> IO ()
sdist flags exflags = do
pkg <- return . flattenPackageDescription
=<< readPackageDescription verbosity
=<< defaultPackageDesc verbosity
pkg <- liftM flattenPackageDescription
(readPackageDescription verbosity =<< defaultPackageDesc verbosity)
let withDir = if not needMakeArchive then (\f -> f tmpTargetDir)
else withTempDirectory verbosity tmpTargetDir "sdist."
-- 'withTempDir' fails if we don't create 'tmpTargetDir'...
......
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