Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix proposal for listing and uninstalling commands #9

Merged
merged 1 commit into from

2 participants

@facundominguez

Changes meaning of the userPkgs filter. Everything that is not in the global package database is now accepted by userPkgs.

This solves a few cases in which the previous version of userPkgs rejects packages in a sandbox because its path contains ".", "..", lowercase drive letters "c:" where uppercase would be expected, is not under the user home folder, etc.

This pull request supersedes that of branch list_sand_box_contents. The commits there have been merged into a single commit. See #7 for more details.

@facundominguez facundominguez Changes meaning of the userPkgs filter. Everything that is not in the
global package database is now accepted by userPkgs.

This solves a few cases in which the previous version of userPkgs
rejects packages in a sandbox because its path contains ".", "..",
lowercase drive letters "c:" where uppercase would be expected, is not
under the user home folder, etc.
8fc958b
@kazu-yamamoto kazu-yamamoto merged commit 8ab773a into kazu-yamamoto:master
@kazu-yamamoto

Seems good. I merged this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 3, 2012
  1. @facundominguez

    Changes meaning of the userPkgs filter. Everything that is not in the

    facundominguez authored
    global package database is now accepted by userPkgs.
    
    This solves a few cases in which the previous version of userPkgs
    rejects packages in a sandbox because its path contains ".", "..",
    lowercase drive letters "c:" where uppercase would be expected, is not
    under the user home folder, etc.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 12 deletions.
  1. +9 −12 PkgDB.hs
View
21 PkgDB.hs
@@ -2,10 +2,10 @@
module PkgDB where
-import Control.Applicative
import Control.Monad
import Data.List
import Data.Map (Map)
+import Data.Maybe (isNothing)
import qualified Data.Map as M
import Distribution.Compiler
(CompilerId(..))
@@ -30,7 +30,6 @@ import Distribution.Simple.Program.Db
import Distribution.Verbosity
(normal)
import System.FilePath
-import System.Directory
import Utils
type PkgDB = PackageIndex
@@ -46,6 +45,11 @@ getPkgDB mpath = do
Just path -> SpecificPackageDB $ packageConf path com
getInstalledPackages normal [GlobalPackageDB,userDB] pro
+getGlobalPkgDB :: IO PkgDB
+getGlobalPkgDB = do
+ (_,pro) <- configure normal Nothing Nothing defaultProgramDb
+ getInstalledPackages normal [GlobalPackageDB] pro
+
getPackageConf :: FilePath -> IO FilePath
getPackageConf path = do
(com,_) <- configure normal Nothing Nothing defaultProgramDb
@@ -85,16 +89,9 @@ toPkgList prd db = filter prd $ allPackages db
userPkgs :: IO (PkgInfo -> Bool)
userPkgs = do
-#ifdef darwin_HOST_OS
- -- drop "/."
- userDirPref <- takeDirectory <$> getAppUserDataDirectory ""
-#else
- userDirPref <- getAppUserDataDirectory ""
-#endif
- return $ \pkgi -> case libraryDirs pkgi of
- [] -> False -- haskell-platform for example
- xs -> any (userDirPref `isPrefixOf`) xs
-
+ gDB <- getGlobalPkgDB
+ return$ \pkgi -> isNothing$ lookupInstalledPackageId gDB (installedPackageId pkgi)
+
allPkgs :: IO (PkgInfo -> Bool)
allPkgs = return (const True)
Something went wrong with that request. Please try again.