patch: --enable-tests and --only-dependencies

Hi Cabal, When trying to use "cabal install --enable-tests --only-dependencies" it appears to be passing the "--enable-tests" option down to the dependent packages during build. This isn't what I want at all - I only want to use the "--enable-tests" flag for the purpose of building an install plan. In addition, the dependency solver doesn't solve dependencies as if dependent packages would be built with "--enable-tests", so the "configure" step for these packages fails due to missing dependencies. My proposed fix is to strip the 'configTests' flag from the ConfigFlags after building the install plan but before doing the installation itself, because passing 'enable-tests' to the 'configure' step during 'cabal install' doesn't make much sense to me anyway. An alternative fix would be to have a separate set of config flags per source package to be installed, with --enable-tests only turned on for the original target packages. A patch is attached. Antoine

This has annoyed me as well. Thanks for fixing.
On Sat, Jan 7, 2012 at 10:59 AM, Antoine Latter
Hi Cabal,
When trying to use "cabal install --enable-tests --only-dependencies" it appears to be passing the "--enable-tests" option down to the dependent packages during build. This isn't what I want at all - I only want to use the "--enable-tests" flag for the purpose of building an install plan.
In addition, the dependency solver doesn't solve dependencies as if dependent packages would be built with "--enable-tests", so the "configure" step for these packages fails due to missing dependencies.
My proposed fix is to strip the 'configTests' flag from the ConfigFlags after building the install plan but before doing the installation itself, because passing 'enable-tests' to the 'configure' step during 'cabal install' doesn't make much sense to me anyway.
An alternative fix would be to have a separate set of config flags per source package to be installed, with --enable-tests only turned on for the original target packages.
A patch is attached.
Antoine
_______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel

On Sat, Jan 7, 2012 at 12:59 PM, Antoine Latter
Hi Cabal,
When trying to use "cabal install --enable-tests --only-dependencies" it appears to be passing the "--enable-tests" option down to the dependent packages during build. This isn't what I want at all - I only want to use the "--enable-tests" flag for the purpose of building an install plan.
Hello again, I would create a bug for this, except trac is down after massive spamming. Can someone review this patch? Sorry to be a bother, but the command 'cabal install --enable-tests --only-dependencies' is actually pretty common for me, since I do a lot of work with 'cabal-dev' (and so am re-installing dependencies all the time). Antoine
In addition, the dependency solver doesn't solve dependencies as if dependent packages would be built with "--enable-tests", so the "configure" step for these packages fails due to missing dependencies.
My proposed fix is to strip the 'configTests' flag from the ConfigFlags after building the install plan but before doing the installation itself, because passing 'enable-tests' to the 'configure' step during 'cabal install' doesn't make much sense to me anyway.
An alternative fix would be to have a separate set of config flags per source package to be installed, with --enable-tests only turned on for the original target packages.
A patch is attached.
Antoine

On Thu, Feb 2, 2012 at 3:13 PM, Antoine Latter
On Sat, Jan 7, 2012 at 12:59 PM, Antoine Latter
wrote: Hi Cabal,
When trying to use "cabal install --enable-tests --only-dependencies" it appears to be passing the "--enable-tests" option down to the dependent packages during build. This isn't what I want at all - I only want to use the "--enable-tests" flag for the purpose of building an install plan.
Hello again,
I would create a bug for this, except trac is down after massive spamming.
Can someone review this patch? Sorry to be a bother, but the command 'cabal install --enable-tests --only-dependencies' is actually pretty common for me, since I do a lot of work with 'cabal-dev' (and so am re-installing dependencies all the time).
Thomas Tuegel (CCed) would be the right person to review this. If I do cabal install --enable-tests --only-dependencies with your patch I wil install test-suite dependencies of the current package (as in the current directory) only right? That seems like the intended effect. cabal configure --enable-tests is not affected, right? -- Johan

On Thu, Feb 2, 2012 at 5:39 PM, Johan Tibell
If I do
cabal install --enable-tests --only-dependencies
with your patch I wil install test-suite dependencies of the current package (as in the current directory) only right? That seems like the intended effect. cabal configure --enable-tests is not affected, right?
Yes, that still happens. My change should be down-stream of the dependency solver, so it still does whatever it did. The difference is that now when we call 'configure' on each candidate package, we never pass '--enable-tests' during the 'install' command. This leads to 'cabal install $pkg --enable-tests' installing test dependencies but then not building the test suite for the target package - this is weird, but I'm not sure what we would do with the test suite after we built it. If we had a 'auto run test suites on install' feature, we would need some way to only tweak the config flags of the non-target packages. But I didn't do that. Antoine

On Thu, Feb 2, 2012 at 6:50 PM, Antoine Latter
On Thu, Feb 2, 2012 at 5:39 PM, Johan Tibell
wrote: If I do
cabal install --enable-tests --only-dependencies
with your patch I wil install test-suite dependencies of the current package (as in the current directory) only right? That seems like the intended effect. cabal configure --enable-tests is not affected, right?
Yes, that still happens.
My change should be down-stream of the dependency solver, so it still does whatever it did.
The difference is that now when we call 'configure' on each candidate package, we never pass '--enable-tests' during the 'install' command.
This leads to 'cabal install $pkg --enable-tests' installing test dependencies but then not building the test suite for the target package - this is weird, but I'm not sure what we would do with the test suite after we built it.
It seems weird, but I think it's sensible behavior (at least until/unless we implement an auto-run-tests feature). You patch looks good to me.
If we had a 'auto run test suites on install' feature, we would need some way to only tweak the config flags of the non-target packages. But I didn't do that.
Just thinking out loud about this a little: Luckily, I think there is relatively little demand for such a feature. Implementing it would involve unraveling the mess we get from passing config flags around. cabal-install automatically propagates any config flags down to all the targets (which your patch correctly disables for --enable-tests), but that happens _after_ dependency resolution, so we have to manually add --enable-tests to target packages before resolution. This is why we don't respect --enable-tests for named packages right now: there's no way to specify the flag during the dependency stage unless we have access to the package description. The way to handle tests for named packages would be to add a PackageConstraint for tests the way is already done for flags, but this is a lot more work because it would require getting deep into the dependency solver. However, it would make it easy to set the config flags during build for explicit targets so we could implement a test auto-run feature. Anyway, the patch looks good. Thanks for taking care of that! -- Thomas Tuegel
participants (3)
-
Antoine Latter
-
Johan Tibell
-
Thomas Tuegel