Commit 3dbcb15a authored by Alexis Williams's avatar Alexis Williams

Canonicalize `v2-` as standard prefix, update a bunch of tests

parent 312a5d91
......@@ -35,9 +35,9 @@ import Control.Monad (when)
benchCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
benchCommand = Client.installCommand {
commandName = "new-bench",
commandName = "v2-bench",
commandSynopsis = "Run benchmarks",
commandUsage = usageAlternatives "new-bench" [ "[TARGETS] [FLAGS]" ],
commandUsage = usageAlternatives "v2-bench" [ "[TARGETS] [FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Runs the specified benchmarks, first ensuring they are up to "
++ "date.\n\n"
......@@ -53,13 +53,13 @@ benchCommand = Client.installCommand {
++ "'cabal.project.local' and other files.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-bench\n"
++ " " ++ pname ++ " v2-bench\n"
++ " Run all the benchmarks in the package in the current directory\n"
++ " " ++ pname ++ " new-bench pkgname\n"
++ " " ++ pname ++ " v2-bench pkgname\n"
++ " Run all the benchmarks in the package named pkgname\n"
++ " " ++ pname ++ " new-bench cname\n"
++ " " ++ pname ++ " v2-bench cname\n"
++ " Run the benchmark named cname\n"
++ " " ++ pname ++ " new-bench cname -O2\n"
++ " " ++ pname ++ " v2-bench cname -O2\n"
++ " Run the benchmark built with '-O2' (including local libs used)\n\n"
++ cmdCommonHelpTextNewBuildBeta
......
......@@ -31,9 +31,9 @@ import qualified Data.Map as Map
buildCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
buildCommand = Client.installCommand {
commandName = "new-build",
commandName = "v2-build",
commandSynopsis = "Compile targets within the project.",
commandUsage = usageAlternatives "new-build" [ "[TARGETS] [FLAGS]" ],
commandUsage = usageAlternatives "v2-build" [ "[TARGETS] [FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Build one or more targets from within the project. The available "
++ "targets are the packages in the project as well as individual "
......@@ -48,15 +48,15 @@ buildCommand = Client.installCommand {
++ "'cabal.project.local' and other files.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-build\n"
++ " " ++ pname ++ " v2-build\n"
++ " Build the package in the current directory or all packages in the project\n"
++ " " ++ pname ++ " new-build pkgname\n"
++ " " ++ pname ++ " v2-build pkgname\n"
++ " Build the package named pkgname in the project\n"
++ " " ++ pname ++ " new-build ./pkgfoo\n"
++ " " ++ pname ++ " v2-build ./pkgfoo\n"
++ " Build the package in the ./pkgfoo directory\n"
++ " " ++ pname ++ " new-build cname\n"
++ " " ++ pname ++ " v2-build cname\n"
++ " Build the component named cname in the project\n"
++ " " ++ pname ++ " new-build cname --enable-profiling\n"
++ " " ++ pname ++ " v2-build cname --enable-profiling\n"
++ " Build the component in profiling mode (including dependencies as needed)\n\n"
++ cmdCommonHelpTextNewBuildBeta
......
......@@ -44,10 +44,10 @@ defaultCleanFlags = CleanFlags
cleanCommand :: CommandUI CleanFlags
cleanCommand = CommandUI
{ commandName = "new-clean"
{ commandName = "v2-clean"
, commandSynopsis = "Clean the package store and remove temporary files."
, commandUsage = \pname ->
"Usage: " ++ pname ++ " new-clean [FLAGS]\n"
"Usage: " ++ pname ++ " v2-clean [FLAGS]\n"
, commandDescription = Just $ \_ -> wrapText $
"Removes all temporary files created during the building process "
++ "(.hi, .o, preprocessed sources, etc.) and also empties out the "
......
......@@ -29,9 +29,9 @@ import qualified Distribution.Client.Setup as Client
configureCommand :: CommandUI (ConfigFlags, ConfigExFlags
,InstallFlags, HaddockFlags)
configureCommand = Client.installCommand {
commandName = "new-configure",
commandName = "v2-configure",
commandSynopsis = "Add extra project configuration",
commandUsage = usageAlternatives "new-configure" [ "[FLAGS]" ],
commandUsage = usageAlternatives "v2-configure" [ "[FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Adjust how the project is built by setting additional package flags "
++ "and other flags.\n\n"
......@@ -40,28 +40,28 @@ configureCommand = Client.installCommand {
++ "file (or '$project_file.local', if '--project-file' is specified) "
++ "which extends the configuration from the 'cabal.project' file "
++ "(if any). This combination is used as the project configuration for "
++ "all other commands (such as 'new-build', 'new-repl' etc) though it "
++ "all other commands (such as 'v2-build', 'v2-repl' etc) though it "
++ "can be extended/overridden on a per-command basis.\n\n"
++ "The new-configure command also checks that the project configuration "
++ "The v2-configure command also checks that the project configuration "
++ "will work. In particular it checks that there is a consistent set of "
++ "dependencies for the project as a whole.\n\n"
++ "The 'cabal.project.local' file persists across 'new-clean' but is "
++ "overwritten on the next use of the 'new-configure' command. The "
++ "The 'cabal.project.local' file persists across 'v2-clean' but is "
++ "overwritten on the next use of the 'v2-configure' command. The "
++ "intention is that the 'cabal.project' file should be kept in source "
++ "control but the 'cabal.project.local' should not.\n\n"
++ "It is never necessary to use the 'new-configure' command. It is "
++ "It is never necessary to use the 'v2-configure' command. It is "
++ "merely a convenience in cases where you do not want to specify flags "
++ "to 'new-build' (and other commands) every time and yet do not want "
++ "to 'v2-build' (and other commands) every time and yet do not want "
++ "to alter the 'cabal.project' persistently.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-configure --with-compiler ghc-7.10.3\n"
++ " " ++ pname ++ " v2-configure --with-compiler ghc-7.10.3\n"
++ " Adjust the project configuration to use the given compiler\n"
++ " program and check the resulting configuration works.\n"
++ " " ++ pname ++ " new-configure\n"
++ " " ++ pname ++ " v2-configure\n"
++ " Reset the local configuration to empty and check the overall\n"
++ " project configuration works.\n\n"
......
......@@ -4,7 +4,7 @@
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- Implementation of the 'new-exec' command for running an arbitrary executable
-- Implementation of the 'v2-exec' command for running an arbitrary executable
-- in an environment suited to the part of the store built for a project.
-------------------------------------------------------------------------------
......@@ -97,22 +97,22 @@ import qualified Data.Map as M
execCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
execCommand = CommandUI
{ commandName = "new-exec"
{ commandName = "v2-exec"
, commandSynopsis = "Give a command access to the store."
, commandUsage = \pname ->
"Usage: " ++ pname ++ " new-exec [FLAGS] [--] COMMAND [--] [ARGS]\n"
"Usage: " ++ pname ++ " v2-exec [FLAGS] [--] COMMAND [--] [ARGS]\n"
, commandDescription = Just $ \pname -> wrapText $
"During development it is often useful to run build tasks and perform"
++ " one-off program executions to experiment with the behavior of build"
++ " tools. It is convenient to run these tools in the same way " ++ pname
++ " itself would. The `" ++ pname ++ " new-exec` command provides a way to"
++ " itself would. The `" ++ pname ++ " v2-exec` command provides a way to"
++ " do so.\n"
++ "\n"
++ "Compiler tools will be configured to see the same subset of the store"
++ " that builds would see. The PATH is modified to make all executables in"
++ " the dependency tree available (provided they have been built already)."
++ " Commands are also rewritten in the way cabal itself would. For"
++ " example, `" ++ pname ++ " new-exec ghc` will consult the configuration"
++ " example, `" ++ pname ++ " v2-exec ghc` will consult the configuration"
++ " to choose an appropriate version of ghc and to include any"
++ " ghc-specific flags requested."
, commandNotes = Nothing
......
......@@ -51,9 +51,9 @@ import qualified Distribution.Client.Setup as Client
freezeCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
freezeCommand = Client.installCommand {
commandName = "new-freeze",
commandName = "v2-freeze",
commandSynopsis = "Freeze dependencies.",
commandUsage = usageAlternatives "new-freeze" [ "[FLAGS]" ],
commandUsage = usageAlternatives "v2-freeze" [ "[FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"The project configuration is frozen so that it will be reproducible "
++ "in future.\n\n"
......@@ -62,23 +62,23 @@ freezeCommand = Client.installCommand {
++ "the 'cabal.project.freeze' file (or '$project_file.freeze' if "
++ "'--project-file' is specified). This file extends the configuration "
++ "from the 'cabal.project' file and thus is used as the project "
++ "configuration for all other commands (such as 'new-build', "
++ "'new-repl' etc).\n\n"
++ "configuration for all other commands (such as 'v2-build', "
++ "'v2-repl' etc).\n\n"
++ "The freeze file can be kept in source control. To make small "
++ "adjustments it may be edited manually, or to make bigger changes "
++ "you may wish to delete the file and re-freeze. For more control, "
++ "one approach is to try variations using 'new-build --dry-run' with "
++ "one approach is to try variations using 'v2-build --dry-run' with "
++ "solver flags such as '--constraint=\"pkg < 1.2\"' and once you have "
++ "a satisfactory solution to freeze it using the 'new-freeze' command "
++ "a satisfactory solution to freeze it using the 'v2-freeze' command "
++ "with the same set of flags.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-freeze\n"
++ " " ++ pname ++ " v2-freeze\n"
++ " Freeze the configuration of the current project\n\n"
++ " " ++ pname ++ " new-build --dry-run --constraint=\"aeson < 1\"\n"
++ " " ++ pname ++ " v2-build --dry-run --constraint=\"aeson < 1\"\n"
++ " Check what a solution with the given constraints would look like\n"
++ " " ++ pname ++ " new-freeze --constraint=\"aeson < 1\"\n"
++ " " ++ pname ++ " v2-freeze --constraint=\"aeson < 1\"\n"
++ " Freeze a solution using the given constraints\n\n"
++ "Note: this command is part of the new project-based system (aka "
......
......@@ -34,9 +34,9 @@ import Control.Monad (when)
haddockCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags
,HaddockFlags)
haddockCommand = Client.installCommand {
commandName = "new-haddock",
commandName = "v2-haddock",
commandSynopsis = "Build Haddock documentation",
commandUsage = usageAlternatives "new-haddock" [ "[FLAGS] TARGET" ],
commandUsage = usageAlternatives "v2-haddock" [ "[FLAGS] TARGET" ],
commandDescription = Just $ \_ -> wrapText $
"Build Haddock documentation for the specified packages within the "
++ "project.\n\n"
......@@ -56,7 +56,7 @@ haddockCommand = Client.installCommand {
++ "'cabal.project.local' and other files.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-haddock pkgname"
++ " " ++ pname ++ " v2-haddock pkgname"
++ " Build documentation for the package named pkgname\n\n"
++ cmdCommonHelpTextNewBuildBeta
......@@ -153,7 +153,7 @@ selectPackageTargets haddockFlags targetSelector targets
isRequested _ LibKind = True
-- isRequested _ SubLibKind = True --TODO: what about sublibs?
-- TODO/HACK, we encode some defaults here as new-haddock's logic;
-- TODO/HACK, we encode some defaults here as v2-haddock's logic;
-- make sure this matches the defaults applied in
-- "Distribution.Client.ProjectPlanning"; this may need more work
-- to be done properly
......
......@@ -155,10 +155,10 @@ installCommand :: CommandUI ( ConfigFlags, ConfigExFlags, InstallFlags
, HaddockFlags, NewInstallFlags
)
installCommand = CommandUI
{ commandName = "new-install"
{ commandName = "v2-install"
, commandSynopsis = "Install packages."
, commandUsage = usageAlternatives
"new-install" [ "[TARGETS] [FLAGS]" ]
"v2-install" [ "[TARGETS] [FLAGS]" ]
, commandDescription = Just $ \_ -> wrapText $
"Installs one or more packages. This is done by installing them "
++ "in the store and symlinking the executables in the directory "
......@@ -171,12 +171,12 @@ installCommand = CommandUI
++ "the previously installed libraries. This is currently not implemented."
, commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-install\n"
++ " " ++ pname ++ " v2-install\n"
++ " Install the package in the current directory\n"
++ " " ++ pname ++ " new-install pkgname\n"
++ " " ++ pname ++ " v2-install pkgname\n"
++ " Install the package named pkgname"
++ " (fetching it from hackage if necessary)\n"
++ " " ++ pname ++ " new-install ./pkgfoo\n"
++ " " ++ pname ++ " v2-install ./pkgfoo\n"
++ " Install the package in the ./pkgfoo directory\n"
++ cmdCommonHelpTextNewBuildBeta
......@@ -223,7 +223,7 @@ installCommand = CommandUI
-- estra packages and using a temporary dist directory.
-- * libraries
-- Libraries install through a similar process, but using GHC environment
-- files instead of symlinks. This means that 'new-install'ing libraries
-- files instead of symlinks. This means that 'v2-install'ing libraries
-- only works on GHC >= 8.0.
--
-- For more details on how this works, see the module
......
......@@ -15,7 +15,7 @@ import Distribution.Client.SetupWrapper
import qualified Distribution.Simple.Setup as Setup
import Distribution.Simple.Command
import Distribution.Simple.Utils
( warn, wrapText )
( wrapText )
import Distribution.Verbosity
( Verbosity, normal )
......@@ -24,28 +24,20 @@ import Control.Exception
import qualified Data.Text as T
-- 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 ()
regularCmd :: (HasVerbosity flags) => CommandUI flags -> (flags -> [String] -> globals -> IO action) -> CommandSpec (globals -> IO action)
regularCmd ui action =
CommandSpec ui ((flip commandAddAction) (\flags extra globals -> action flags extra globals)) NormalCommand
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
wrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> CommandSpec (Client.GlobalFlags -> IO ())
wrapperCmd ui verbosity' distPref =
CommandSpec ui (\ui' -> wrapperAction ui' verbosity' distPref) NormalCommand
wrapperAction :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> Bool -> Command (Client.GlobalFlags -> IO ())
wrapperAction command verbosityFlag distPrefFlag shouldWarn =
wrapperAction :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verbosity) -> (flags -> Setup.Flag String) -> Command (Client.GlobalFlags -> IO ())
wrapperAction command verbosityFlag distPrefFlag =
commandAddAction command
{ commandDefaultFlags = mempty } $ \flags extraArgs globalFlags -> do
let verbosity' = Setup.fromFlagOrDefault normal (verbosityFlag flags)
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)
......@@ -108,17 +100,6 @@ instance HasVerbosity Setup.DoctestFlags where
--
deprecationNote :: String -> String
deprecationNote cmd = wrapText $
"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 and the new-" ++ cmd ++
" command or the legacy v1-" ++ cmd ++ " alias as new-style projects will" ++
" become the default in the next version of cabal-install. Please file a" ++
" bug if you cannot replicate a working v1- use case with the new-style commands.\n\n" ++
"For more information, see: https://wiki.haskell.org/Cabal/NewBuild\n"
legacyNote :: String -> String
legacyNote cmd = wrapText $
"The v1-" ++ cmd ++ " command is a part of the legacy v1 style of cabal usage.\n\n" ++
......@@ -129,8 +110,8 @@ legacyNote cmd = wrapText $
"For more information, see: https://wiki.haskell.org/Cabal/NewBuild\n"
toLegacyCmd :: (Bool -> CommandSpec (globals -> IO action)) -> [CommandSpec (globals -> IO action)]
toLegacyCmd mkSpec = [toLegacy (mkSpec False)]
toLegacyCmd :: CommandSpec (globals -> IO action) -> [CommandSpec (globals -> IO action)]
toLegacyCmd mkSpec = [toLegacy mkSpec]
where
toLegacy (CommandSpec origUi@CommandUI{..} action type') = CommandSpec legUi action type'
where
......@@ -148,17 +129,19 @@ legacyWrapperCmd :: Monoid flags => CommandUI flags -> (flags -> Setup.Flag Verb
legacyWrapperCmd ui verbosity' distPref = toLegacyCmd (wrapperCmd ui verbosity' distPref)
newCmd :: CommandUI flags -> (flags -> [String] -> globals -> IO action) -> [CommandSpec (globals -> IO action)]
newCmd origUi@CommandUI{..} action = [cmd defaultUi, cmd v2Ui, cmd origUi]
newCmd origUi@CommandUI{..} action = [cmd defaultUi, cmd newUi, cmd origUi]
where
cmd ui = CommandSpec ui (flip commandAddAction action) NormalCommand
v2Msg = T.unpack . T.replace "new-" "v2-" . T.pack
v2Ui = origUi
{ commandName = v2Msg commandName
, commandUsage = v2Msg . commandUsage
, commandDescription = (v2Msg .) <$> commandDescription
, commandNotes = (v2Msg .) <$> commandDescription
newMsg = T.unpack . T.replace "v2-" "new-" . T.pack
newUi = origUi
{ commandName = newMsg commandName
, commandUsage = newMsg . commandUsage
, commandDescription = (newMsg .) <$> commandDescription
, commandNotes = (newMsg .) <$> commandDescription
}
defaultMsg = T.unpack . T.replace "new-" "" . T.pack
defaultMsg = T.unpack . T.replace "v2-" "" . T.pack
defaultUi = origUi
{ commandName = defaultMsg commandName
, commandUsage = defaultMsg . commandUsage
......
......@@ -140,12 +140,12 @@ envOptions _ =
replCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, ReplFlags, EnvFlags)
replCommand = Client.installCommand {
commandName = "new-repl",
commandName = "v2-repl",
commandSynopsis = "Open an interactive session for the given component.",
commandUsage = usageAlternatives "new-repl" [ "[TARGET] [FLAGS]" ],
commandUsage = usageAlternatives "v2-repl" [ "[TARGET] [FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Open an interactive session for a component within the project. The "
++ "available targets are the same as for the 'new-build' command: "
++ "available targets are the same as for the 'v2-build' command: "
++ "individual components within packages in the project, including "
++ "libraries, executables, test-suites or benchmarks. Packages can "
++ "also be specified in which case the library component in the "
......@@ -158,20 +158,20 @@ replCommand = Client.installCommand {
++ "'cabal.project.local' and other files.",
commandNotes = Just $ \pname ->
"Examples, open an interactive session:\n"
++ " " ++ pname ++ " new-repl\n"
++ " " ++ pname ++ " v2-repl\n"
++ " for the default component in the package in the current directory\n"
++ " " ++ pname ++ " new-repl pkgname\n"
++ " " ++ pname ++ " v2-repl pkgname\n"
++ " for the default component in the package named 'pkgname'\n"
++ " " ++ pname ++ " new-repl ./pkgfoo\n"
++ " " ++ pname ++ " v2-repl ./pkgfoo\n"
++ " for the default component in the package in the ./pkgfoo directory\n"
++ " " ++ pname ++ " new-repl cname\n"
++ " " ++ pname ++ " v2-repl cname\n"
++ " for the component named 'cname'\n"
++ " " ++ pname ++ " new-repl pkgname:cname\n"
++ " " ++ pname ++ " v2-repl pkgname:cname\n"
++ " for the component 'cname' in the package 'pkgname'\n\n"
++ " " ++ pname ++ " new-repl --build-depends lens\n"
++ " " ++ pname ++ " v2-repl --build-depends lens\n"
++ " add the latest version of the library 'lens' to the default component "
++ "(or no componentif there is no project present)\n"
++ " " ++ pname ++ " new-repl --build-depends \"lens >= 4.15 && < 4.18\"\n"
++ " " ++ pname ++ " v2-repl --build-depends \"lens >= 4.15 && < 4.18\"\n"
++ " add a version (constrained between 4.15 and 4.18) of the library 'lens' "
++ "to the default component (or no component if there is no project present)\n"
......
......@@ -110,9 +110,9 @@ import System.FilePath
runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
runCommand = Client.installCommand {
commandName = "new-run",
commandName = "v2-run",
commandSynopsis = "Run an executable.",
commandUsage = usageAlternatives "new-run"
commandUsage = usageAlternatives "v2-run"
[ "[TARGET] [FLAGS] [-- EXECUTABLE_FLAGS]" ],
commandDescription = Just $ \pname -> wrapText $
"Runs the specified executable-like component (an executable, a test, "
......@@ -134,13 +134,13 @@ runCommand = Client.installCommand {
++ "'cabal.project.local' and other files.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-run\n"
++ " " ++ pname ++ " v2-run\n"
++ " Run the executable-like in the package in the current directory\n"
++ " " ++ pname ++ " new-run foo-tool\n"
++ " " ++ pname ++ " v2-run foo-tool\n"
++ " Run the named executable-like (in any package in the project)\n"
++ " " ++ pname ++ " new-run pkgfoo:foo-tool\n"
++ " " ++ pname ++ " v2-run pkgfoo:foo-tool\n"
++ " Run the executable-like 'foo-tool' in the package 'pkgfoo'\n"
++ " " ++ pname ++ " new-run foo -O2 -- dothing --fooflag\n"
++ " " ++ pname ++ " v2-run foo -O2 -- dothing --fooflag\n"
++ " Build with '-O2' and run the program, passing it extra arguments.\n\n"
++ cmdCommonHelpTextNewBuildBeta
......
......@@ -87,10 +87,10 @@ import System.FilePath
sdistCommand :: CommandUI SdistFlags
sdistCommand = CommandUI
{ commandName = "new-sdist"
{ commandName = "v2-sdist"
, commandSynopsis = "Generate a source distribution file (.tar.gz)."
, commandUsage = \pname ->
"Usage: " ++ pname ++ " new-sdist [FLAGS] [PACKAGES]\n"
"Usage: " ++ pname ++ " v2-sdist [FLAGS] [PACKAGES]\n"
, commandDescription = Just $ \_ ->
"Generates tarballs of project packages suitable for upload to Hackage."
, commandNotes = Nothing
......
......@@ -35,9 +35,9 @@ import Control.Monad (when)
testCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags)
testCommand = Client.installCommand {
commandName = "new-test",
commandName = "v2-test",
commandSynopsis = "Run test-suites",
commandUsage = usageAlternatives "new-test" [ "[TARGETS] [FLAGS]" ],
commandUsage = usageAlternatives "v2-test" [ "[TARGETS] [FLAGS]" ],
commandDescription = Just $ \_ -> wrapText $
"Runs the specified test-suites, first ensuring they are up to "
++ "date.\n\n"
......@@ -53,16 +53,16 @@ testCommand = Client.installCommand {
++ "'cabal.project.local' and other files.\n\n"
++ "To pass command-line arguments to a test suite, see the "
++ "new-run command.",
++ "v2-run command.",
commandNotes = Just $ \pname ->
"Examples:\n"
++ " " ++ pname ++ " new-test\n"
++ " " ++ pname ++ " v2-test\n"
++ " Run all the test-suites in the package in the current directory\n"
++ " " ++ pname ++ " new-test pkgname\n"
++ " " ++ pname ++ " v2-test pkgname\n"
++ " Run all the test-suites in the package named pkgname\n"
++ " " ++ pname ++ " new-test cname\n"
++ " " ++ pname ++ " v2-test cname\n"
++ " Run the test-suite named cname\n"
++ " " ++ pname ++ " new-test cname --enable-coverage\n"
++ " " ++ pname ++ " v2-test cname --enable-coverage\n"
++ " Run the test-suite built with code coverage (including local libs used)\n\n"
++ cmdCommonHelpTextNewBuildBeta
......
......@@ -62,21 +62,21 @@ import qualified Hackage.Security.Client as Sec
updateCommand :: CommandUI ( ConfigFlags, ConfigExFlags
, InstallFlags, HaddockFlags )
updateCommand = Client.installCommand {
commandName = "new-update",
commandName = "v2-update",
commandSynopsis = "Updates list of known packages.",
commandUsage = usageAlternatives "new-update" [ "[FLAGS] [REPOS]" ],
commandUsage = usageAlternatives "v2-update" [ "[FLAGS] [REPOS]" ],
commandDescription = Just $ \_ -> wrapText $
"For all known remote repositories, download the package list.",
commandNotes = Just $ \pname ->
"REPO has the format <repo-id>[,<index-state>] where index-state follows\n"
++ "the same format and syntax that is supported by the --index-state flag.\n\n"
++ "Examples:\n"
++ " " ++ pname ++ " new-update\n"
++ " " ++ pname ++ " v2-update\n"
++ " Download the package list for all known remote repositories.\n\n"
++ " " ++ pname ++ " new-update hackage.haskell.org,@1474732068\n"
++ " " ++ pname ++ " new-update hackage.haskell.org,2016-09-24T17:47:48Z\n"
++ " " ++ pname ++ " new-update hackage.haskell.org,HEAD\n"
++ " " ++ pname ++ " new-update hackage.haskell.org\n"
++ " " ++ pname ++ " v2-update hackage.haskell.org,@1474732068\n"
++ " " ++ pname ++ " v2-update hackage.haskell.org,2016-09-24T17:47:48Z\n"
++ " " ++ pname ++ " v2-update hackage.haskell.org,HEAD\n"
++ " " ++ pname ++ " v2-update hackage.haskell.org\n"
++ " Download hackage.haskell.org at a specific index state.\n\n"
++ " " ++ pname ++ " new update hackage.haskell.org head.hackage\n"
++ " Download hackage.haskell.org and head.hackage\n"
......@@ -127,7 +127,7 @@ updateAction (configFlags, configExFlags, installFlags, haddockFlags)
parseArg s = case simpleParse s of
Just r -> return r
Nothing -> die' verbosity $
"'new-update' unable to parse repo: \"" ++ s ++ "\""
"'v2-update' unable to parse repo: \"" ++ s ++ "\""
updateRepoRequests <- mapM parseArg extraArgs
unless (null updateRepoRequests) $ do
......@@ -135,7 +135,7 @@ updateAction (configFlags, configExFlags, installFlags, haddockFlags)
unknownRepos = [r | (UpdateRequest r _) <- updateRepoRequests
, not (r `elem` remoteRepoNames)]
unless (null unknownRepos) $
die' verbosity $ "'new-update' repo(s): \""
die' verbosity $ "'v2-update' repo(s): \""
++ intercalate "\", \"" unknownRepos
++ "\" can not be found in known remote repo(s): "
++ intercalate ", " remoteRepoNames
......@@ -213,5 +213,5 @@ updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do
when (current_ts /= nullTimestamp) $
noticeNoWrap verbosity $
"To revert to previous state run:\n" ++
" cabal new-update '" ++ remoteRepoName (repoRemote repo)
" cabal v2-update '" ++ remoteRepoName (repoRemote repo)
++ "," ++ display current_ts ++ "'\n"
......@@ -625,7 +625,7 @@ basicInstallPolicy
-- | The policy used by all the standard commands, install, fetch, freeze etc
-- (but not the new-build and related commands).
-- (but not the v2-build and related commands).
--
-- It extends the 'basicInstallPolicy' with a policy on setup deps.
--
......
......@@ -198,7 +198,7 @@ getSourcePackages verbosity repoCtxt =
-- it was at a particular time.
--
-- TODO: Enhance to allow specifying per-repo 'IndexState's and also
-- report back per-repo 'IndexStateInfo's (in order for @new-freeze@
-- report back per-repo 'IndexStateInfo's (in order for @v2-freeze@
-- to access it)
getSourcePackagesAtIndexState :: Verbosity -> RepoContext -> Maybe IndexState
-> IO SourcePackageDb
......@@ -866,7 +866,7 @@ data IndexCacheEntry
= CachePackageId PackageId !BlockNo !Timestamp </