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

Imported constraint edit not seen by cabal build #10029

Open
philderbeast opened this issue May 17, 2024 · 1 comment
Open

Imported constraint edit not seen by cabal build #10029

philderbeast opened this issue May 17, 2024 · 1 comment

Comments

@philderbeast
Copy link
Collaborator

philderbeast commented May 17, 2024

I've noticed a change in behaviour of cabal-install between cabal-install-3.10.3.0 and the version built from HEAD.

I'm having a go at converting hledger to use Updo for project generation. Like many such conversions, when there's a dependency on a version of a package that conflicts with a version on stackage, the stackage provided cabal.config must then be downloaded to project-stackage/lts-m.n.config (depending on the resolver) and edited locally to remove the conflicts, see maintaining a project. This cabal.config from stackage is imported into the cabal.project.

project-stackage
└── lts-m.n.config  # actually ./project-stackage/lts-18.28.config in this case

The change in behaviour I'm observing is that I could make these edits and rerun make -f project-files.mk cabal.project and the edit would be picked up immediately with cabal-install-3.10.3.0 but with cabal-install built from HEAD, the edit is not picked up. I can force it to be picked up by issuing a cabal clean.

Excuse me for not providing a more minimal reproduction right away but it is what I have at hand and this change in behaviour slows down the edit build turnaround speed for Updo conversion, from build-edit-build to build-edit-clean-build is more steps and slower. I could see it causing confusion too if a cabal-install user is left to wonder why an edit is not being picked up immediately.

  • With cabal-3.10.3.0
$ ~/.ghcup/bin/cabal --version
cabal-install version 3.10.3.0
compiled using version 3.10.3.0 of the Cabal library

$ ~/.ghcup/bin/cabal build all --enable-tests --enable-benchmarks
...
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] next goal: hledger-lib (user goal)
[__0] rejecting: hledger-lib-1.33.99 (constraint from project config
./project-stackage/lts-18.28.config requires ==1.21)
[__0] rejecting: hledger-lib-1.33.1, hledger-lib-1.33, hledger-lib-1.32.3,
hledger-lib-1.32.2, hledger-lib-1.32.1, hledger-lib-1.32, hledger-lib-1.31,
hledger-lib-1.30, hledger-lib-1.29.2, hledger-lib-1.29.1, hledger-lib-1.29,
hledger-lib-1.28, hledger-lib-1.27.1, hledger-lib-1.27, hledger-lib-1.26.1,
hledger-lib-1.26, hledger-lib-1.25, hledger-lib-1.24.1, hledger-lib-1.24,
hledger-lib-1.23, hledger-lib-1.22.2, hledger-lib-1.22.1, hledger-lib-1.22,
hledger-lib-1.21, hledger-lib-1.20.4, hledger-lib-1.20.3, hledger-lib-1.20.2,
hledger-lib-1.20.1, hledger-lib-1.20, hledger-lib-1.19.1, hledger-lib-1.19,
hledger-lib-1.18.1, hledger-lib-1.18, hledger-lib-1.17.1,
hledger-lib-1.17.0.1, hledger-lib-1.17, hledger-lib-1.16.2,
hledger-lib-1.16.1, hledger-lib-1.16, hledger-lib-1.15.2, hledger-lib-1.15.1,
hledger-lib-1.15, hledger-lib-1.14.1, hledger-lib-1.14, hledger-lib-1.13.1,
hledger-lib-1.13, hledger-lib-1.12, hledger-lib-1.11.1, hledger-lib-1.11,
hledger-lib-1.10, hledger-lib-1.9.1, hledger-lib-1.9, hledger-lib-1.5.1,
hledger-lib-1.5, hledger-lib-1.4, hledger-lib-1.3.2, hledger-lib-1.3.1,
hledger-lib-1.3, hledger-lib-1.2, hledger-lib-1.1, hledger-lib-1.0.1,
hledger-lib-1.0, hledger-lib-0.27.1, hledger-lib-0.27, hledger-lib-0.26,
hledger-lib-0.25.1, hledger-lib-0.25, hledger-lib-0.24.1, hledger-lib-0.24,
hledger-lib-0.23.3, hledger-lib-0.23.2, hledger-lib-0.23.1, hledger-lib-0.23,
hledger-lib-0.22.2, hledger-lib-0.22.1, hledger-lib-0.22, hledger-lib-0.21.3,
hledger-lib-0.21.2, hledger-lib-0.21.1, hledger-lib-0.21,
hledger-lib-0.20.0.1, hledger-lib-0.20, hledger-lib-0.19.3,
hledger-lib-0.19.1, hledger-lib-0.19, hledger-lib-0.18.2, hledger-lib-0.18.1,
hledger-lib-0.18, hledger-lib-0.17, hledger-lib-0.16.1, hledger-lib-0.16,
hledger-lib-0.15.2, hledger-lib-0.15, hledger-lib-0.14, hledger-lib-0.13,
hledger-lib-0.12.1, hledger-lib-0.12, hledger-lib-0.11.1, hledger-lib-0.11,
hledger-lib-0.10, hledger-lib-0.9, hledger-lib-1.24.99 (constraint from user
target requires ==1.33.99)
[__0] fail (backjumping, conflict set: hledger-lib)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hledger-lib

Make the edit, commenting out the line in the downloaded cabal.config (in ./project-stackage/lts-18.28.config) for hledger-lib ==1.21, and then try again we get the next conflict right away:

