Commit 745e073e authored by dterei's avatar dterei

SafeHaskell: Add trust flag to packages

parent 530e25a6
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment