summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-04-25 12:09:12 -0700
committerDavid Terei <davidterei@gmail.com>2011-06-17 18:19:48 -0700
commit745e073efcb84037d629cd38c18aaaddd4f56e31 (patch)
tree9b472eb0b62ad24da5ae3df94ea4cb429ce4f607 /utils
parent530e25a6a1aaccc14630842f310bb4194ce97be0 (diff)
downloadhaskell-745e073efcb84037d629cd38c18aaaddd4f56e31.tar.gz
SafeHaskell: Add trust flag to packages
Diffstat (limited to 'utils')
-rw-r--r--utils/ghc-pkg/Main.hs22
1 files changed, 20 insertions, 2 deletions
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 52b79146b7..5e918a36f1 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -198,6 +198,12 @@ usageHeader prog = substProg prog $
" $p hide {pkg-id}\n" ++
" Hide the specified package.\n" ++
"\n" ++
+ " $p trust {pkg-id}\n" ++
+ " Trust the specified package.\n" ++
+ "\n" ++
+ " $p distrust {pkg-id}\n" ++
+ " Distrust the specified package.\n" ++
+ "\n" ++
" $p list [pkg]\n" ++
" List registered packages in the global database, and also the\n" ++
" user database if --user is given. If a package name is given\n" ++
@@ -344,6 +350,12 @@ runit verbosity cli nonopts = do
["hide", pkgid_str] -> do
pkgid <- readGlobPkgId pkgid_str
hidePackage pkgid verbosity cli force
+ ["trust", pkgid_str] -> do
+ pkgid <- readGlobPkgId pkgid_str
+ trustPackage pkgid verbosity cli force
+ ["distrust", pkgid_str] -> do
+ pkgid <- readGlobPkgId pkgid_str
+ distrustPackage pkgid verbosity cli force
["list"] -> do
listPackages verbosity cli Nothing Nothing
["list", pkgid_str] ->
@@ -413,7 +425,7 @@ globVersion = Version{ versionBranch=[], versionTags=["*"] }
-- Package databases
-- Some commands operate on a single database:
--- register, unregister, expose, hide
+-- register, unregister, expose, hide, trust, distrust
-- however these commands also check the union of the available databases
-- in order to check consistency. For example, register will check that
-- dependencies exist before registering a package.
@@ -859,7 +871,7 @@ updateDBCache verbosity db = do
else ioError e
-- -----------------------------------------------------------------------------
--- Exposing, Hiding, Unregistering are all similar
+-- Exposing, Hiding, Trusting, Distrusting, Unregistering are all similar
exposePackage :: PackageIdentifier -> Verbosity -> [Flag] -> Force -> IO ()
exposePackage = modifyPackage (\p -> ModifyPackage p{exposed=True})
@@ -867,6 +879,12 @@ exposePackage = modifyPackage (\p -> ModifyPackage p{exposed=True})
hidePackage :: PackageIdentifier -> Verbosity -> [Flag] -> Force -> IO ()
hidePackage = modifyPackage (\p -> ModifyPackage p{exposed=False})
+trustPackage :: PackageIdentifier -> Verbosity -> [Flag] -> Force -> IO ()
+trustPackage = modifyPackage (\p -> ModifyPackage p{trusted=True})
+
+distrustPackage :: PackageIdentifier -> Verbosity -> [Flag] -> Force -> IO ()
+distrustPackage = modifyPackage (\p -> ModifyPackage p{trusted=False})
+
unregisterPackage :: PackageIdentifier -> Verbosity -> [Flag] -> Force -> IO ()
unregisterPackage = modifyPackage RemovePackage