Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack install pkg does not honor flag settings in pkg's stack.yaml #2371

Closed
joeyh opened this issue Jul 12, 2016 · 4 comments
Closed

stack install pkg does not honor flag settings in pkg's stack.yaml #2371

joeyh opened this issue Jul 12, 2016 · 4 comments

Comments

@joeyh
Copy link

joeyh commented Jul 12, 2016

A user filed a bug http://git-annex.branchable.com/bugs/does_not_build_on_OpenBSD_5.9/ which turned out to be caused by "stack install git-annex" apparently defaulting the xmpp build flag to true, despite the stack.yaml included in the package setting it to false. Meanwhile, "stack install" run inside the unpacked package does honor the stack.yaml.

That seems inconsistent and surprising.

(In my case, the cabal file defines the build flag, but doesn't explicitly set it to true or false.
When cabal is resolving the dependencies, this lets it enable the flag when the necessary dependencies are installed, and disable it otherwise. This had to be overridden in the stack.yaml because that flag pulls in dependencies that need C libraries that may not be available.)

@sjakobi
Copy link
Member

sjakobi commented Jul 13, 2016

When stack installs a package from an sdist tarball, it entirely ignores any included stack.yaml.

What seems to matter in this case is that the user's snapshot buildplan, maybe ~/.stack/build-plan/lts-6.7.yaml, lists the dependencies that are added by the XMPP flag (network-protocol-xmpp, gnutls, xml-types) among the dependencies for git-annex.

My hypothesis would be, that stackage uses cabal-install to create the buildplan and that cabal-install enables the XMPP flag as you described.
Is that correct @snoyberg? Or is there another reason why the flag is turned on?

In any case the snapshot buildplan looks problematic to me because the XMPP flag only ought to have an effect on non-Windows systems, i.e. should not add any dependencies on Windows.


stack's own behaviour is also not quite clear to me: When I run stack install git-annex --resolver ghc-8.0 on my Ubuntu machine , stack prompts me to add – among others – network-protocol-xmpp to the extra-deps, apparently turning on the XMPP flag. I'm not sure why that is. It would be interesting to know what happens on a Windows system in this case.

@sjakobi
Copy link
Member

sjakobi commented Jul 13, 2016

So my speculation above was pretty much entirely wrong.

The real issue is that by not providing a default flag setting in the cabal file, you're implicitly setting the default to True! This is specified in the cabal user guide, section "Configuration Flags", and is also the setting that stack will use by default.

The different behavior between cabal-install and stack comes from the differring usage of the manual property of a flag:

  • cabal-install will in doubt try both flag settings if manual is set to False which it is by default!
  • stack simply uses the default unless there's an explicit setting in the snapshot or from the user.

The proper resolution seems to be that you should add a default value of False to the xmpp flag (and possibly others).

@joeyh
Copy link
Author

joeyh commented Jul 19, 2016

Simon Jakobi wrote:

When stack installs a package from an sdist tarball, it entirely ignores any
included stack.yaml.

Why? What's the point of having a configuration file if it's not used?

see shy jo

@sjakobi
Copy link
Member

sjakobi commented Jul 19, 2016

Why? What's the point of having a configuration file if it's not used?

IMO the stack.yaml is currently intended only for the developers of a package. Their configurations might not necessarily be useful for the consumers of the package.

If stack were to take source-distributed stack.yaml files into account, which configurations should it use and which not? Should it use the location: git dependencies configured in that stack.yaml?

Maybe you'd like to chime in on #2122?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants