Commit 9796ec68 authored by Alexis Williams's avatar Alexis Williams

Musical chairs, part 1.5: more commands need warnings

parent e4294f31
......@@ -853,9 +853,9 @@ copyCommand = CommandUI
++ "Without the --destdir flag, configure determines location.\n"
, commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " build "
++ " " ++ pname ++ " copy "
++ " All the components in the package\n"
++ " " ++ pname ++ " build foo "
++ " " ++ pname ++ " copy foo "
++ " A component (i.e. lib, exe, test suite)"
, commandUsage = usageAlternatives "copy" $
[ "[FLAGS]"
......
......@@ -2,12 +2,16 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ViewPatterns #-}
module Distribution.Client.CmdLegacy (legacyCmd) where
module Distribution.Client.CmdLegacy ( legacyCmd, legacyWrapperCmd ) where
import Prelude ()
import Distribution.Client.Compat.Prelude
import Distribution.Client.Sandbox
( loadConfigOrSandboxConfig, findSavedDistPref )
import qualified Distribution.Client.Setup as Client
import Distribution.Client.SetupWrapper
( SetupScriptOptions(..), setupWrapper, defaultSetupScriptOptions )
import qualified Distribution.Simple.Setup as Setup
import Distribution.Simple.Command
import Distribution.Simple.Utils
......@@ -15,29 +19,42 @@ import Distribution.Simple.Utils
import Distribution.Verbosity
( Verbosity, normal )
import Control.Exception
( SomeException(..), try )
import qualified Data.Text as T
-- Duplicated code (it's identical to Main.regularCmd), but makes things cleaner
-- and lets me keep how this happens a dirty little secret.
makeCmd :: CommandUI flags -> (flags -> [String] -> action) -> CommandSpec action
makeCmd ui action = CommandSpec ui ((flip commandAddAction) action) NormalCommand
-- Tweaked versions of code from Main.
regularCmd :: (HasVerbosity flags) => CommandUI flags -> (flags -> [String] -> globals -> IO action) -> Bool -> CommandSpec (globals -> IO action)
regularCmd ui action shouldWarn =
CommandSpec ui ((flip commandAddAction) (\flags extra globals -> showWarning flags >> action flags extra globals)) NormalCommand
where
showWarning flags = if shouldWarn
then warn (verbosity flags) (deprecationNote (commandName ui) ++ "\n")
else return ()
deprecationNote :: String -> String
deprecationNote cmd =
"The " ++ cmd ++ " command is a part of the legacy v1 style of cabal usage.\n\n" ++
"Please switch to using either the new project style or the legacy v1-" ++ cmd ++ "\n" ++
"alias as new-style projects will become the default in the next version of\n" ++
"cabal-install. Please file a bug if you cannot replicate a working v1- use\n" ++
"case with the new-style commands.\n"
wrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> Bool -> CommandSpec (Client.GlobalFlags -> IO ())
wrapperCmd ui verbosity' distPref shouldWarn =
CommandSpec ui (\ui' -> wrapperAction ui' verbosity' distPref shouldWarn) NormalCommand
legacyNote :: String -> String
legacyNote cmd =
"The v1-" ++ cmd ++ " command is a part of the legacy v1 style of cabal usage.\n\n" ++
wrapperAction :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> Bool -> Command (Client.GlobalFlags -> IO ())
wrapperAction command verbosityFlag distPrefFlag shouldWarn =
commandAddAction command
{ commandDefaultFlags = mempty } $ \flags extraArgs globalFlags -> do
let verbosity' = Setup.fromFlagOrDefault normal (verbosityFlag flags)
"It is a legacy feature and will be removed in a future release of cabal-install.\n" ++
"Please file a bug if you cannot replicate a working v1- use case with the new-style\n" ++
"commands.\n"
if shouldWarn
then warn verbosity' (deprecationNote (commandName command) ++ "\n")
else return ()
load <- try (loadConfigOrSandboxConfig verbosity' globalFlags)
let config = either (\(SomeException _) -> mempty) snd load
distPref <- findSavedDistPref config (distPrefFlag flags)
let setupScriptOptions = defaultSetupScriptOptions { useDistPref = distPref }
let command' = command { commandName = T.unpack . T.replace "v1-" "" . T.pack . commandName $ command }
setupWrapper verbosity' setupScriptOptions Nothing
command' (const flags) (const extraArgs)
--
......@@ -80,30 +97,61 @@ instance HasVerbosity Client.UpdateFlags where
instance HasVerbosity Setup.CleanFlags where
verbosity = verbosity . Setup.cleanVerbosity
instance HasVerbosity Client.SDistFlags where
verbosity = verbosity . Client.sDistVerbosity
instance HasVerbosity Client.SandboxFlags where
verbosity = verbosity . Client.sandboxVerbosity
instance HasVerbosity Setup.DoctestFlags where
verbosity = verbosity . Setup.doctestVerbosity
--
legacyCmd :: (HasVerbosity flags) => CommandUI flags -> (flags -> [String] -> globals -> IO action) -> [CommandSpec (globals -> IO action)]
legacyCmd origUi@CommandUI{..} action = [makeCmd legUi action, makeCmd depUi depAction]
deprecationNote :: String -> String
deprecationNote cmd =
"The " ++ cmd ++ " command is a part of the legacy v1 style of cabal usage.\n\n" ++
"Please switch to using either the new project style or the legacy v1-" ++ cmd ++ "\n" ++
"alias as new-style projects will become the default in the next version of\n" ++
"cabal-install. Please file a bug if you cannot replicate a working v1- use\n" ++
"case with the new-style commands.\n"
legacyNote :: String -> String
legacyNote cmd =
"The v1-" ++ cmd ++ " command is a part of the legacy v1 style of cabal usage.\n\n" ++
"It is a legacy feature and will be removed in a future release of cabal-install.\n" ++
"Please file a bug if you cannot replicate a working v1- use case with the new-style\n" ++
"commands.\n"
toLegacyCmd :: (Bool -> CommandSpec (globals -> IO action)) -> [CommandSpec (globals -> IO action)]
toLegacyCmd mkSpec = [toDeprecated (mkSpec True), toLegacy (mkSpec False)]
where
legacyMsg = T.unpack . T.replace "v1-" "" . T.pack
depNote = deprecationNote commandName
legNote = legacyNote commandName
depAction flags extra globals = warn (verbosity flags) (depNote ++ "\n") >> action flags extra globals
legUi = origUi
{ commandName = "v1-" ++ commandName
, commandNotes = Just $ \pname -> case commandNotes of
Just notes -> notes pname ++ "\n" ++ legNote
Nothing -> legNote
}
depUi = origUi
{ commandName = legacyMsg commandName
, commandUsage = legacyMsg . commandUsage
, commandDescription = (legacyMsg .) <$> commandDescription
, commandNotes = Just $ \pname -> case commandNotes of
Just notes -> legacyMsg (notes pname) ++ "\n" ++ depNote
Nothing -> depNote
}
toLegacy (CommandSpec origUi@CommandUI{..} action type') = CommandSpec legUi action type'
where
legUi = origUi
{ commandName = "v1-" ++ commandName
, commandNotes = Just $ \pname -> case commandNotes of
Just notes -> notes pname ++ "\n" ++ legacyNote commandName
Nothing -> legacyNote commandName
}
toDeprecated (CommandSpec origUi@CommandUI{..} action type') = CommandSpec depUi action type'
where
depUi = origUi
{ commandName = legacyMsg commandName
, commandUsage = legacyMsg . commandUsage
, commandDescription = (legacyMsg .) <$> commandDescription
, commandNotes = Just $ \pname -> case commandNotes of
Just notes -> legacyMsg (notes pname) ++ "\n" ++ deprecationNote commandName
Nothing -> deprecationNote commandName
}
legacyCmd :: (HasVerbosity flags) => CommandUI flags -> (flags -> [String] -> globals -> IO action) -> [CommandSpec (globals -> IO action)]
legacyCmd ui action = toLegacyCmd (regularCmd ui action)
legacyWrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> [CommandSpec (Client.GlobalFlags -> IO ())]
legacyWrapperCmd ui verbosity' distPref = toLegacyCmd (wrapperCmd ui verbosity' distPref)
......@@ -51,6 +51,9 @@ module Distribution.Client.Setup
, manpageCommand
, haddockCommand
, cleanCommand
, doctestCommand
, copyCommand
, registerCommand
, parsePackageArgs
--TODO: stop exporting these:
......@@ -93,7 +96,8 @@ import Distribution.Simple.Setup
( ConfigFlags(..), BuildFlags(..), ReplFlags
, TestFlags(..), BenchmarkFlags(..)
, SDistFlags(..), HaddockFlags(..)
, CleanFlags(..)
, CleanFlags(..), DoctestFlags(..)
, CopyFlags(..), RegisterFlags(..)
, readPackageDbList, showPackageDbList
, Flag(..), toFlag, flagToMaybe, flagToList, maybeToFlag
, BooleanFlag(..), optionVerbosity
......@@ -209,6 +213,12 @@ globalCommand commands = CommandUI {
, "v1-update"
, "v1-install"
, "v1-clean"
, "v1-sdist"
, "v1-doctest"
, "v1-copy"
, "v1-register"
, "v1-reconfigure"
, "v1-sandbox"
]
maxlen = maximum $ [length name | (name, _) <- cmdDescs]
align str = str ++ replicate (maxlen - length str) ' '
......@@ -294,6 +304,12 @@ globalCommand commands = CommandUI {
, addCmd "v1-update"
, addCmd "v1-install"
, addCmd "v1-clean"
, addCmd "v1-sdist"
, addCmd "v1-doctest"
, addCmd "v1-copy"
, addCmd "v1-register"
, addCmd "v1-reconfigure"
, addCmd "v1-sandbox"
] ++ if null otherCmds then [] else par
:startGroup "other"
:[addCmd n | n <- otherCmds])
......@@ -659,17 +675,17 @@ reconfigureCommand
, commandDescription = Just $ \pname -> wrapText $
"Run `configure` with the most recently used flags, or append FLAGS "
++ "to the most recently used configuration. "
++ "Accepts the same flags as `" ++ pname ++ " configure'. "
++ "Accepts the same flags as `" ++ pname ++ " v1-configure'. "
++ "If the package has never been configured, the default flags are "
++ "used."
, commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " reconfigure\n"
++ " " ++ pname ++ " v1-reconfigure\n"
++ " Configure with the most recently used flags.\n"
++ " " ++ pname ++ " reconfigure -w PATH\n"
++ " " ++ pname ++ " v1-reconfigure -w PATH\n"
++ " Reconfigure with the most recently used flags,\n"
++ " but use the compiler at PATH.\n\n"
, commandUsage = usageAlternatives "reconfigure" [ "[FLAGS]" ]
, commandUsage = usageAlternatives "v1-reconfigure" [ "[FLAGS]" ]
, commandDefaultFlags = mempty
}
......@@ -2252,6 +2268,8 @@ defaultSDistExFlags = SDistExFlags {
sdistCommand :: CommandUI (SDistFlags, SDistExFlags)
sdistCommand = Cabal.sdistCommand {
commandUsage = \pname ->
"Usage: " ++ pname ++ " v1-sdist [FLAGS]\n",
commandDefaultFlags = (commandDefaultFlags Cabal.sdistCommand, defaultSDistExFlags),
commandOptions = \showOrParseArgs ->
liftOptions fst setFst (commandOptions Cabal.sdistCommand showOrParseArgs)
......@@ -2279,6 +2297,30 @@ instance Monoid SDistExFlags where
instance Semigroup SDistExFlags where
(<>) = gmappend
--
doctestCommand :: CommandUI DoctestFlags
doctestCommand = Cabal.doctestCommand
{ commandUsage = \pname -> "Usage: " ++ pname ++ " v1-doctest [FLAGS]\n" }
copyCommand :: CommandUI CopyFlags
copyCommand = Cabal.copyCommand
{ commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " v1-copy "
++ " All the components in the package\n"
++ " " ++ pname ++ " v1-copy foo "
++ " A component (i.e. lib, exe, test suite)"
, commandUsage = usageAlternatives "v1-copy" $
[ "[FLAGS]"
, "COMPONENTS [FLAGS]"
]
}
registerCommand :: CommandUI RegisterFlags
registerCommand = Cabal.registerCommand
{ commandUsage = \pname -> "Usage: " ++ pname ++ " v1-register [FLAGS]\n" }
-- ------------------------------------------------------------
-- * Win32SelfUpgrade flags
-- ------------------------------------------------------------
......@@ -2384,11 +2426,11 @@ sandboxCommand = CommandUI {
++ " packages are installed in the same database (i.e. the user's"
++ " database in the home directory)."
, paragraph $ "A sandbox in the current directory (created by"
++ " `sandbox init`) will be used instead of the user's database for"
++ " commands such as `install` and `build`. Note that (a directly"
++ " `v1-sandbox init`) will be used instead of the user's database for"
++ " commands such as `v1-install` and `v1-build`. Note that (a directly"
++ " invoked) GHC will not automatically be aware of sandboxes;"
++ " only if called via appropriate " ++ pname
++ " commands, e.g. `repl`, `build`, `exec`."
++ " commands, e.g. `v1-repl`, `v1-build`, `v1-exec`."
, paragraph $ "Currently, " ++ pname ++ " will not search for a sandbox"
++ " in folders above the current one, so cabal will not see the sandbox"
++ " if you are in a subfolder of a sandbox."
......@@ -2414,16 +2456,16 @@ sandboxCommand = CommandUI {
, indentParagraph $ "Remove an add-source dependency; however, this will"
++ " not delete the package(s) that have been installed in the sandbox"
++ " from this dependency. You can either unregister the package(s) via"
++ " `" ++ pname ++ " sandbox hc-pkg unregister` or re-create the"
++ " sandbox (`sandbox delete; sandbox init`)."
++ " `" ++ pname ++ " v1-sandbox hc-pkg unregister` or re-create the"
++ " sandbox (`v1-sandbox delete; v1-sandbox init`)."
, headLine "list-sources:"
, indentParagraph $ "List the directories of local packages made"
++ " available via `" ++ pname ++ " add-source`."
++ " available via `" ++ pname ++ " v1-sandbox add-source`."
, headLine "hc-pkg:"
, indentParagraph $ "Similar to `ghc-pkg`, but for the sandbox package"
++ " database. Can be used to list specific/all packages that are"
++ " installed in the sandbox. For subcommands, see the help for"
++ " ghc-pkg. Affected by the compiler version specified by `configure`."
++ " ghc-pkg. Affected by the compiler version specified by `v1-configure`."
],
commandNotes = Just $ \pname ->
relevantConfigValuesText ["require-sandbox"
......@@ -2431,18 +2473,18 @@ sandboxCommand = CommandUI {
++ "\n"
++ "Examples:\n"
++ " Set up a sandbox with one local dependency, located at ../foo:\n"
++ " " ++ pname ++ " sandbox init\n"
++ " " ++ pname ++ " sandbox add-source ../foo\n"
++ " " ++ pname ++ " install --only-dependencies\n"
++ " " ++ pname ++ " v1-sandbox init\n"
++ " " ++ pname ++ " v1-sandbox add-source ../foo\n"
++ " " ++ pname ++ " v1-install --only-dependencies\n"
++ " Reset the sandbox:\n"
++ " " ++ pname ++ " sandbox delete\n"
++ " " ++ pname ++ " sandbox init\n"
++ " " ++ pname ++ " install --only-dependencies\n"
++ " " ++ pname ++ " v1-sandbox delete\n"
++ " " ++ pname ++ " v1-sandbox init\n"
++ " " ++ pname ++ " v1-install --only-dependencies\n"
++ " List the packages in the sandbox:\n"
++ " " ++ pname ++ " sandbox hc-pkg list\n"
++ " " ++ pname ++ " v1-sandbox hc-pkg list\n"
++ " Unregister the `broken` package from the sandbox:\n"
++ " " ++ pname ++ " sandbox hc-pkg -- --force unregister broken\n",
commandUsage = usageAlternatives "sandbox"
++ " " ++ pname ++ " v1-sandbox hc-pkg -- --force unregister broken\n",
commandUsage = usageAlternatives "v1-sandbox"
[ "init [FLAGS]"
, "delete [FLAGS]"
, "add-source [FLAGS] PATHS"
......
......@@ -49,15 +49,18 @@ import Distribution.Client.Setup
, manpageCommand
, haddockCommand
, cleanCommand
, doctestCommand
, copyCommand
, registerCommand
)
import Distribution.Simple.Setup
( HaddockTarget(..)
, DoctestFlags(..), doctestCommand
, DoctestFlags(..)
, HaddockFlags(..), defaultHaddockFlags
, HscolourFlags(..), hscolourCommand
, ReplFlags(..)
, CopyFlags(..), copyCommand
, RegisterFlags(..), registerCommand
, CopyFlags(..)
, RegisterFlags(..)
, CleanFlags(..)
, TestFlags(..), BenchmarkFlags(..)
, Flag(..), fromFlag, fromFlagOrDefault, flagToMaybe, toFlag
......@@ -279,25 +282,19 @@ mainWorker args = topHandler $
commands = map commandFromSpec commandSpecs
commandSpecs =
[ regularCmd listCommand listAction
[ regularCmd listCommand listAction
, regularCmd infoCommand infoAction
, regularCmd fetchCommand fetchAction
, regularCmd getCommand getAction
, hiddenCmd unpackCommand unpackAction
, regularCmd checkCommand checkAction
, regularCmd sdistCommand sdistAction
, regularCmd uploadCommand uploadAction
, regularCmd reportCommand reportAction
, regularCmd initCommand initAction
, regularCmd reconfigureCommand reconfigureAction
, regularCmd sandboxCommand sandboxAction
, regularCmd doctestCommand doctestAction
, regularCmd userConfigCommand userConfigAction
, regularCmd genBoundsCommand genBoundsAction
, regularCmd outdatedCommand outdatedAction
, wrapperCmd copyCommand copyVerbosity copyDistPref
, wrapperCmd hscolourCommand hscolourVerbosity hscolourDistPref
, wrapperCmd registerCommand regVerbosity regDistPref
, hiddenCmd uninstallCommand uninstallAction
, hiddenCmd formatCommand formatAction
, hiddenCmd upgradeCommand upgradeAction
......@@ -330,6 +327,12 @@ mainWorker args = topHandler $
, legacyCmd benchmarkCommand benchmarkAction
, legacyCmd execCommand execAction
, legacyCmd cleanCommand cleanAction
, legacyCmd sdistCommand sdistAction
, legacyCmd doctestCommand doctestAction
, legacyWrapperCmd copyCommand copyVerbosity copyDistPref
, legacyWrapperCmd registerCommand regVerbosity regDistPref
, legacyCmd reconfigureCommand reconfigureAction
, legacyCmd sandboxCommand sandboxAction
]
type Action = GlobalFlags -> IO ()
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-sandbox add-source
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal v1-install
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox-ghc-pkg.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox-ghc-pkg.dist/sandbox
# cabal v1-exec
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox-hc-pkg.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox-hc-pkg.dist/sandbox
# cabal v1-exec
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox-path.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox-path.dist/sandbox
# cabal v1-exec
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal v1-exec
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox-shadow.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox-shadow.dist/sandbox
# cabal sandbox add-source
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
Configuring p-0.1.0.0...
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
Configuring p-0.1.0.0...
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
In order, the following would be installed:
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal v1-install
......@@ -8,7 +8,7 @@ Preprocessing library for Cabal-1.2..
Building library for Cabal-1.2..
Installing library in <PATH>
Installed Cabal-1.2
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
Configuring Cabal-2.0...
......
# cabal sdist
# cabal v1-sdist
List of package sources written to file '<TMPDIR>/sources'
List of package sources written to file '<TMPDIR>/sources'
......@@ -2,6 +2,6 @@ import Test.Cabal.Prelude
main = cabalTest $ do
tmpdir <- fmap testTmpDir getTestEnv
let fn = tmpdir </> "sources"
cabal "sdist" ["--list-sources=" ++ fn]
cabal "v1-sdist" ["--list-sources=" ++ fn]
-- --list-sources outputs with slashes on posix and backslashes on Windows. 'normalise' converts our needle to the necessary format.
assertFileDoesContain fn $ normalise "foo.dat"
# cabal sdist
# cabal v1-sdist
cabal: filepath wildcard './actually-a-directory' does not match any files.
......@@ -2,5 +2,5 @@ import Test.Cabal.Prelude
main = cabalTest $ do
tmpdir <- fmap testTmpDir getTestEnv
let fn = tmpdir </> "sources"
res <- fails $ cabal' "sdist" ["--list-sources=" ++ fn]
res <- fails $ cabal' "v1-sdist" ["--list-sources=" ++ fn]
assertOutputContains "filepath wildcard './actually-a-directory' does not match any files" res
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/cabal.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/cabal.dist/sandbox
# cabal sandbox add-source
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
Configuring q-0.1.0.0...
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal v1-sandbox add-source
# cabal v1-install
Resolving dependencies...
Configuring q-1.0...
......
# cabal sandbox init
# cabal v1-sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal sandbox delete-source
# cabal v1-sandbox add-source
# cabal v1-sandbox delete-source
Warning: Sources not registered: "q"
cabal: The sources with the above errors were skipped. ("q")
# cabal sandbox add-source
# cabal sandbox delete-source
# cabal v1-sandbox add-source
# cabal v1-sandbox delete-source
Success deleting sources: "p" "q"
Note: 'sandbox delete-source' only unregisters the source dependency, but does not remove the package from the sandbox package DB.
......
......@@ -166,6 +166,11 @@ setup' cmd args = do
, "update"
, "install"
, "clean"
, "register"
, "copy"
, "sdist"
, "reconfigure"
, "doctest"
]
(a:as) = full_args
full_args' = if a `elem` legacyCmds then ("v1-" ++ a) : as else a:as
......@@ -309,11 +314,11 @@ cabal_sandbox' :: String -> [String] -> TestM Result
cabal_sandbox' cmd args = do
env <- getTestEnv
let cabal_args = [ "--sandbox-config-file", testSandboxConfigFile env
, "sandbox", cmd
, "v1-sandbox", cmd
, marked_verbose ]
++ args
defaultRecordMode RecordMarked $ do
recordHeader ["cabal", "sandbox", cmd]
recordHeader ["cabal", "v1-sandbox", cmd]
cabal_raw' cabal_args
cabal_raw' :: [String] -> TestM Result
......
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