Cabal: setup: Can't parse verbosity silent

Created on 13 Mar 2017  路  9Comments  路  Source: haskell/cabal

cabal-install seems to pass -v silent to Custom Setup.hs too.

bug

All 9 comments

i.e. showForCabal breaks when using Custom Setup.hs with older Cabal.

cc @ezyang

@phadej can you test this patch

diff --git a/Cabal/Distribution/Verbosity.hs b/Cabal/Distribution/Verbosity.hs
index 959747b14..43a1249b7 100644
--- a/Cabal/Distribution/Verbosity.hs
+++ b/Cabal/Distribution/Verbosity.hs
@@ -167,7 +167,7 @@ flagToVerbosity = ReadE $ \s ->
 showForCabal, showForGHC :: Verbosity -> String

 showForCabal v
-    | Set.null (vFlags v)
+    | vFlags v `Set.isSubsetOf` Set.fromList [VQuiet]
     = maybe (error "unknown verbosity") show $
         elemIndex v [silent,normal,verbose,deafening]
     | otherwise

The "obvious" test doesn't repro for me but I read the code and I think I know what the problem is.

Seems to work. Is showForCabal change in 2.0, do we need to push it there too? @ezyang will you do? Thanks for prompt response

The bug is also in 2.0, with @hvr's cabal-install-2.0, (Herbert, would be great to have an updated package as soon as issue is fixed, otherwise it's impossible to build Custom packages on travis)

% cabal --version
cabal-install version 2.0.0.0
compiled using version 2.0.0.0 of the Cabal library 

% cabal new-build
In order, the following will be built (use -v for more details):
 - futurice-prelude-1 (lib:futurice-prelude) (first run)
Preprocessing library futurice-prelude-1...
Can't parse verbosity silent
CallStack (from HasCallStack):
error, called at libraries/Cabal/Cabal/Distribution/ReadE.hs:44:24 in
Cabal-1.24.0.0:Distribution.ReadE

I'm still a bit puzzled, because I can't trigger this when I make a simple Custom package and try to build it, even if it's built against 1.24. Maybe it's new-build only?

I tried only new-build, so maybe.

Workaround: cabal new-build -v2 doesn't seem to execute the same code path: the

/home/ogre/Documents/haskell-futurice-prelude/dist-newstyle/build/x86_64-linux/ghc-8.0.1/futurice-prelude-1/setup/setup
register --verbose=2 ...

is used then

OK, this explains why the test suite didn't catch it; we always operate at -v2 in test suite! Patch incoming plus test.

Was this page helpful?
0 / 5 - 0 ratings