Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

pkgconf for delete.

  • Loading branch information...
commit 0ca0222f05da6252dfa8790f8ae52bf806c15057 1 parent d37fb9f
@kazu-yamamoto authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 Commands.hs
View
14 Commands.hs
@@ -59,25 +59,31 @@ uninstall _ nmver opts = do
db <- toPkgDB . flip toPkgList db' <$> userPkgs
pkg <- lookupPkg nmver db
let sortedPkgs = topSortedPkgs pkg db
+ mpkgConf <- case getSandbox opts of
+ Nothing -> return Nothing
+ Just path -> Just <$> getPackageConf path
if onlyOne && length sortedPkgs /= 1
then do
hPutStrLn stderr $ "The following packages depend on this. Use the \"-r\" option."
mapM_ (hPutStrLn stderr . fullNameOfPkgInfo) (init sortedPkgs)
else do
unless doit $ putStrLn "The following packages are deleted without the \"-n\" option."
- mapM_ (unregister doit) (map pairNameOfPkgInfo sortedPkgs)
+ mapM_ (unregister doit mpkgConf) (map pairNameOfPkgInfo sortedPkgs)
where
onlyOne = OptRecursive `notElem` opts
doit = OptNoharm `notElem` opts
-unregister :: Bool -> (String,String) -> IO ()
-unregister doit (name,ver) = if doit
+unregister :: Bool -> Maybe String -> (String,String) -> IO ()
+unregister doit mpkgConf (name,ver) = if doit
then do
putStrLn $ "Deleting " ++ name ++ " " ++ ver
when doit $ system script >> return ()
else putStrLn $ name ++ " " ++ ver
where
- script = "ghc-pkg unregister " ++ name ++ "-" ++ ver
+ script = "ghc-pkg unregister " ++ option ++ name ++ "-" ++ ver
+ option = case mpkgConf of
+ Nothing -> ""
+ Just pkgConf -> "--package-conf=" ++ pkgConf ++ " "
----------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.