Commit 18227a1b authored by simonmar's avatar simonmar
Browse files

Nicer messages for each pass

parent 54b6fb35
......@@ -42,12 +42,13 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Package (
PackageIdentifier(..),
PackageIdentifier(..),
showPackageId,
PackageDescription(..),
emptyPackageDescription
) where
import Distribution.Version(Version)
import Distribution.Version(Version, showVersion)
import Distribution.Misc(License(..), Dependency, Extension)
import Distribution.Setup(CompilerFlavor)
......@@ -55,6 +56,10 @@ data PackageIdentifier
= PackageIdentifier {pkgName::String, pkgVersion::Version}
deriving (Read, Show, Eq)
showPackageId :: PackageIdentifier -> String
showPackageId pkgid =
pkgName pkgid ++ '-': showVersion (pkgVersion pkgid)
-- | This data type is the internal representation of the file @pkg.descr@.
-- It contains two kinds of information about the package: information
-- which is needed for all packages, such as the package name and version, and
......
......@@ -43,15 +43,16 @@ module Distribution.Simple.Build (
build
) where
import Distribution.Package(PackageDescription)
import Distribution.Package
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Simple.Utils(setupMessage)
import System.IO
import System.Exit
build :: PackageDescription -> LocalBuildInfo -> IO ()
build pkg_descr lbi = do
hPutStrLn stderr "ToDo: building..."
setupMessage "Configuring" pkg_descr
exitWith (ExitFailure 1)
-- construct ghc --make command line
......
......@@ -50,7 +50,7 @@ module Distribution.Simple.Configure (writePersistBuildConfig,
import Distribution.Setup(ConfigFlags,CompilerFlavor(..), Compiler(..))
import Distribution.Package(PackageDescription(..))
import Distribution.Simple.Utils (splitFilenameDir, die, split)
import Distribution.Simple.Utils (splitFilenameDir, die, split, setupMessage)
import System.IO hiding (catch)
import System.Exit
......@@ -91,16 +91,17 @@ localBuildInfoFile = "./.setup-config"
-- Configuration
configure :: PackageDescription -> ConfigFlags -> IO LocalBuildInfo
configure pkgconfig (maybe_hc_flavor, maybe_hc_path, maybe_prefix)
configure pkg_descr (maybe_hc_flavor, maybe_hc_path, maybe_prefix)
= do
setupMessage "Configuring" pkg_descr
-- prefix
let prefix = case maybe_prefix of
Just path -> path
Nothing -> system_default_prefix pkgconfig
Nothing -> system_default_prefix pkg_descr
message $ "Using build prefix: " ++ prefix
-- detect compiler
compiler@(Compiler f' p' pkg) <- configCompiler maybe_hc_flavor maybe_hc_path pkgconfig
compiler@(Compiler f' p' pkg) <- configCompiler maybe_hc_flavor maybe_hc_path pkg_descr
message $ "Using compiler flavor: " ++ (show f')
message $ "Using compiler: " ++ p'
message $ "Using package tool: " ++ pkg
......@@ -119,21 +120,21 @@ system_default_prefix PackageDescription{package=package} =
configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> PackageDescription
-> IO Compiler
configCompiler (Just flavor) (Just path) pkgconfig
configCompiler (Just flavor) (Just path) pkg_descr
= do pkgtool <- guessPkgToolFromHCPath flavor path
return (Compiler{compilerFlavor=flavor,
compilerPath=path,
compilerPkgTool=pkgtool})
configCompiler (Just flavor) Nothing pkgconfig
configCompiler (Just flavor) Nothing pkg_descr
= do path <- findCompiler flavor
pkgtool <- guessPkgToolFromHCPath flavor path
return (Compiler{compilerFlavor=flavor,
compilerPath=path,
compilerPkgTool=pkgtool})
configCompiler Nothing maybe_path pkgconfig
= configCompiler (Just defaultCompilerFlavor) maybe_path pkgconfig
configCompiler Nothing maybe_path pkg_descr
= configCompiler (Just defaultCompilerFlavor) maybe_path pkg_descr
defaultCompilerFlavor =
#if defined(__GLASGOW_HASKELL__)
......
......@@ -41,10 +41,18 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Install(install) where
module Distribution.Simple.Install (
install
) where
import Distribution.Package(PackageDescription)
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Simple.Utils(setupMessage)
import System.Exit
install :: PackageDescription -> LocalBuildInfo -> IO ()
install _ _ = return ()
install pkg_descr localbuildinfo = do
setupMessage "Installing" pkg_descr
exitWith (ExitFailure 1)
......@@ -49,16 +49,17 @@ module Distribution.Simple.Register (
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Package(PackageDescription)
import Distribution.InstalledPackageInfo(InstalledPackageInfo)
import Distribution.Simple.Utils(setupMessage)
import System.IO
import System.Exit
register :: PackageDescription -> LocalBuildInfo -> IO ()
register pkg_descr lbi = do
hPutStrLn stderr "ToDo: registering..."
setupMessage "Registering" pkg_descr
exitWith (ExitFailure 1)
unregister :: PackageDescription -> LocalBuildInfo -> IO ()
unregister pkg_descr lbi = do
hPutStrLn stderr "ToDo: unregistering..."
setupMessage "Unregistering" pkg_descr
exitWith (ExitFailure 1)
......@@ -45,11 +45,12 @@ module Distribution.Simple.SrcDist (
import Distribution.Package(PackageDescription)
import Distribution.Simple.Configure(LocalBuildInfo)
import Distribution.Simple.Utils(setupMessage)
import System.IO
import System.Exit
sdist :: PackageDescription -> LocalBuildInfo -> IO ()
sdist pkg_descr lbi = do
hPutStrLn stderr "ToDo: sdisting..."
setupMessage "Building source dist for" pkg_descr
exitWith (ExitFailure 1)
......@@ -46,9 +46,12 @@ module Distribution.Simple.Utils (
splitFilenameDir,
split,
isPathSeparator,
die
setupMessage,
die,
) where
import Distribution.Package
import System.IO
import System.Exit
......@@ -81,5 +84,9 @@ isPathSeparator ch =
ch == '/'
#endif
setupMessage :: String -> PackageDescription -> IO ()
setupMessage msg pkg_descr =
putStrLn (msg ++ ' ':showPackageId (package pkg_descr) ++ "...")
die :: String -> IO a
die msg = do hPutStr stderr msg; exitWith (ExitFailure 1)
Supports Markdown
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