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

Print info about current project file in use to stderr and ignore the imports by default #10548

Merged
merged 6 commits into from
Nov 13, 2024

Conversation

ulysses4ever
Copy link
Collaborator

@ulysses4ever ulysses4ever commented Nov 11, 2024

fix #10547 by printing the project config info to stderr.

Also, report only top-level project configs with the default verbosity. Otherwise, imported config files can still be seen in the verbose mode.

Manual Q/A

Try to reproduce #10547


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • [N/A] This fixes code that has not been released yet. Any changes that could be relevant to users have been recorded in the changelog.
  • [N/A] The documentation has been updated, if necessary.
  • Manual QA notes have been included.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

@ulysses4ever
Copy link
Collaborator Author

Oh my, the two hundred tests now fail because warn attaches Warning: to the message..

@ulysses4ever
Copy link
Collaborator Author

I just ran list-bin on Cabal repo and the output is a hot mess:

❯ cabal list-bin cabal
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by the following files:
- cabal.project
Configuration is affected by the following files:
- project-cabal/constraints.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/ghc-latest.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/ghc-options.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/benchmarks.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/buildinfo.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/cabal.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/install.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/integration-tests.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
Configuration is affected by the following files:
- project-cabal/pkgs/tests.config
imported by: project-cabal/pkgs.config
imported by: cabal.project
/home/artem/Dev/cabal/repo/dist-newstyle/build/x86_64-linux/ghc-9.10.1/cabal-install-3.15.0.0/x/cabal/build/cabal/cabal

@ulysses4ever
Copy link
Collaborator Author

Okay, I figured how to print to stderr without reaching to warn: verboseStderr verbosity.

I'm also fixing the above mentioned issue with multiple Configuration is affected. It still looks quite chatty for Cabal, which uses plenty of imports since recently. Maybe we should find a way to print only top-level project files.

@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch 2 times, most recently from 0136805 to f2888ce Compare November 12, 2024 01:04
@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch from f2888ce to db8e6b4 Compare November 12, 2024 01:07
@philderbeast
Copy link
Collaborator

philderbeast commented Nov 12, 2024

Maybe we should find a way to print only top-level project files.

I'm working on something similar (an alternative to #9933 that warns instead of errors), see branch fix/y-fork-project-import-warning-only. I've seen the loss of indent in those messages before and corrected it by changing from warn to noticeDoc.

@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch from 6ff627c to 1ec2c25 Compare November 12, 2024 01:57
@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch from 1ec2c25 to 7f89bd0 Compare November 12, 2024 01:57
@ulysses4ever
Copy link
Collaborator Author

All right, now it prints only top-level project config files in the default verbosity. In the verbose mode it prints the whole thing (imported project files too). The formatting of imports is not great but it's okay for verbose mode and can be fixed later if desired.

@ulysses4ever
Copy link
Collaborator Author

@Kleidukos, #10507 (backported to 3.14) turned out severely undercooked. This PR fixes it for the most part. So, I hope it can be backported too. Otherwise, it’d be desirable to revert the backport of 10507.

@Kleidukos
Copy link
Member

Sure, just put the correct labels to remind us to do the backports :)

@ulysses4ever ulysses4ever changed the title Print info about current project file in use to stderr Print info about current project file in use to stderr and ignore the imports by default Nov 12, 2024
@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch 2 times, most recently from f96907b to e63ac8b Compare November 12, 2024 16:06
@ulysses4ever ulysses4ever force-pushed the print-project-to-stderr branch from cf47f01 to 8c6e2aa Compare November 12, 2024 19:04
@ulysses4ever ulysses4ever added squash+merge me Tell Mergify Bot to squash-merge and removed attention: needs-review labels Nov 13, 2024
@mergify mergify bot added the ready and waiting Mergify is waiting out the cooldown period label Nov 13, 2024
@ulysses4ever
Copy link
Collaborator Author

This fixes a regression on master that was backported to 3.14. In the interest of getting it into the release, I'm skipping the two-days delay.

@ulysses4ever ulysses4ever added merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days and removed merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days ready and waiting Mergify is waiting out the cooldown period labels Nov 13, 2024
@mergify mergify bot merged commit 7de199a into master Nov 13, 2024
49 checks passed
@mergify mergify bot deleted the print-project-to-stderr branch November 13, 2024 00:59
@ulysses4ever ulysses4ever added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Nov 13, 2024
@ulysses4ever
Copy link
Collaborator Author

@mergify backport 3.14

Copy link
Contributor

mergify bot commented Nov 13, 2024

backport 3.14

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 13, 2024
… imports by default (#10548)

* Print info about current project file in use to stderr (fix #10547)

* only report top-level project config files in the default verbosity

in verbose mode report imported files too

* fix tests

* don't print anything when provenance is empty

* fix tests

* Apply suggestions from code review

Co-authored-by: ffaf1 <[email protected]>

---------

Co-authored-by: ffaf1 <[email protected]>
(cherry picked from commit 7de199a)

# Conflicts:
#	cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out
mergify bot added a commit that referenced this pull request Nov 18, 2024
…rr and ignore the imports by default (#10550)

* Print info about current project file in use to stderr and ignore the imports by default (#10548)

* Print info about current project file in use to stderr (fix #10547)

* only report top-level project config files in the default verbosity

in verbose mode report imported files too

* fix tests

* don't print anything when provenance is empty

* fix tests

* Apply suggestions from code review

Co-authored-by: ffaf1 <[email protected]>

---------

Co-authored-by: ffaf1 <[email protected]>
(cherry picked from commit 7de199a)

# Conflicts:
#	cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out

* fixup! fix conflicts

---------

Co-authored-by: Artem Pelenitsyn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attention: needs-backport 3.14 merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days squash+merge me Tell Mergify Bot to squash-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Printing current project file to stdout (#10507) breaks the usual list-bin workflow
5 participants