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

Flags are not being overridden for local extra-deps #5375

Open
jasagredo opened this issue Aug 26, 2020 · 2 comments
Open

Flags are not being overridden for local extra-deps #5375

jasagredo opened this issue Aug 26, 2020 · 2 comments

Comments

@jasagredo
Copy link

jasagredo commented Aug 26, 2020

General summary/comments

When having local packages that have cabal flags and setting them either with the cli --flag PACKAGE:[-]FLAG argument or on the stack.yaml file, the flag is not changed. It works properly for remote packages.

Steps to reproduce

I created a sample project that has an internal sub-project and a remote dependency. To observe this behavior, the inner package has to have a flag defined and so must the remote dependency. Setting a value for the local flag doesn't change the behavior.

sample.zip

For instance, in this example we have:

  • the sample project which depends on cryptonite and othersample.
  • cryptonite has a bunch of flags and for the example I am using support_deepseq which by default is True. I will set it to False on the stack.yaml file.
  • othersample has a flag hello that is False by default. I will set it to True both by adding it in the stack.yaml file and providing the cli argument.

The sample/stack.yaml file has these fields defined:

extra-deps: [ ./othersample ]

# Override default flag values for local packages and extra-deps
flags:
  othersample:
    hello: True
  cryptonite:
    support_deepseq: False

I also created a cabal.project file in order to check that Cabal did the right thing, with these contents:

packages: ./ ./othersample
constraints: othersample +hello
constraints: cryptonite -support_deepseq

(Note that in order to force recompile of cryptonite deleting ~/.stack/snapshot and ~/.cabal/store might be needed)

Expected

I would have expected that the flag was overridden also for the local package.

Actual

See the line with the number 4 and the line with number 1646. As shown, the hello flag has not been overridden but the support_deepseq flag has been:

❯ stack build --flag othersample:hello --cabal-verbose 2>&1 | grep -n2 Flag
2-othersample> Using Parsec parser
3-othersample> Configuring othersample-0.1.0.0...
4:othersample> Flags chosen: hello=False
5-othersample> Dependency base ==4.13.0.0: using base-4.13.0.0
6-othersample> Dependency base ==4.13.0.0: using base-4.13.0.0
--
1146-memory     > Using Parsec parser
1147-memory     > Configuring memory-0.15.0...
1148:memory     > Flags chosen: support_basement=True, support_bytestring=True,
1149-memory     > support_deepseq=True, support_foundation=True
1150-memory     > Dependency base ==4.13.0.0: using base-4.13.0.0
--
1643-cryptonite > Using Parsec parser
1644-cryptonite > Configuring cryptonite-0.26...
1645:cryptonite > Flags chosen: check_alignment=False, integer-gmp=True,
1646-cryptonite > old_toolchain_inliner=False, support_aesni=True, support_deepseq=False,
1647-cryptonite > support_pclmuldq=False, support_rdrand=True, support_sse=False

Note that with the mentioned cabal.project file I'm able to do:

❯ cabal build --verbose 2>&1 | grep -n2 Flag
198-Redirecting build log to {handle:
199-/home/javier/.cabal/logs/ghc-8.8.3/basement-0.0.11-7df2738a446782507b41a27a4163e523923450c995eff9dcc98038607281b040.log}
200:Flags chosen: hello=True
201-Dependency base ==4.13.0.0: using base-4.13.0.0
202-Source component graph: component lib
❯ grep -n2 Flags ~/.cabal/logs/ghc-8.8.3/cryptonite-0.27-dcb26d37094d192b29f1da7bb6cdc8e2cc11d3fe14d9b55f12da72554485c787.log
12-/home/javier/.ghcup/bin/ghc-pkg dump '--package-db=/home/javier/.cabal/store/ghc-8.8.3/package.db' -v0
13-/home/javier/.ghcup/bin/ghc --print-libdir -hide-all-packages
14:Flags chosen: check_alignment=False, integer-gmp=True,
15-old_toolchain_inliner=False, support_aesni=True, support_deepseq=False,
16-support_pclmuldq=False, support_rdrand=True, support_sse=False,

Stack version

❯ stack --version
2.3.3 x86_64 hpack-0.34.2

Method of installation

get.haskellstack.org

@mtolly
Copy link
Contributor

mtolly commented Nov 15, 2021

This is still an issue, just encountered it on Version 2.7.3, Git revision 7927a3aec32e2b2e5e4fb5be76d0d50eddcc197f x86_64 hpack-0.34.4. Also #5301 appears to be the same issue

@jship
Copy link
Contributor

jship commented Feb 20, 2024

Confirmed this is happening in Version 2.13.1, Git revision 8102bb8afce90fc954f48efae38b87f37cabc988 x86_64 hpack-0.36.0.

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

No branches or pull requests

3 participants