constraints:
...
-              hledger-lib ==1.21,
+           -- hledger-lib ==1.21,
$ ~/.ghcup/bin/cabal build all --enable-tests --enable-benchmarks
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: hledger-lib-1.33.99 (user goal)
[__1] next goal: terminal-size (dependency of hledger-lib)
[__1] rejecting: terminal-size-0.3.4 (constraint from project config
./project-stackage/lts-18.28.config requires ==0.3.2.1)
[__1] rejecting: terminal-size-0.3.3, terminal-size-0.3.2.1,
terminal-size-0.3.2, terminal-size-0.3.1, terminal-size-0.3.0,
terminal-size-0.2.1.0, terminal-size-0.2.0.0, terminal-size-0.1.0.0
(constraint from project config
/home/philderbeast/dev/src/updo/hledger/cabal.project requires ==0.3.4)
[__1] fail (backjumping, conflict set: hledger-lib, terminal-size)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: hledger-lib, terminal-size
  • With cabal-HEAD
$ git rev-parse HEAD
b7ed4f76e0b3d7a33b58ee3a3691128199a196c1

$ cabal install cabal-install:exe:cabal --overwrite-policy=always

$ cabal --version
cabal-install version 3.13.0.0
compiled using version 3.13.0.0 of the Cabal library

$ cabal build all --enable-tests --enable-benchmarks
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] next goal: hledger-lib (user goal)
[__0] rejecting: hledger-lib-1.33.99
      (constraint from project-stackage/lts-18.28.config requires ==1.21)
        imported by: cabal.project
[__0] rejecting: hledger-lib; 1.33.1, 1.33, 1.32.3, 1.32.2, 1.32.1, 1.32, 1.31, 1.30, 1.29.2, 1.29.1, 1.29, 1.28, 1.27.1, 1.27, 1.26.1, 1.26, 1.25, 1.24.1, 1.24, 1.23, 1.22.2, 1.22.1, 1.22, 1.21, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.1, 1.19, 1.18.1, 1.18, 1.17.1, 1.17.0.1, 1.17, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.1, 1.14, 1.13.1, 1.13, 1.12, 1.11.1, 1.11, 1.10, 1.9.1, 1.9, 1.5.1, 1.5, 1.4, 1.3.2, 1.3.1, 1.3, 1.2, 1.1, 1.0.1, 1.0, 0.27.1, 0.27, 0.26, 0.25.1, 0.25, 0.24.1, 0.24, 0.23.3, 0.23.2, 0.23.1, 0.23, 0.22.2, 0.22.1, 0.22, 0.21.3, 0.21.2, 0.21.1, 0.21, 0.20.0.1, 0.20, 0.19.3, 0.19.1, 0.19, 0.18.2, 0.18.1, 0.18, 0.17, 0.16.1, 0.16, 0.15.2, 0.15, 0.14, 0.13, 0.12.1, 0.12, 0.11.1, 0.11, 0.10, 0.9, 1.24.99 (constraint from user target requires ==1.33.99)
[__0] fail (backjumping, conflict set: hledger-lib)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hledger-lib

Make edit and try again but no change (same output as above). The next conflict is shown only after a clean:

$ cabal build all --enable-tests --enable-benchmarks
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] next goal: hledger-lib (user goal)
[__0] rejecting: hledger-lib-1.33.99
      (constraint from project-stackage/lts-18.28.config requires ==1.21)
        imported by: cabal.project
[__0] rejecting: hledger-lib; 1.33.1, 1.33, 1.32.3, 1.32.2, 1.32.1, 1.32, 1.31, 1.30, 1.29.2, 1.29.1, 1.29, 1.28, 1.27.1, 1.27, 1.26.1, 1.26, 1.25, 1.24.1, 1.24, 1.23, 1.22.2, 1.22.1, 1.22, 1.21, 1.20.4, 1.20.3, 1.20.2, 1.20.1, 1.20, 1.19.1, 1.19, 1.18.1, 1.18, 1.17.1, 1.17.0.1, 1.17, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.1, 1.14, 1.13.1, 1.13, 1.12, 1.11.1, 1.11, 1.10, 1.9.1, 1.9, 1.5.1, 1.5, 1.4, 1.3.2, 1.3.1, 1.3, 1.2, 1.1, 1.0.1, 1.0, 0.27.1, 0.27, 0.26, 0.25.1, 0.25, 0.24.1, 0.24, 0.23.3, 0.23.2, 0.23.1, 0.23, 0.22.2, 0.22.1, 0.22, 0.21.3, 0.21.2, 0.21.1, 0.21, 0.20.0.1, 0.20, 0.19.3, 0.19.1, 0.19, 0.18.2, 0.18.1, 0.18, 0.17, 0.16.1, 0.16, 0.15.2, 0.15, 0.14, 0.13, 0.12.1, 0.12, 0.11.1, 0.11, 0.10, 0.9, 1.24.99 (constraint from user target requires ==1.33.99)
[__0] fail (backjumping, conflict set: hledger-lib)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hledger-lib

$ cabal clean
Warning: this is a debug build of cabal-install with assertions enabled.

$ cabal build all --enable-tests --enable-benchmarks
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: hledger-lib-1.33.99 (user goal)
[__1] next goal: terminal-size (dependency of hledger-lib)
[__1] rejecting: terminal-size-0.3.4
      (constraint from project-stackage/lts-18.28.config requires ==0.3.2.1)
        imported by: cabal.project
[__1] rejecting: terminal-size; 0.3.3, 0.3.2.1, 0.3.2, 0.3.1, 0.3.0, 0.2.1.0, 0.2.0.0, 0.1.0.0
      (constraint from cabal.project requires ==0.3.4)
[__1] fail (backjumping, conflict set: hledger-lib, terminal-size)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hledger-lib, terminal-size

Is this an intended change in behaviour in the upcoming cabal-install release?

@philderbeast
Copy link
Collaborator Author

I did a git bisect and found that this change arrived with #9578.

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

1 participant