composewell/packcheck

`cabal info` doesn't work for local packages not published to hackage

mitchellwrosen opened this issue · 14 comments

I noticed packcheck cabal-new uses cabal info . to get the name of the package we're building. This is failing with:

Assertion failed
CallStack (from HasCallStack):
  assert, called at ./Distribution/Client/List.hs:427:3 in cabal-install-2.1.0.0-inplace:Distribution.Client.List

I believe cabal info just hits the global and user package databases, but not the inplace database in dist-newstyle/

Thanks for reporting. Do you have a pointer to the failing build? Is this in CI or on your local machine?
cabal info is used when building from source distribution and for install test. I can try not using it when these two options are disabled from the command line so that we have a workaround. This looks like a cabal bug, need to file an issue in upstream repo if not already there.

@mitchellwrosen see if #14 helps you.

@harendra-kumar This is on my local machine when running packcheck.sh cabal-new.

It may be a cabal bug - but I'm not totally sure if cabal info is supposed to give info about the local package. It's not clear from the output of cabal info --help

#14 looks like it may help, but there's still a || die "cabal info failed" that is triggered when cabal info . fails.

Ah, I just forgot to remove that. Let me fix it.

Fixed it, check it out now.

Here's the behavior I get now.

$ packcheck.sh cabal-new
...
Assertion failed
CallStack (from HasCallStack):
  assert, called at ./Distribution/Client/List.hs:427:3 in cabal-install-2.1.0.0-inplace:Distribution.Client.List
Error: Please use 'DISABLE_SDIST_BUILD=y' to avoid this issue.
Error: PACKAGE_FULL_NAME
$ DISABLE_SDIST_BUILD=y packcheck.sh cabal-new
...
Assertion failed
CallStack (from HasCallStack):
  assert, called at ./Distribution/Client/List.hs:427:3 in cabal-install-2.1.0.0-inplace:Distribution.Client.List
Error: Inconsistent package name [my-package] and package full name []
Error: PACKAGE_FULL_NAME

I pushed a fix for the error, try again. I hope it works this time.

It works! :)

@mitchellwrosen the issue may not be because the package is not on hackage. I just tested it with one of my packages that is not on hackage and it succeeds. Maybe it is something else in your cabal file that is making it fail? You may want to file a bug with cabal providing your cabal file that's making it fail.

Interesting, good to know. Thanks for the help regardless!

It is also possible that this is a bug in some specific version of cabal. I tested it with cabal-install version 2.0.0.1. Which version is yours?

2.1.0.0

This version is not on hackage. I can see only 2.0.0.1 and then 2.2.0.0. I tried cabal info with 2.2.0.0 and it succeeds on a package that is not on hackage.

@mitchellwrosen closing this as we have a workaround. You can file a bug on cabal-install if you see the problem even in the latest version.