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

Extend cabal outdated to multi-package #8283

Open
andreasabel opened this issue Jul 12, 2022 · 4 comments
Open

Extend cabal outdated to multi-package #8283

andreasabel opened this issue Jul 12, 2022 · 4 comments
Assignees

Comments

@andreasabel
Copy link
Member

E.g. in the root of this repo:

cabal[master]$ cabal outdated
Error: cabal: No cabal file found.
Please create a package description file <pkgname>.cabal

It would be helpful if cabal outdated could also deal with a cabal.project file (instead of .cabal files only), similar to cabal build etc. It could list the outdated dependencies for all packages mentioned in cabal.project (grouped per package).

@erikd
Copy link
Member

erikd commented Oct 17, 2023

From HEAD of the cabal repo I get:

cabal run -- cabal outdated
Error: [Cabal-7654]
No cabal file found.
Please create a package description file <pkgname>.cabal

so this is definitely not working now.

@erikd erikd self-assigned this Oct 17, 2023
@andreabedini
Copy link
Collaborator

Copying here some comments from @hvr:

Here's some ideas for how to improve cabal outdated with the nix-local-build UI in mind:

cabal outdated should support target-selectors like new-build et al:

cabal outdated all would then iterate over all local packages configured in cabal.project and check all components for over-constricted bounds.

And it also makes sense to limit outdated to some components, i.e. if only care about a few components (and e.g. not the testsuite): cabal outdated lib:foo exe:doo would only check the two named components in whichever local package they're located.

Conversely, we have special names to e.g. refer to all testsuites in the target-selector; so you could also say cabal outdated tests to iterate over all test-suite components in your cabal.project.

cabal outdated already supports cabal.project.freeze; however, it would be convenient to have a variant which consults the last computed install-plan (and possibly compute one if it's needs (re)computation); IOW, a variant that combines cabal new-freeze with cabal outdated --new-freeze-file but without generating/overwriting an existing cabal.project.freeze file.

@erikd
Copy link
Member

erikd commented Oct 17, 2023

cabal outdated all would then iterate over all local packages configured in cabal.project

Isn't this functionality already available somewhere else for all of the new commands to use?

@andreabedini
Copy link
Collaborator

If you just want all the local packages you can take inspiration from here

freezeAction flags@NixStyleFlags{..} extraArgs globalFlags = do
unless (null extraArgs) $
die' verbosity $
"'freeze' doesn't take any extra arguments: "
++ unwords extraArgs
ProjectBaseContext
{ distDirLayout
, cabalDirLayout
, projectConfig
, localPackages
, buildSettings
} <-
establishProjectBaseContext verbosity cliConfig OtherCommand

If you want to accept a target like Herbert is saying you need to do something like this
https://github.com/haskell/cabal/blob/master/cabal-install/src/Distribution/Client/CmdListBin.hs#L100C3-L100C26

Note that Distribution.Client.CmdOutdated is an odd-ball. It follows the naming of v2 commands (Cmd*) and it uses ProjectFlags but it looks like it follows the pattern of v1 commands after that.

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

3 participants