Permalink
Browse files

Specify with the other information which package manager is being used.

An extension to the fix for bug 317551
  • Loading branch information...
1 parent e75fe10 commit fcd05081e9cd217000c61a312712ff02a6ea1431 @ivan-m ivan-m committed May 7, 2010
Showing with 18 additions and 10 deletions.
  1. +7 −0 Distribution/Gentoo/PkgManager.hs
  2. +11 −10 Main.hs
@@ -13,6 +13,7 @@ module Distribution.Gentoo.PkgManager
, choosePM
, defaultPM
, defaultPMName
+ , nameOfPM
, dummy
, PMFlag(..)
, buildCmd
@@ -65,6 +66,12 @@ pmNameMap = M.fromList [ ("portage", Portage)
, ("paludis", Paludis)
]
+pmNameMap' :: Map PkgManager String
+pmNameMap' = M.fromList . map (\(nm,pm) -> (pm,nm)) $ M.toList pmNameMap
+
+nameOfPM :: PkgManager -> String
+nameOfPM = (pmNameMap' M.!)
+
-- | Choose the appropriate PM from the textual representation; throws
-- an error if that PM isn't known.
choosePM :: String -> Either String PkgManager
View
21 Main.hs
@@ -63,7 +63,7 @@ combineActions a1 a2 = case (a1 `min` a2) of
runAction :: RunModifier -> Action -> IO a
runAction _ Help = help
runAction _ Version = version
-runAction rm (Build ts) = do systemInfo
+runAction rm (Build ts) = do systemInfo rm
ps <- allGetPackages ts
buildPkgs rm ps
@@ -223,15 +223,16 @@ progInfo = do pName <- getProgName
\\n\
\Options:"
-systemInfo :: IO ()
-systemInfo = do ver <- ghcVersion
- pName <- getProgName
- pLoc <- ghcLoc
- libDir <- ghcLibDir
- putStrLn $ "Running " ++ pName ++ " using GHC " ++ ver
- putStrLn $ " * Executable: " ++ pLoc
- putStrLn $ " * Library directory: " ++ libDir
- putStrLn ""
+systemInfo :: RunModifier -> IO ()
+systemInfo rm = do ver <- ghcVersion
+ pName <- getProgName
+ pLoc <- ghcLoc
+ libDir <- ghcLibDir
+ putStrLn $ "Running " ++ pName ++ " using GHC " ++ ver
+ putStrLn $ " * Executable: " ++ pLoc
+ putStrLn $ " * Library directory: " ++ libDir
+ putStrLn $ " * Package manager: " ++ nameOfPM (pkgmgr rm)
+ putStrLn ""
-- -----------------------------------------------------------------------------
-- Utility functions

0 comments on commit fcd0508

Please sign in to comment.