summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libraries/bin-package-db/Distribution/InstalledPackageInfo/Binary.hs2
-rw-r--r--utils/ghc-pkg/Main.hs22
2 files changed, 22 insertions, 2 deletions
diff --git a/libraries/bin-package-db/Distribution/InstalledPackageInfo/Binary.hs b/libraries/bin-package-db/Distribution/InstalledPackageInfo/Binary.hs
index 47bb8f4690..15f7e8e957 100644
--- a/libraries/bin-package-db/Distribution/InstalledPackageInfo/Binary.hs
+++ b/libraries/bin-package-db/Distribution/InstalledPackageInfo/Binary.hs
@@ -65,6 +65,7 @@ putInstalledPackageInfo ipi = do
put (exposed ipi)
put (exposedModules ipi)
put (hiddenModules ipi)
+ put (trusted ipi)
put (importDirs ipi)
put (libraryDirs ipi)
put (hsLibraries ipi)
@@ -98,6 +99,7 @@ getInstalledPackageInfo = do
exposed <- get
exposedModules <- get
hiddenModules <- get
+ trusted <- get
importDirs <- get
libraryDirs <- get
hsLibraries <- get
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