-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61f53c6
commit 3bbf308
Showing
1 changed file
with
69 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,74 @@ | ||
--- | ||
synopsis: Add an Ord instance for ProjectConfigPath | ||
synopsis: Deduplicate "using configuration from" message | ||
packages: [cabal-install-solver] | ||
prs: 10546 | ||
--- | ||
|
||
Add an `Ord` instance for `ProjectConfigPath` that sorts URIs after local paths | ||
and longer paths after shorter ones. Deduplicate the printing of "Configuration is | ||
affected by the following files" messages. | ||
## Using Configuration From Message Changes | ||
|
||
Deduplicates and sorts the list of configuration files and URIs printed with the | ||
"using configuration from" messages. This is the message show when there's a | ||
build failure. We can trigger that message by using a non-existant package in | ||
the project, "no-pkg-dir". | ||
|
||
If an import is repeated in a `.project` or `.config` file it only imported once | ||
but if the same import is made from an imported file then it is repeated in the | ||
message. | ||
|
||
* The test set up: | ||
|
||
``` | ||
$ cat cabal.project | ||
packages: no-pkg-dir | ||
import: extra.config | ||
import: extra.config | ||
import: very-extra.config | ||
import: very-extra.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
|
||
$ cat extra.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
|
||
$ cat very-extra.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
import: https://www.stackage.org/lts-21.25/cabal.config | ||
``` | ||
|
||
* Before the fix: | ||
|
||
``` | ||
$ ~/.ghcup/bin/cabal-3.12.1.0 build all --dry-run | ||
When using configuration from: | ||
- cabal.project | ||
- extra.config | ||
- https://www.stackage.org/lts-21.25/cabal.config | ||
- https://www.stackage.org/lts-21.25/cabal.config | ||
- https://www.stackage.org/lts-21.25/cabal.config | ||
- very-extra.config | ||
The following errors occurred: | ||
- The package location 'no-pkg-dir' does not exist. | ||
``` | ||
|
||
* After the fix: | ||
|
||
``` | ||
$ cabal build all --dry-run | ||
When using configuration from: | ||
- cabal.project | ||
- extra.config | ||
- very-extra.config | ||
- https://www.stackage.org/lts-21.25/cabal.config | ||
The following errors occurred: | ||
- The package location 'no-pkg-dir' does not exist. | ||
``` | ||
|
||
## Ord ProjectConfigPath Instance Changes | ||
|
||
Adds a custom `Ord` instance for `ProjectConfigPath` that sorts URIs after local | ||
file paths and longer file paths after shorter ones as measured by the number of | ||
path segments. If still equal, then sorting is lexical. The project itself, a | ||
single element root path, compared to any of the configuration paths it imports, | ||
should always sort first. Comparing one project root path against another is | ||
done lexically. |