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

Draft:Implement v2-outdated command for cabal-install #10878

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mpickering
Copy link
Collaborator

This commit updates the outdated command to the new v2 architecture:

  • Transform the old outdated command into a new v2-style command v2-outdated
  • Support three modes of operation:
    • Check for outdated dependencies in v1-style freeze file
    • Check for outdated dependencies in project context (cabal.project & cabal.project.freeze)
    • Check for outdated dependencies in local packages

Since the cabal outdated command now supports the v2-architecture, you can request to run the v2-outdated command on any target.

I also introduced the resolveTargetsFromLocalPackages which resolves which local packages targets refer to without having to run the solver. This will be useful for cabal check as well.

A change in behaviour from before is that the package description is flattened, so all bounds will be warned about rather than those in conditional branches being ignored.

Fixes #8283

Please read Github PR Conventions and then fill in one of these two templates.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:


Template B: This PR does not modify behaviour or interface

E.g. the PR only touches documentation or tests, does refactorings, etc.

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

This commit updates the outdated command to the new v2 architecture:

- Transform the old `outdated` command into a new v2-style command `v2-outdated`
- Support three modes of operation:
  - Check for outdated dependencies in v1-style freeze file
  - Check for outdated dependencies in project context (cabal.project & cabal.project.freeze)
  - Check for outdated dependencies in local packages

Since the `cabal outdated` command now supports the v2-architecture, you
can request to run the `v2-outdated` command on any target.

I also introduced the `resolveTargetsFromLocalPackages` which resolves
which local packages targets refer to without having to run the solver.
This will be useful for `cabal check` as well.

A change in behaviour from before is that the package description is
flattened, so all bounds will be warned about rather than those in
conditional branches being ignored.

Fixes #8283
@mpickering mpickering marked this pull request as draft March 28, 2025 13:22
@andreasabel
Copy link
Member

So I did a first try:

hackage-security $ cabal-master outdated                    
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by the following files:
- cabal.project
Error: [Cabal-7134]
No targets given and there is no package in the current directory. Use the target 'all' for all packages in the project or specify packages or components by name or location. See 'cabal build --help' for more details on target options.

$  cabal-master outdated all                                                                        
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by the following files:
- cabal.project
Outdated dependencies:
containers >=0.5.11 && <0.8 (latest: 0.8,
hackage-security-0.6.2.6:lib:hackage-security)
Cabal >=2.2.0.1 && <2.6 || >=3.0 && <3.7 (latest: 3.14.1.1,
hackage-security-0.6.2.6:lib:hackage-security)
Cabal-syntax <3.7 (latest: 3.14.1.0,
hackage-security-0.6.2.6:lib:hackage-security)
Cabal >=2.2.0.1 && <2.6 || >=3.0 && <3.7 (latest: 3.14.1.1,
hackage-security-0.6.2.6:test:TestSuite)
Cabal-syntax <3.7 (latest: 3.14.1.0, hackage-security-0.6.2.6:test:TestSuite)
Cabal >=2.2.0.1 && <3.7 (latest: 3.14.1.1,
example-client-0.1.0.0:exe:example-client)
Cabal-syntax <3.7 (latest: 3.14.1.0,
example-client-0.1.0.0:exe:example-client)
Cabal >=2.2.0.1 && <2.6 || >=3.0 && <3.7 (latest: 3.14.1.1,
hackage-repo-tool-0.1.1.4:exe:hackage-repo-tool)
Cabal-syntax <3.7 (latest: 3.14.1.0,
hackage-repo-tool-0.1.1.4:exe:hackage-repo-tool)
containers >=0.5.11 && <0.8 (latest: 0.8,
precompute-fileinfo-0.1.0.0:exe:precompute-fileinfo)

So, great improvement over the status quo already, thanks!

Wishlist:

  • cabal outdated defaults to all if no targets are given
  • the output is more clearly structured, e.g. a hierarchical bullet list with package names as first level, targets as second level and dependencies as third level level:
Outdated dependencies:
* hackage-security
  - lib:hackage-security
    * containers >=0.5.11 && <0.8 (latest: 0.8)
    * Cabal >=2.2.0.1 && <2.6 || >=3.0 && <3.7 (latest: 3.14.1.1)
  - test:TestSuite
  - ...
* example-client
* ...

@mpickering
Copy link
Collaborator Author

cabal outdated defaults to all if no targets are given

I agree with this, but it's the same how cabal build and all other v2- commands work.

the output is more clearly structured, e.g. a hierarchical bullet list with package names as first level, targets as second level and dependencies as third level level:

Yes, I can implement this, I just ran out of steam for this initial patch.

Thanks for the feedback.

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

Successfully merging this pull request may close these issues.

Extend cabal outdated to multi-package
2 participants