
On Fri, 2013-03-15 at 12:47 +0100, Mikhail Glushenkov wrote:
Hi,
On Fri, Mar 15, 2013 at 8:14 AM, Andres Löh
wrote: No, please do not remove it. Running install without --only causes all sorts of things to happen, because install is the magic command. The --only flag is for use after you have already run build and really only does the installation, i.e. It behaves comparable to Setup install.
Yes, I see from the code what it does, it's just that I think that the option is obscure and very rarely used. It's not shown in the --help output, though, so I guess it's not a big problem.
As other people have pointed out it's rather useful. The reason it's there is because our UI is confused. It's a wart that needs fixing not by removing it, but by removing the need for it. When we had the old "runhaskell Setup {configure,build,install}" interface then it was clear that the commands acted only on the local package and only did one step of the process: you had to have done the other steps first. When we moved to cabal-install, we wanted automation and a "do everything" command. So the install command will configure, build and install. But there isn't a proper dependency mechanism and there isn't a proper tracking of configuration state. So install always reconfigures, loosing any configuration you did previously with cabal configure. So that means if you do: cabal {configure --blah,build,install} then you loose that --blah config. So because of that one does sometimes want a --only. It's hidden because it's not official UI. So what would a proper UI look like here? I think one should consider it in the new context of sandboxes, or more generally the idea that in future the cabal command line UI does not act on individual packages in isolation but on packages in the context of an environment containing a set of source packages. So when I'm in an environment and I say configure on a package, that should save semi-persistently the config settings I give (and do package dependency analysis, if necessary it should (re)configure the other source packages in the environment that this one depends on). The build and install commands should work in a make-like fashion in that they have to be able to discover/check which packages are up to date (including if they are configured already, and if we already had an up to date InstallPlan). So install --only is redundant because install will do the right thing if you've already configured and built. And that's of course the reason we still have --only, because we don't have a proper make-like system for checking if packages are already configured or built etc. Duncan